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.6 Calculating Percentages and Statistics That One Row Contributes to a BY Group

Goal

Calculate percentages that one row contributes to a BY group. Calculate statistics for the BY group, some of which are based on how the row contributes to the statistic for the BY group. Create columns to classify and contain the results of the calculations.

Example Features

Featured StepPROC SQL
Featured Step Options and StatementsAggregate functions

CASE expression

GROUP BY clause

ORDER BY clause
Related TechniquePROC MEANS, CLASS, OUTPUT, and TYPES statements DATA step, match-merging by a value

Input Table

Table DISTRICTLEVY contains levy voting results for four towns and their precincts. Counts of voters voting for the levy are in the "YES" column. ...

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