I have a script that reformats many files and performs some analysis producing a final summary table, however the order in which the calculations are done and new columns are added doesn't produce a very readable format.
I would like to pass the list of column names in the order I want them.
Is there a built - in way of doing this?
e.g. if I had a table with: Column 1, Column 2, Column 3, Column 4
I want to pass in the list {Column 2, Column 4, Column 1, Column 3} to the table and have the reorder the table columns to match.
Thanks!
Here is the way I handle this. By working backwards through the list, and moving each to the first position, the columns end up as you want them.
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
myList = {"age", "weight", "height"};
For( i = N Items( myList ), i >= 1, i--,
Eval( Parse( "dt << Move Selected Columns(" || myList[i] || ", To first )" ) )
);
Here is the way I handle this. By working backwards through the list, and moving each to the first position, the columns end up as you want them.
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
myList = {"age", "weight", "height"};
For( i = N Items( myList ), i >= 1, i--,
Eval( Parse( "dt << Move Selected Columns(" || myList[i] || ", To first )" ) )
);
Nice, simple and clever solution @txnelson
That's such an ingenious fix!