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

solveplease.PNGanswerthis.PNG

I am looking to transform this table type into the second one type.. (this is just to visualize, so i havent written all the age groups in the second table type) 

1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

Do you need a dataset used by other bits of a program, which has some technical issues with your variable names, or a report that people read?

 

One report might look like:

proc report data=have;
   columns decile agegroup,(rev1 rev2);
   define decile /group;
   define agegroup/across;
run;

I won't say it is impossible to put the rev1 and rev2 at the bottom but that would generally be a poor idea in something that has a lot of rows

View solution in original post

3 REPLIES 3
Jagadishkatam
Amethyst | Level 16

please try transpose

 

proc sort data=have;
by decile age_group;
run;

proc transpose data=have out=want;
by decile ;
id age_group;
var rev1;
run;
Thanks,
Jag
ballardw
Super User

Do you need a dataset used by other bits of a program, which has some technical issues with your variable names, or a report that people read?

 

One report might look like:

proc report data=have;
   columns decile agegroup,(rev1 rev2);
   define decile /group;
   define agegroup/across;
run;

I won't say it is impossible to put the rev1 and rev2 at the bottom but that would generally be a poor idea in something that has a lot of rows

Reeza
Super User
PROC TABULATE.

FYI - you're less likely to get code solutions that actually work if you post data as pictures because it means typing out your data. Posting your data as text is preferable for everyone. And it's faster.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 998 views
  • 0 likes
  • 4 in conversation