I have a dataset that has many age categories by race and I am interested in combining all age categories in each race in each county to create a "total" variable for each county .
thank you!
I'd like the final data to look like this:
County Race Age _2020
| x | Asi | 15-19 | 65 |
| x | Asi | 20-24 | 34 |
| x | Asi | 25-29 | 45 |
| x | Asi | Total | 144 |
| y | Asi | 15-19 | 16 |
| y | Asi | 20-24 | 9 |
| y | Asi | 25-29 | 13 |
| y | Asi | Total | 38 |
the original data looks like this:
| x | Asi | 15-19 | 65 |
| x | Asi | 20-24 | 34 |
| x | Asi | 25-29 | 45 |
| y | Asi | 15-19 | 16 |
| y | Asi | 20-24 | 9 |
| y | Asi | 25-29 | 13 |
Do you want the final output as a report or table; or do you want the final output to be a SAS data set with the extra rows?
How are you planning to display your table? PROC REPORT/TABULATE/MEANS can do this automatically.
And is it created from a summary procedure initially? If so, you can likely
@epi_user wrote:
I have a dataset that has many age categories by race and I am interested in combining all age categories in each race in each county to create a "total" variable for each county .
thank you!
I'd like the final data to look like this:
County Race Age _2020
x Asi 15-19 65 x Asi 20-24 34 x Asi 25-29 45 x Asi Total 144 y Asi 15-19 16 y Asi 20-24 9 y Asi 25-29 13 y Asi Total 38
the original data looks like this:
County Race Age _2020
x Asi 15-19 65 x Asi 20-24 34 x Asi 25-29 45 y Asi 15-19 16 y Asi 20-24 9 y Asi 25-29 13
add in the total calculation to that step.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.