I have a dataset that has info for different census tracts. It does not currently have any age group information, so I want to expand to include 19 age groups (meaning each census tract row that I currently have would be replicated to have info for all 19 age groups). I'm not sure how to go about doing this.
Thank you!
I currently have something that looks like this:
GEO_ID State Tract
12001000200 12 000200
12001000300 12 000300
12001000400 12 000400
And I want to get it to look like this:
GEO_ID State Tract Age_Group
12001000200 12 000200 1
12001000200 12 000200 2
12001000200 12 000200 3
12001000200 12 000200 4
12001000200 12 000200 5
12001000200 12 000200 6
12001000200 12 000200 7
12001000200 12 000200 8
12001000200 12 000200 9
12001000200 12 000200 10
12001000200 12 000200 11
12001000200 12 000200 12
12001000200 12 000200 13
12001000200 12 000200 14
12001000200 12 000200 15
12001000200 12 000200 16
12001000200 12 000200 17
12001000200 12 000200 18
12001000200 12 000200 19
12001000300 12 000300 1
12001000300 12 000300 2
12001000300 12 000300 3
12001000300 12 000300 4
12001000300 12 000300 5
12001000300 12 000300 6
12001000300 12 000300 7
12001000300 12 000300 8
12001000300 12 000300 9
12001000300 12 000300 10
12001000300 12 000300 11
12001000300 12 000300 12
12001000300 12 000300 13
12001000300 12 000300 14
12001000300 12 000300 15
12001000300 12 000300 16
12001000300 12 000300 17
12001000300 12 000300 18
12001000300 12 000300 19
data want;
set have;
do age_group=1 to 19;
output;
end;
run;
data want;
set have;
do age_group=1 to 19;
output;
end;
run;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.