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 ...
Get Step-by-Step Programming with Base SAS 9.4 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.