BookmarkSubscribeRSS Feed
lhatbrn
Calcite | Level 5
Is there any way to force Proc Freq to round in such a way that percentages always sum to 100? I have been getting a lot of sums of 99.9 or even as low as 99.7, and that just looks bad on a report.
2 REPLIES 2
DanielSantos
Barite | Level 11
Could this be related to the famous numeric precision question?

http://support.sas.com/techsup/technote/ts654.pdf
http://support.sas.com/documentation/cdl/en/lrcon/61722/HTML/default/a000695157.htm
http://support.sas.com/techsup/technote/ts230.html

The simplest way (and I'm sure you've already though of that) would be to round the sum to the nearest integer.

Cheers from Portugal

Daniel Santos @ www.cgd.pt
Patrick
Opal | Level 21
If you give it a bit of thought: It's actually correct that the detail numbers are not always summing up to 100% (the total line though will be 100%).

Let's say you have 4 detail percentages where the exact values are:
24.44,24.44,24.44,26.68

You want now these values listed with only one decimal. You would most likely use arithmetic rounding:
24.4,24.4,24.4,26.7

And well: This doesn't sum up to 100%. But where would you "cheat" and use another rounding algorithm?

I used to have a boss who never understood this. It was a pain!
Best you can do is add a footnote where you explain why the detail numbers might not add up to 100%.

HTH
Patrick

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 2 replies
  • 1345 views
  • 0 likes
  • 3 in conversation