Aggregation
The transformation of record-level data to a higher level of analysis. An exceedingly common task, but one that requires a thorough cheat-sheet documenting the 'gotchas' and tricks.
Contents
Implicit Aggregation
Several procedures compute intermediary variables to produce a report. These intermediary variables can be stored and used.
To count observations by catgegory, use proc freq.
proc freq data=LIBREF.TABLE noprint; tables=VAR / out=LIBREF.OUT; run;
Many higher-level statistics can be retrieved through proc means. For example, to compute VARMEAN and VARMAX from VAR1 for each category of VAR2.
proc means data=LIBREF.TABLE noprint; var VAR1; class VAR2; ways 1; output out=LIBREF.OUT(drop=_FREQ_ _TYPE_) mean=VARMEAN max=VARMAX; run;