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
sciguy
Level III

Nested Recode

Is there a way to nest a Recode on a single column based on multiple columns using JSL?

 

Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");

dt << New Column( "Stature",
		Character( 40 ),
		"Nominal",
		Formula(
			Recode(
				:age & :height,
				{Map Value(
					_rcOrig, {
					"12" & "59", "short tween",
					"12" & "66", "Tall tween",
					"17" & "70", "Tall teenager"
					},
					Unmatched( empty() )
				)}
			)
		),
	Set Display Width( 56 )
);
1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: Nested Recode

I am not aware of the Recode having the capability you are asking about, however it is easily handled in an If() function

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

dt << New Column( "Stature",
	Character( 40 ),
	"Nominal",
	Formula(
		If(
			:age == 12 & :Height == 59, "short tween",
			:age == 12 & :height == 66, "Tall tween",
			:age == 17 & :height == 70, "Tall teenager",
			""
		)
	)
);
Jim

View solution in original post

2 REPLIES 2
txnelson
Super User

Re: Nested Recode

I am not aware of the Recode having the capability you are asking about, however it is easily handled in an If() function

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

dt << New Column( "Stature",
	Character( 40 ),
	"Nominal",
	Formula(
		If(
			:age == 12 & :Height == 59, "short tween",
			:age == 12 & :height == 66, "Tall tween",
			:age == 17 & :height == 70, "Tall teenager",
			""
		)
	)
);
Jim
sciguy
Level III

Re: Nested Recode

This worked perfectly. Should have gone with an if() function to begin with. Thank you.

Recommended Articles