Calculate Percentages Another Way

Sometimes PROC TABULATE gives you more output than you need. For example, if you are trying to produce a table that shows what percentage of your population is female, you can easily get that number by calculating the PCTN statistic for your gender variable. However, this not only gives you the percentage of females, but it also gives you the percentage of males.
The following code produces a table that shows the N and PCTN for females (as well as the N and PCTN for males):
PROC TABULATE DATA=TEMP F=8.;
   CLASS CTRY GENDER;
   TABLE GENDER=' '*(N PCTN<GENDER>*F=8.1) ALL*N,
      CTRY / ROW=FLOAT;
RUN;
In Output 14.6, you can see that much of the table is redundant. If the population is 53.6% female, then it follows that ...

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.