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

Hello

I want to change the structure of the summary table

I want to create a summary table that will have following structure as you can see in the photo

Data SummaryInfo;
input YYMM $ Z1 $ z2 $ Y;
cards;
1901 a G1 10
1901 a G2 20
1901 b G1 30
1901 b G2 40
1901 c G1 50
1901 c G2 60
1901 d G1 70
1901 d G2 80
1902 a G1 15
1902 a G2 25
1902 b G1 35
1902 b G2 45
1902 c G1 55
1902 c G2 65
1902 d G1 75
1902 d G2 85
;
runPhotoEditor-20200303130344.jpg
1 ACCEPTED SOLUTION

Accepted Solutions
Ronein
Meteorite | Level 14
Data SummaryInfo;
input YYMM $ Z1 $ z2 $ Y;
cards;
1901 a G1 10
1901 a G2 20
1901 b G1 30
1901 b G2 40
1901 c G1 50
1901 c G2 60
1901 d G1 70
1901 d G2 80
1902 a G1 15
1902 a G2 25
1902 b G1 35
1902 b G2 45
1902 c G1 55
1902 c G2 65
1902 d G1 75
1902 d G2 85
;
run;
proc sort data=SummaryInfo;by Z1  Z2;run;
proc transpose data=SummaryInfo out=wide1(drop=_name_) prefix=_;
    by Z1  Z2;
    id YYMM;
    var Y;
run;

View solution in original post

3 REPLIES 3
ed_sas_member
Meteorite | Level 14

Hi @Ronein 

The picture seems to be missing. Could you please update your post?

Ronein
Meteorite | Level 14

20200303_131326.jpg

Ronein
Meteorite | Level 14
Data SummaryInfo;
input YYMM $ Z1 $ z2 $ Y;
cards;
1901 a G1 10
1901 a G2 20
1901 b G1 30
1901 b G2 40
1901 c G1 50
1901 c G2 60
1901 d G1 70
1901 d G2 80
1902 a G1 15
1902 a G2 25
1902 b G1 35
1902 b G2 45
1902 c G1 55
1902 c G2 65
1902 d G1 75
1902 d G2 85
;
run;
proc sort data=SummaryInfo;by Z1  Z2;run;
proc transpose data=SummaryInfo out=wide1(drop=_name_) prefix=_;
    by Z1  Z2;
    id YYMM;
    var Y;
run;

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 582 views
  • 0 likes
  • 2 in conversation