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!

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 490 views
  • 0 likes
  • 2 in conversation