CLASS Statement

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

The CLASS statement names the classification variables for the analysis. Most options can be specified either as individual variable options or as global options. You can specify options for each variable by enclosing the options in parentheses after the variable name. You can also specify global options for the CLASS statement by placing the options after a slash (/). Global options are applied to every variable that is specified without an option in the CLASS statement. However, individual CLASS variable options override the global options. You can specify the following options either as global options or as individual options:


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


specifies the sort order for the levels of classification variables.

The following table shows how PROC SURVEYIMPUTE interprets values of the ORDER= option:

Value of ORDER=

Levels Sorted By


Order of appearance in the input data set


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


Descending frequency count; levels with more observations come earlier in the order


Unformatted value

By default, ORDER=FORMATTED. For ORDER=FORMATTED and ORDER=INTERNAL, the sort order is machine-dependent. When ORDER=FORMATTED is in effect for numeric variables for which you have supplied no explicit format, the levels are ordered by their internal values. For ORDER=FREQ, the frequency counts are unweighted. For more information about 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.


specifies the length n of CLASS variable values to use in determining CLASS variable levels. The default is to use the full formatted length of the CLASS variable. If you specify the TRUNCATE option 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 before SAS 9. The TRUNCATE option is available only as a global option.