cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • JMP will suspend normal business operations for our Winter Holiday beginning on Wednesday, Dec. 24, 2025, at 5:00 p.m. ET (2:00 p.m. ET for JMP Accounts Receivable).
    Regular business hours will resume at 9:00 a.m. EST on Friday, Jan. 2, 2026.
  • We’re retiring the File Exchange at the end of this year. The JMP Marketplace is now your destination for add-ins and extensions.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
cpatty
Level I

Wrong expression type error

Hey Community,

 I have a formula that works perfectly when I use in a table column but will not work at all in my script. I'm certain I've overlooked something stupid but can't seem to figure it out. Anyone want to give it fresh eyes? 

 

dt3 << New Column( "Age Group", Character, "Nominal" );

dt3:Age Group << Set Each Value(
    If(
        :Overdue Age < 1, Empty(),
        1 <= :Overdue Age < 90, "<3 mo",
        90 <= :Overdue Age < 181, "3-6 mo",
        180 <= :Overdue Age < 366, "6-12 mo",
        :Overdue Age > 365, "More than 12 mo"
    )
);

This is the error I'm getting, below.

 

cpatty_0-1720747011453.png

 

Thanks!

1 REPLY 1
jthi
Super User

Re: Wrong expression type error

Try changing Empty() to "" and add "" for else statement

Names Default To Here(1); 

dt = open("$SAMPLE_DATA/Big Class.jmp");

dt << New Column( "Age Group", Character, "Nominal");

Column(dt, "Age Group") << Set Each Value(
    If(
        :Age < 13, "",
        13 <= :Age < 14, "<3 mo",
        14 <= :Age < 17, "3-6 mo",
        :Age >= 17, "More than 12 mo",
        ""
    )
);
-Jarmo

Recommended Articles