Comparison to Using a BY Statement
There is another way
to create a three-dimensional table. Like many SAS procedures, PROC
TABULATE supports the BY statement. You can use this to repeat a table
for each value of the BY variable.
For example, the similar
tables can be built by using a three-dimensional TABLE statement or
by a two-dimensional TABLE statement and a BY variable.
The following code takes
the first approach. It uses a three-dimensional TABLE statement and
produces Output 6.3. Reading the TABLE statement
from right to left, it calls for columns showing the class variables
GENDER and ALL and a single row showing MEAN income, and it is repeated
for each value of CTRY.
PROC TABULATE DATA=TEMP; CLASS CTRY GENDER; VAR INCOME; TABLE CTRY, ...
Get PROC TABULATE by Example, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.