Scripting Guide > Data Tables > Columns > Add Several Columns at Once
发布日期: 11/15/2021

Add Several Columns at Once

The Add Multiple Columns message creates several columns at once. Arguments include the column name prefix, the number of columns, where to insert them (Before First, After Last, or After(col)), and the data type (Numeric, Row State, or Character(width)). An additional argument, field width, is optional for a numeric column.

// add two row state columns named "beginning <n>" before the first column

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt << Add Multiple Columns( "beginning", 2, Before First, Row State );
 

// add three numeric columns named "middle <n>" after the height column

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt << Add Multiple Columns( "middle", 3, After( :height ), Numeric );
 

// add four character columns named "end <n>" after the last column

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dt << Add Multiple Columns( "end", 4, After Last, Character( 4 ) );

The column name is a prefix. If multiple columns with the same name are added, a sequential number is appended to each column name (beginning 1, beginning 2, and so on).

需要更多信息?有问题?从 JMP 用户社区得到解答 (community.jmp.com).