BookmarkSubscribeRSS Feed
gabon
Calcite | Level 5

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
4 REPLIES 4
Reeza
Super User

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

gabon
Calcite | Level 5

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.

Cynthia_sas
Diamond | Level 26


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;

gabon
Calcite | Level 5

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

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

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 4 replies
  • 2007 views
  • 3 likes
  • 3 in conversation