The GAM Procedure

CLASS Statement

  • CLASS variable <(options)> <variable <(options)> …> </ options>;

The CLASS statement names the classification variables to be used in the analysis. The CLASS statement must precede the MODEL statement. You can specify various options for each variable by enclosing them in parentheses after the variable name. You can also specify global options for the CLASS statement by placing them after a slash (/). Global options are applied to all the variables specified in the CLASS statement. If you specify more than one CLASS statement, the global options specified on any one CLASS statement apply to all CLASS statements. However, individual CLASS variable options override the global options.


reverses the sort order of the classification variable. If both the DESCENDING and ORDER=  options are specified, PROC GAM orders the categories according to the ORDER=  option and then reverses that order.


specifies the sort order for the categories of categorical variables. This ordering determines which parameters in the model correspond to each level in the data. When the default ORDER=FORMATTED is in effect for numeric variables for which you have supplied no explicit format, the levels are ordered by their internal values. The following table shows how PROC GAM interprets values of the ORDER= option.

Value of ORDER=

Levels Sorted By


Order of appearance in the input data set


External formatted value, except for numeric variables with no explicit format, which are sorted by their unformatted (internal) value


Descending frequency count; levels with the most observations come first in the order


Unformatted value

By default, ORDER=FORMATTED. For FORMATTED and INTERNAL, the sort order is machine-dependent. For more information on sort order, see the chapter on the SORT procedure in the Base SAS Procedures Guide and the discussion of BY-group processing in SAS Language Reference: Concepts.

REF=’level’ | keyword

specifies a level of the classification variable to be put at the end of the list of levels. This level thus corresponds to the reference level in the usual interpretation of the linear estimates with a singular parameterization.

For an individual variable REF= option (but not for a global REF= option), you can specify the level of the variable to use as the reference level. Specify the formatted value of the variable if a format is assigned. For a global or individual variable REF= option, you can use one of the following keywords. The default is REF=LAST.


designates the first ordered level as reference.


designates the last ordered level as reference.


specifies the length n of CLASS variable values to use in determining CLASS variable levels. If you specify TRUNCATE without the length n, the first 16 characters of the formatted values are used. When formatted values are longer than 16 characters, you can use this option to revert to the levels as determined in releases previous to SAS 9. The default is to use the full formatted length of the CLASS variable. The TRUNCATE option is available only as a global option.