cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JMP is taking Discovery online, April 16 and 18. Register today and join us for interactive sessions featuring popular presentation topics, networking, and discussions with the experts.
Choose Language Hide Translation Bar
sanqub
Level III

How to combine/recode two columns?

I want to combine 2 columns. Suppose in sample library, big class example.

I want a new column which is combination of two columns "sex" and "age". The resulting column should have rows in form F12, M12 etc. 

I tried with to combine columns using utility>combine but it gives error.

 

Thanks for your help

2 ACCEPTED SOLUTIONS

Accepted Solutions

Re: How to combine/recode two columns?

Have you tried selecting both columns, right-clicking on the column name and selecting New Formula Column>Character > Concatenate?

View solution in original post

ron_horne
Super User (Alumni)

Re: How to combine/recode two columns?

try this.

Names Default To Here( 1 );

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

dt << New Column( "Column", Character, Nominal, Formula( :sex || Char( :age ) ) );

i think the concatenate function only takes characters.

best,

ron

 

View solution in original post

6 REPLIES 6

Re: How to combine/recode two columns?

Have you tried selecting both columns, right-clicking on the column name and selecting New Formula Column>Character > Concatenate?
sanqub
Level III

Re: How to combine/recode two columns?

Thank You.

ron_horne
Super User (Alumni)

Re: How to combine/recode two columns?

try this.

Names Default To Here( 1 );

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

dt << New Column( "Column", Character, Nominal, Formula( :sex || Char( :age ) ) );

i think the concatenate function only takes characters.

best,

ron

 

sanqub
Level III

Re: How to combine/recode two columns?

Hi Ron,

 

Thanks for the script. Even I think concatenate function just takes characters.

 

Santosh

ezorlo
Level IV

Re: How to combine/recode two columns?

hi i get an error on the snippet of code "<<" 

txnelson
Super User

Re: How to combine/recode two columns?

Are you running the exact copy of the code below?

Names Default To Here( 1 );

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

dt << New Column( "Column", Character, Nominal, Formula( :sex || Char( :age ) ) );

If not, can you include the exact JSL you are using.

Jim