Scripting Guide > Data Tables > Columns > Get Column Names
Publication date: 03/23/2021

Get Column Names

Column Name(n) returns the name of the n th column.

dt = Open( "$SAMPLE_DATA/Big" );
Column Name( 2 );


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" );
Column Name( 2 )[1];


If you want the name as a text string, quote it with Char:

Char( Column Name( 2 ) );


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 sample data table, proceed as follows:

dt = Open( "$SAMPLE_DATA/Big" );
names = dt << Get Column Names(Numeric, "Continuous")

{height, weight}

Want more information? Have questions? Get answers in the JMP User Community (