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
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;
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.