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;
For more details on the FREQ procedure, see here.
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;
For more details on the MEANS procedure, see here.