BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
RobertWF1
Quartz | Level 8

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?

 

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

I'd probably recommend PROC TABULATE. More control over what is displayed in that procedure. 

View solution in original post

2 REPLIES 2
Reeza
Super User

I'd probably recommend PROC TABULATE. More control over what is displayed in that procedure. 

RobertWF1
Quartz | Level 8
Yes the following worked, thanks Reeza:

proc tabulate data=test;
class gender class;
table gender,class*(n='N'*F=6.0 colpctn='%'*F=6.2);
run;
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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 1057 views
  • 3 likes
  • 2 in conversation