cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Sign-in to the JMP Community will be unavailable intermittently Dec. 6-7 due to a system update. Thank you for your understanding!
  • We’re retiring the File Exchange at the end of this year. The JMP Marketplace is now your destination for add-ins and extensions.
  • JMP 19 is here! Learn more about the new features.

Discussions

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

Transfer columns with values to a new table

Please will you help me with this script. I'm trying to transfer a column full of items/values (some characters and Numerics) from an old table to a new table and this scripts is not fully working. I'm propably missing something. I'm sorry I'm new to JMP.

 

DATAtwo=Data Table("Results Extract");

testid = DATAtwo:column3 << Get Values; // Test

trans =Column(testid);

 

dtfour << New Column( "key", formula( trans[dtfour:column6] ) );

2 REPLIES 2
txnelson
Super User

Re: Transfer columns with values to a new table

Here is an example of how to do what you are looking for:

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

MyNames = dt:Name << get values;

dt2 = New Table( "new",
	New Column( "TheNames", character, values( MyNames ) ),
	New Column( "TheAges", values( dt:age << get values ) )
);
Jim
Jeff_Perkinson
Community Manager Community Manager

Re: Transfer columns with values to a new table

I always start by thinking of how I would do this interactively and then get the script from the resulting data table.

 

To create a new data table with only a some columns of an existing one, I'd use Tables -> Subset. 

 

If wanted to copy those columns to another existing data table I'd use Tables->Join. 

-Jeff

Recommended Articles