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!
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.