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 5.3 Computing Summary Data and Combining Them with Detail Data

Goal

Summarize several variables in a data set. Add these summarizations to each observation in a data set. Compute new variables by combining summary and detail variables.

Example Features

Featured StepDATA step
Featured Step Options and StatementsMultiple SET statements SET statement with END= option IF _N_=1 statement DO UNTIL loop
Related TechniquePROC SQL, remerging summary statistics
A Closer LookSelecting a Method to Combine Summary and Detail Data

Input Data Set

Data set SESSIONS contains the number of attendees from four groups at each of three training sessions.

                      SESSIONS Data Set

  Obs    session    group_a    group_b    group_c    group_d 1 March 8 29 29 34 2 June 19 3 27 8 3 ...

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