Aggregating Data in SAS
Implicit Aggregation
Many procedures create intermediary, higher-level variables.
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;