New Contributor
Posts: 3

# Percentages in Proc Freq do not sum to 100

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.
Super Contributor
Posts: 474

## Re: Percentages in Proc Freq do not sum to 100

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
Posts: 4,736

## Re: Percentages in Proc Freq do not sum to 100

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