Column Name(n) returns the name of the n th column.
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
Column Name( 2 );
age
The returned value is a name value, not a quoted string. What this means is you can use it anywhere you would normally use the actual name in a script. For example, you could subscript it:
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
Column Name( 2 )[1];
12
If you want the name as a text string, quote it with Char:
Char( Column Name( 2 ) );
"age"
To retrieve a list of the names of all columns in a data table, submit Get Column Names.
dt << Get Column Names( argument );
where the optional argument controls the output of the Get Column Names function, as follows:
• Specify Numeric, Character, Row State, or Expression to include only those column data types.
• Specify Continuous, Ordinal, Nominal, Multiple Response, Unstructured Text, None, and Vector to include only those modeling types.
• Specify String to return a list of strings rather than column names.
For example, if you want to get numeric and continuous columns in the Big Class.jmp sample data table, proceed as follows:
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
names = dt << Get Column Names(Numeric, "Continuous")
{height, weight}