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;
Available on demand!
Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.
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.