Group Processing Using the BY Statement

Like the CLASS statement, the BY statement specifies variables to use for categorizing observations.
Syntax, BY statement:
BY variable(s);
variable(s) specifies category variables for group processing.
But BY and CLASS differ in two key ways:
  • Unlike CLASS processing, BY-group processing requires that your data already be sorted or indexed in the order of the BY variables. Unless data set observations are already sorted, you must run the SORT procedure before using PROC MEANS with any BY group.
    CAUTION:
    If you do not specify an output data set by using the OUT= option, PROC SORT overwrites the initial data set with newly sorted observations.
  • The layout of BY-group results differs ...

Get SAS Certification Prep Guide, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.