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-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
  • 3 replies
  • 358 views
  • 0 likes
  • 2 in conversation