O'Reilly logo

Step-by-Step Programming with Base SAS 9.4 by SAS Institute

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Working with Grouped Data

Understanding the Basics of Grouping Data

The basic method for grouping data is to use a BY statement:
BY list-of-variables;
The BY statement can be used in a DATA step with a SET, MERGE, MODIFY, or UPDATE statement, or it can be used in SAS procedures.
To work with grouped data using the SET, MERGE, MODIFY, or UPDATE statements, the data must meet these conditions:
  • The observations must be in a SAS data set, not an external file.
  • The variables that define the groups must appear in the BY statement.
  • All observations in the input data set must be in ascending or descending numeric or character order, or grouped in some way, such as by calendar month or by a formatted value, according to the variables ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required