Language Reference
TABLEGETVARINDEX Function
TABLEGETVARINDEX (table, colnames) ;
This function is supported by the IML procedure and the iml action.
The TableGetVarIndex function returns a row vector that contains the column numbers (indices) for the specified column names.
The function takes the following input arguments:
- table
specifies an existing table.
- colnames
specifies a character vector of names (such as {"X" "Y"}).
The following statements obtain the column numbers of the Sex and Height variables. Figure 457 shows that Sex is the second variable and Height is the fourth variable.
tbl = TableCreateFromDataSet("Sashelp", "Class");
colNames = {"Sex" "Height"};
idx = TableGetVarIndex(tbl, colNames);
print idx[colname=colNames];
Figure 457: Indices of Column Names
| idx | |
|---|---|
| Sex | Height |
| 2 | 4 |
Last updated: May 07, 2026