O'Reilly logo

Combining and Modifying SAS® Data Sets: Examples Second Edition by Michele M. Burlew

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

Understanding the Tools for Processing Information in Groups

Processing BY Groups in the DATA Step

When combining SAS data sets in a DATA step, it is often convenient or necessary to process observations in BY groups (that is, groups of observations that have the same value for one or more selected variables). Many examples in this book use BY-group processing with one or more SAS data sets to create a new data set.

The BY statement identifies one or more BY variables. When using the BY statement with the SET, MERGE, or UPDATE statement, your data must be sorted or indexed on the BY variable or variables.

In a DATA step, SAS identifies the beginning and end of each BY group by creating two temporary variables for each BY variable: FIRST.

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