Differences between revisions 1 and 4 (spanning 3 versions)
Revision 1 as of 2020-05-22 17:15:59
Size: 895
Comment:
Revision 4 as of 2023-01-13 23:51:26
Size: 795
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.
Line 15: Line 13:
To count observations by catgegory, use `proc freq`. To count observations by catgegory, use `PROC FREQ`.
Line 23: Line 21:
Many higher-level statistics can be retrieved through `proc means`. For example, to compute `VARMEAN` and `VARMAX` from `VAR1` for each category of `VAR2`. For more details on the `FREQ` procedure, see [[SAS/Freq|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`.
Line 34: Line 34:
For more details on the `MEANS` procedure, see [[SAS/Freq|here]].

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.


CategoryRicottone

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