BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
wernie
Quartz | Level 8

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

 

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26
data want;
    set have;
    do age_group=1 to 19;
        output;
    end;
run;
--
Paige Miller

View solution in original post

1 REPLY 1
PaigeMiller
Diamond | Level 26
data want;
    set have;
    do age_group=1 to 19;
        output;
    end;
run;
--
Paige Miller

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 304 views
  • 2 likes
  • 2 in conversation