Differences between revisions 1 and 3 (spanning 2 versions)
Revision 1 as of 2020-05-22 17:15:59
Size: 895
Comment:
Revision 3 as of 2023-01-13 23:50:45
Size: 658
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
= 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.
= Aggregating Data in SAS =
Line 13: Line 11:
Several procedures compute intermediary variables to produce a report. These intermediary variables can be stored and used. Many procedures create intermediary, higher-level variables.

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;


CategoryRicottone

SAS/AggregatingData (last edited 2023-01-13 23:51:26 by DominicRicottone)