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

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.

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

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;

 

View solution in original post

2 REPLIES 2
Tom
Super User Tom
Super User

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;

 

UserID437122
Fluorite | Level 6

That worked great, thank you!

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 1681 views
  • 0 likes
  • 2 in conversation