Skip to Main Content
PROC TABULATE by Example, Second Edition
book

PROC TABULATE by Example, Second Edition

by Lauren Haworth Lake, Julie McKnight
May 2015
Intermediate to advanced content levelIntermediate to advanced
348 pages
11h 31m
English
SAS Institute
Content preview from PROC TABULATE by Example, Second Edition

Add Statistics to the Nested Variables

Overview

The previous examples showed how to add multiple class variables to your two-dimensional table. But often you want to add multiple statistics as well. So far, we have looked at means, but the tables would be more helpful if we could also see the number of observations for each subgroup. If there are only a few observations in some of the table cells, then the mean statistic becomes less useful.

Add the Statistics

The following code produces a table with the number of observations next to every mean. This is accomplished by using parentheses around the two statistics keywords N and MEAN.
PROC TABULATE DATA=TEMP;
   VAR INCOME;
   CLASS EDUC FULLTIME GENDER;
   TABLE EDUC*GENDER*(N MEAN), INCOME*FULLTIME; ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

SAS 9.4 Language Reference, 6th Edition

SAS 9.4 Language Reference, 6th Edition

SAS Institute

Publisher Resources

ISBN: 9781607649908