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 Step | PROC SQL |
Featured Step Options and Statements | Aggregate functions
CASE expression GROUP BY clause ORDER BY clause |
Related Technique | PROC 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. ...
Get Combining and Modifying SAS® Data Sets: Examples Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.