Previous Page | Next Page

Creating Summary Tables with the TABULATE Procedure

Review of SAS Tools


Global Statement

TITLE<n> <'title'>;

specifies a title. The argument n is a number from 1 to 10 that immediately follows the word TITLE, with no intervening blank, and specifies the level of the TITLE. The text of each title can be up to 132 characters long (256 characters long in some operating environments) and must be enclosed in single or double quotation marks.


TABULATE Procedure Statements

PROC TABULATE <option(s)>;
CLASS variable(s)</option(s)>;
VAR analysis-variable(s);
TABLE <<page-expression,> row-expression,> column-expression;

PROC TABULATE <option(s)>;

starts the procedure.

You can specify the following options in the PROC TABULATE statement:

DATA=SAS-data-set

specifies the SAS-data-set to be used by PROC TABULATE. If you omit the DATA= option, then the TABULATE procedure uses the SAS data set that was created most recently in the current job or session.

FORMAT=format-name

specifies a default format for formatting the value in each cell in the table. You can specify any valid SAS numeric format or user-defined format.

MISSING

considers missing values as valid values to create the combinations of class variables. A heading for each missing value appears in the table.

ORDER=DATA | FORMATTED | FREQ | UNFORMATTED

specifies the sort order that is used to create the unique combinations of the values of the class variables, which form the headings of the table. A brief description of each sort order follows:

DATA

orders values according to their order in the input data set.

FORMATTED

orders values by their ascending formatted values. This order depends on your operating environment.

FREQ

orders values by descending frequency count.

UNFORMATTED

orders values by their unformatted values, which yields the same order as PROC SORT. This order depends on your operating environment. This sort sequence is particularly useful for displaying dates chronologically.

ORDER= used on a CLASS statement overrides ORDER= used on the PROC TABULATE statement.
CLASS variable(s)/option(s);

identifies class variables for the table. Class variables determine the categories that PROC TABULATE uses to calculate statistics.

MISSING

considers missing values as valid values to create the combinations of class variables. A heading for each missing value appears in the table. If MISSING should apply only to a subset of the class variables, then specify MISSING in a separate CLASS statement with the subset of the class variables.

ORDER=DATA | FORMATTED | FREQ | UNFORMATTED

specifies the sort order used to create the unique combinations of the values of the class variables, which form the headings of the table. If ORDER= should apply only to a subset of the class variables, then specify ORDER= in a separate CLASS statement with the subset of the class variables. In this way, a separate sort order can be specified for each class variable. A brief description of each sort order follows:

DATA

orders values according to their order in the input data set.

FORMATTED

orders values by their ascending formatted values. This order depends on your operating environment.

FREQ

orders values by descending frequency count.

UNFORMATTED

orders values by their unformatted values, which yields the same order as PROC SORT. This order depends on your operating environment. This sort sequence is particularly useful for displaying dates chronologically.

ORDER= used on a CLASS statement overrides ORDER= used on the PROC TABULATE statement.
VAR analysis-variable(s);

identifies analysis variables for the table. Analysis variables contain values for which you want to compute statistics.

TABLE <<page-expression, >row-expression,> column-expression;

defines the table that you want PROC TABULATE to produce. You must specify at least one TABLE statement. In the TABLE statement you specify page-expressions, row-expressions, and column-expressions, all of which are constructed in the same way and are referred to collectively as dimension expressions. Use commas to separate dimension expressions from one another. You define relationships among variables, statistics, and other elements within a dimension by combining them with one or more operators. Operators are symbols that tell PROC TABULATE what actions to perform on the variables, statistics, and other elements. The table that follows lists the common operators and the actions that they symbolize:

Operator Action
, comma separates dimensions of the table
* asterisk crosses elements within a dimension
blank space concatenates elements within a dimension
= equal overrides default cell format or assigns label to an element
( ) parentheses groups elements and associates an operator with each concatenated element in the group
[ ] square brackets groups the STYLE= option for crossing, and groups style attribute specifications within the STYLE= option
{ } braces groups the STYLE= option for crossing, and groups style attribute specifications within the STYLE= option

Previous Page | Next Page | Top of Page