Subscribe Bookmark RSS Feed

How to combine/recode two columns?

sanqub

Community Trekker

Joined:

Jan 11, 2016

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
M_Anderson

Staff

Joined:

Nov 21, 2014

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

Super User

Joined:

Jun 23, 2011

Solution

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

 

4 REPLIES
M_Anderson

Staff

Joined:

Nov 21, 2014

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

Community Trekker

Joined:

Jan 11, 2016

Thank You.

ron_horne

Super User

Joined:

Jun 23, 2011

Solution

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

Community Trekker

Joined:

Jan 11, 2016

Hi Ron,

 

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

 

Santosh