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.5 Calculating Totals across a BY Group to Produce Cumulative and Grand Totals

Goal

Create in one DATA step two data sets that summarize information found in one data set. Create one data set that contains cumulative totals for observations within a BY group. Create another data set that collapses each BY group into a single observation and produces grand totals for variables in each BY group.

Example Features

Featured StepDATA step
Featured Step Options and StatementsBY-group processing Accumulator variables
Related TechniquePROC SQL, GROUP BY clause, CASE expression, MAX and SUM functions

Input Data Set

Data set TECHCERTIF contains certification-eligible events for five technologists.

 TECHCERTIF event_ Obs techid event_date event_type ...

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