Help using Base SAS procedures

Proc freq with colpercent but without percent

Reply
Occasional Contributor
Posts: 16

Proc freq with colpercent but without percent

Hello,

I have a very simple question, is it possible to use proc freq (for crosstabulation) in a way, that it has included ONLY colpercent and totalpercent in the output? I mean, without overall percent in the cells. Because if I use nopercent option it removes also totalpercent in total rows and columns(image2), but if I include percent, then in every cell I have two numbers - colpercent and percent(image1). I basically want to have only one number in cells - colpercent and total percent in totals(something like image3, total rows are not important, but the total column is). Is it possible with proc freq? Or should I use proc tabulate ?

Thanks Smiley Happy


output2.jpgoutput1.jpgoutput3.jpg
Super User
Posts: 19,814

Re: Proc freq with colpercent but without percent

Use the NOROW option in Proc freq to suppress the row percents.

Occasional Contributor
Posts: 16

Re: Proc freq with colpercent but without percent

I actually use that option.. these additional percents are not row percents, they are percentages of the total sum. I can remove them only by nopercent option, but then I lose totals. So it seems impossible to set as I want. But I guess I will have to explore that proc tabulate so I can solve all the problems with unflexible proc freq.

SAS Super FREQ
Posts: 8,866

Re: Proc freq with colpercent but without percent


Hi:

   I recommend PROC TABULATE if you want a crosstabular report, but want to have only percents and not cum percents and not totals. Here's an example using SASHELP.HEART.

Cynthia

ods html file='c:\temp\colpercent.html';

proc tabulate data=sashelp.heart;
  class chol_status sex;
  table chol_status all,
        all*colpctn sex*colpctn;
  keylabel all='Total'
           colpctn = 'Col Pct';
  keyword all / style={vjust=b};
run;
ods html close;

Occasional Contributor
Posts: 16

Re: Proc freq with colpercent but without percent

Posted in reply to Cynthia_sas

Thanks, it looks like it offers much more customization than proc freq, I will start using it more.

Ask a Question
Discussion stats
  • 4 replies
  • 226 views
  • 3 likes
  • 3 in conversation