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.11 Expanding Single Observations into Multiple Observations

Goal

Reshape data by creating multiple observations from a single observation in the input data set and by assigning variable names as values in the output data set.

Example Features

Featured StepDATA step
Featured Step Options and StatementsOUTPUT statement VNAME variable information call routine
Related TechniquePROC TRANSPOSE, NAME= option, BY statement

Input Data Set

Data set CUSTRESP contains survey results for 25 customers on the number of visits to three sites that resulted in sales.

                    CUSTRESP

    Obs    customer    website    store    event 1 1 0 1 1 2 2 0 8 . 3 3 0 4 0 4 4 10 3 2 5 5 1 . 0 6 6 3 0 0 7 7 0 6 1 8 8 0 2 3 9 9 0 1 0 10 10 0 4 0 11 11 6 4 1 12 12 4 4 2 13 13 9 3 5 14 ...

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