For example, running proc freq on the following data:
data test;
input class :$9. gender :$1.;
cards;
Treatment M
Treatment M
Treatment F
Treatment F
Control M
Control M
Control F
Control F
Control F
Control F
;
run;
proc freq data=test;
table gender*class / nopercent norow out=freq_gender;
run;
I'd like to produce the following table with nested header:
Control | Treatment | |||
Gender | Frequency | Col Pct | Frequency | Col Pct |
Female | 4 | 66.67 | 2 | 50.00 |
Male | 2 | 33.33 | 2 | 50.00 |
Is that possible in proc freq or do I need to use other procedures?
I'd probably recommend PROC TABULATE. More control over what is displayed in that procedure.
I'd probably recommend PROC TABULATE. More control over what is displayed in that procedure.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.