Scripting Guide > Data Tables > Columns > Rearrange and Move Columns
发布日期: 04/13/2021

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 );
需要更多信息?有问题?从 JMP 用户社区得到解答 (community.jmp.com).