Hi, how do I create a frequency and a percent frequency table with a class width of 5 (i.e. 65.0-69.9) for median income using SAS 9.4
State | Median Income |
Alabama | 76.2 |
Alaska | 98.4 |
Arizona | 79.7 |
Arkansas | 70.9 |
California | 91.2 |
Colorado | 89.3 |
Connecticut | 107.5 |
Delaware | 90.2 |
Florida | 75.5 |
Georgia | 79.7 |
Hawaii | 89.7 |
Idaho | 67.1 |
Illinois | 89.7 |
Indiana | 76.7 |
Iowa | 81.3 |
Kansas | 79.9 |
Kentucky | 76.4 |
Louisiana | 82.6 |
Maine | 77.8 |
Maryland | 108.5 |
Massachusetts | 106.8 |
Michigan | 81 |
Minnesota | 89.9 |
Mississippi | 70.4 |
Missouri | 77 |
Montana | 73.6 |
Nebraska | 78.3 |
Nevada | 75.1 |
New Hampshire | 93.9 |
New Jersey | 110.7 |
New Mexico | 77.6 |
New York | 95.2 |
North Carolina | 76.5 |
North Dakota | 87 |
Ohio | 80.9 |
Oklahoma | 74.5 |
Oregon | 78.7 |
Pennsylvania | 86.8 |
Rhode Island | 94.9 |
South Carolina | 77.1 |
South Dakota | 72 |
Tennessee | 73.4 |
Texas | 82 |
Utah | 75 |
Vermont | 83.1 |
Virginia | 97.2 |
Washington | 91.6 |
West Virginia | 76.8 |
Wisconsin | 82.3 |
Wyoming | 87.9 |
Use custom formats and then PROC FREQ.
proc format;
value inc 60-<65 = '60-64.9' 65-<70='65-69.9' /*etc.*/
;
run;
proc freq data=have;
tables median_income;
format median_income inc.;
run;
Use custom formats and then PROC FREQ.
proc format;
value inc 60-<65 = '60-64.9' 65-<70='65-69.9' /*etc.*/
;
run;
proc freq data=have;
tables median_income;
format median_income inc.;
run;
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.