How to seperate columns into different tables.I have a datatable with 5 columns. Field names are from from A to Z. Now i want to seperate this table into 5 si gnetables. Every table just contain one column. The table A has one column A. Until the table E ha e one column Z. Can you give me suggestion on JSL?
ScriptingRe: How to seperate columns into different tables.Here is a script that illustrates how to do this. I strongly suggest that you take the time to read the Scripting Guide from the JMP Documentation Library, available under the Help pull down menu.
Names Default To Here( 1 );
// Open Data Table: big class.jmp
// → Data Table( "big class" )
dt = Open( "$SAMPLE_DATA/big class.jmp" );
// Loop across each column, selecting it and then subsetting
// the data table with all rows and just the selected column
For( i = 1, i <= N Cols( dt ), i++,
dt << select columns( Column( dt, i ) );
dt << subset( selected rows( 0 ), selected columns( 1 ) );
wait(0);
);
Re: How to seperate columns into different tables.Thank you for giving me good suggestion. I will take time to read the guide. I tried your scrip with big class datatable. However it seems to bring back 5 the same tables with 5 columns. Can you help me why? My purpose is to get one col for every table from A to E.
Re: How to seperate columns into different tables.I assume the issue is that you are running version 13 or older. The Select Columns() function did not exist prior to JMP 14. Here is a different approach that does work.
Names Default To Here( 1 );
// Open Data Table: big class.jmp
// → Data Table( "big class" )
dt = Open( "$SAMPLE_DATA/big class.jmp" );
// Loop across each column, specifying a single column on
// each iteration
For( i = 1, i <= N Cols( dt ), i++,
dt << subset( selected rows(0), columns(column(dt,i)));
);