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
;
run![PhotoEditor-20200303130344.jpg PhotoEditor-20200303130344.jpg](https://communities.sas.com/t5/image/serverpage/image-id/36536i0EACF5A19878C791/image-size/large?v=v2&px=999)
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;
Hi @Ronein
The picture seems to be missing. Could you please update your post?
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;
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.
Ready to level-up your skills? Choose your own adventure.