Hello,
I'm trying to add decimal places for the output shown for proc freq using ODS code. I am interested in the percent of row frequency. I can get the ODS code to work for overall percent but not for the percent of row frequency. I've tried to include row_pct 8.4 but I get an error code that the variable 'ROW_PCT not found in data set WORK.INDTABLE.'
ods trace on;
proc freq data=county;
table gender*abuse / chisq expected;
format gender gender. abuse abuse.;
ods output CrossTabFreqs=IndTable;
run;
proc print data=IndTable label;
format percent 8.4
row_pct 8.4;
run;
Any advice is greatly appreciated, thanks.
Why not use the variable's name? If you remove the LABEL option from the PROC PRINT step you can see the actual variable name. ROWPERCENT
proc format ;
value agegp low - 12 = '<=12' other='>12';
run;
proc freq data=sashelp.class;
table sex*age / chisq expected;
format age agegp.;
ods output CrossTabFreqs=IndTable;
run;
proc print data=IndTable label;
format percent rowpercent colpercent 8.4 ;
run;
Why not use the variable's name? If you remove the LABEL option from the PROC PRINT step you can see the actual variable name. ROWPERCENT
proc format ;
value agegp low - 12 = '<=12' other='>12';
run;
proc freq data=sashelp.class;
table sex*age / chisq expected;
format age agegp.;
ods output CrossTabFreqs=IndTable;
run;
proc print data=IndTable label;
format percent rowpercent colpercent 8.4 ;
run;
That worked great, thank you!
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
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.
Select SAS Training centers are offering in-person courses. View upcoming courses for: