Choose Language Hide Translation Bar
Highlighted
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
Highlighted

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

Highlighted
ron_horne
Super User

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
Highlighted

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

Highlighted
sanqub
Level III

Re: How to combine/recode two columns?

Thank You.

Highlighted
ron_horne
Super User

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

Highlighted
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

Highlighted
ezorlo
Level III

Re: How to combine/recode two columns?

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

Highlighted
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
Article Labels

    There are no labels assigned to this post.