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.
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: