Percentage Subtotals on Both Dimensions

This example is included more as an academic exercise than as something that you would want to use in the real world. If you end up building a table this complicated and you plan to add percentages, then you probably want to rethink your table design. However, the table is a good example of how to figure out complex denominator definitions.
The following code produces our sample table. It shows country broken down by gender versus customer type broken down by size. There are subtotals and totals along both dimensions. The code here creates the basic table without percentages, so that you can see how it works:
PROC TABULATE DATA=TEMP; CLASS GENDER CTRY CUSTTYPE SIZE; TABLE CTRY*(GENDER ALL) ALL, (CUSTTYPE*(SIZE ...

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.