Scripting Guide > Data Tables > Columns > Rearrange and Move Columns
Publication date: 08/13/2020

Rearrange and Move Columns

These messages enable you to rearrange columns in a data table:

dt << Reorder By Name;           // alphanumeric order
dt << Reverse Order;             // reverse current order
dt << Reorder By Data Type;      // row state, character, and then numeric
dt << Reorder By Modeling Type;  // continuous, ordinal, nominal
dt << Original Order;            // saved order

These commands move the currently selected column or columns to the indicated destination point.

dt << Move Selected Column( to first );
dt << Move Selected Column( to last );
dt << Move Selected Column( after( "name" ) );

Note that Move Selected Column is an alias for Move Selected Columns.

You can also move columns without first selecting them in the data table by using the following syntax.

dt << Move Selected Columns( {"name"}, to first );
dt << Move Selected Columns( {"name"}, to last );
dt << Move Selected Columns( {"name"}, after( "name" ) );

You may use a list to specify the column names.

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
list = {"name", "sex"};
dt << Move Selected Columns( list, To Last );
Want more information? Have questions? Get answers in the JMP User Community (community.jmp.com).
.