The trickiness of the PROC TABULATE

Christian Baghai
1 min readFeb 9, 2021

--

The proc tabulate comes with a difficult syntax. The punctuation respect a tricky logic. Once the logic is acquired mastering this procedure becomes easy.

As often in SAS, everything starts with a DATA =. This indicate which table you want to work on.

Then come the CLASS instruction which indicates the role of the different variables. All of the CLASS variables are used to define groups of observations on which the statistics in the table will be calculated.

Now to the VAR instruction. All VAR variables must be numeric. It is on these variables that the statistics will be calculated.

It is not mandatory to have defined both statements. For example the VAR statement can be dismissed in some cases. But we cannot make PROC TABULATE work without having either the CLASS or VAR instructions.

In the TABLE statement, we will define more precisely the architecture of the table. The output formatting takes place at the TABLE instruction.

In this instruction the punctuation is very important:

• The comma marks the limit between rows and columns.

• The space indicates that we want to lay side by side two elements in the same dimension.

• The star means that we want to nest two elements in the same dimension.

--

--

Christian Baghai
Christian Baghai

No responses yet