SAS Software for Learning Community

Welcome to the exclusive online community for all SAS learners.
BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
_maldini_
Barite | Level 11

Can you designate which statistics to output into a new dataset using PROC FREQ? 

proc freq data=go_long ;
    tables exam*htn / nocol nopercent out=htn_plot;
run;

The above syntax produces the correct table, which has counts and row percentages for each value of exam: 

Screenshot 2024-06-04 at 1.39.24 PM.png

But the output dataset does not contain the row percentages, which is what I want (it looks like it contains total percent).

proc print data=htn_plot; where htn=1; run;

Screenshot 2024-06-04 at 1.39.53 PM.png

Is there a way I can specify which stats (i.e., counts and row percentages) to output using PROC FREQ?

 

Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

Add the OUTPCT option. 


See the list of options in Table 9 in the documentation:

https://documentation.sas.com/doc/en/pgmsascdc/v_051/statug/statug_freq_syntax08.htm

 


@_maldini_ wrote:

Can you designate which statistics to output into a new dataset using PROC FREQ? 

proc freq data=go_long ;
    tables exam*htn / nocol nopercent out=htn_plot;
run;

The above syntax produces the correct table, which has counts and row percentages for each value of exam: 

Screenshot 2024-06-04 at 1.39.24 PM.png

But the output dataset does not contain the row percentages, which is what I want (it looks like it contains total percent).

proc print data=htn_plot; where htn=1; run;

Screenshot 2024-06-04 at 1.39.53 PM.png

Is there a way I can specify which stats (i.e., counts and row percentages) to output using PROC FREQ?

 

Thanks.


 

 

View solution in original post

1 REPLY 1
Reeza
Super User

Add the OUTPCT option. 


See the list of options in Table 9 in the documentation:

https://documentation.sas.com/doc/en/pgmsascdc/v_051/statug/statug_freq_syntax08.htm

 


@_maldini_ wrote:

Can you designate which statistics to output into a new dataset using PROC FREQ? 

proc freq data=go_long ;
    tables exam*htn / nocol nopercent out=htn_plot;
run;

The above syntax produces the correct table, which has counts and row percentages for each value of exam: 

Screenshot 2024-06-04 at 1.39.24 PM.png

But the output dataset does not contain the row percentages, which is what I want (it looks like it contains total percent).

proc print data=htn_plot; where htn=1; run;

Screenshot 2024-06-04 at 1.39.53 PM.png

Is there a way I can specify which stats (i.e., counts and row percentages) to output using PROC FREQ?

 

Thanks.


 

 

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

Register now!

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 1 reply
  • 1516 views
  • 1 like
  • 2 in conversation