Functions Used Only in GTL

The following table shows some functions that are used only in GTL. As with other functions, these must be enclosed within an EVAL. In all these functions, column can be either the name of a column in the input data set or a dynamic / macro variable that resolves to such a column.
Function Name
Description
COLNAME(column)
returns the case-sensitive name of the column.
COLLABEL(column)
returns the case-sensitive label of the column. If no label is defined for the column, the case-sensitive name of the column is returned.
EXISTS(item)
returns 1 if specified item exists, 0 otherwise. If item is a column, it tests for the presence of the column in the input data set. If item is a dynamic / macro variable, it tests whether there has been a run-time initialization of the variable.
EXPAND(numeric-column, freq-column)
creates a new column as (numeric-column * frequency-column)
ASORT(column, RETAIN=ALL)
sorts all columns of the data object by the values of column in ascending order. SORT is an alias for ASORT.
Warning: if the RETAIN=ALL argument is not included, column alone is sorted, not the other columns, causing rowwise information to be lost.
Limitation: only one sort operation (whether an ASORT() or DSORT() function) can be used within a single template definition.
DSORT(column, RETAIN=ALL)
sorts all columns of the data object by the values of column in descending order.
Warning: if the RETAIN=ALL argument is not included, column alone is sorted, not the other columns, causing rowwise information to be lost.
Limitation: only one sort operation (whether an ASORT() or DSORT() function) can be used within a single template definition.
NUMERATE(column)
returns a column that contains the ordinal position of each observation in the input data set (similar to an OBS column)
Examples:
/* arrange bars in descending order of response values */ 
barchartparm x=region y=eval(dsort(amount,retain=all));  

/* label outliers with their position in the data set */
/* it does not matter which column is used for NUMERATE() */
boxplot x=age y=weight / datalabel=eval(numerate(age));

/* add information about the column being processed,
   which is passed by a dynamic */
entrytitle "Distribution for " eval(colname(DYNVAR));