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

Example 8.9 Adding Observations to a SAS Data Set So the Values of a Variable Are Consecutive throughout the BY Group

Goal

Add observations to a data set to fill out each BY group so that the value of a specified variable consistently increments for every observation in the BY group.

Example 8.10 is similar to Example 8.9 except that the data are more complex in Example 8.10 and require different programming steps.

The example uses the same input data set as Example 8.12.

Example Features

Featured StepDATA step
Featured Step Options and StatementsBY-group processing, FIRST.variable and LAST.variable temporary variables, RETAIN statement
Related TechniquePROC MEANS, COMPLETETYPES, NOPRINT and NWAY options, ID and OUTPUT statements
A Closer Look ...

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