DATA Step, Macro, Functions and more

Rounding issue.

Occasional Contributor
Posts: 7

Rounding issue.

Hi Guys, 


I am facing issue with rounding issue. In my SAS program, we need to calculate each store perfomance in percenage based on sales, commissoin etc. 


this calcuated performace percentage is sent to another system which will post to portal. But the another system is rejecting it because sum of all performace percentage is exceeding 100% (i.e. 100.02). I believe this is due to rounding. 


can anyone please suggesst how I can resolve this rounding issue. 


I used ROUND(PERCENT,0.01) and also defined percentage variable as 16.2 (format PVAR 16.2 Smiley Wink


thank you for your help in advance. 

Super User
Posts: 13,583

Re: Rounding issue.

Please show how you are generating the data sent to "other system". To force a total of percentages is going to take a little more work than rounding a variable as you may round down or up to many times and end up with less than 100 or more than 100.

So will need to do something that checks the total of the percentages. Note that the report procedures may not be adequate.

There are also some potential issues with storage precision on both ends of the process in that some decimal values don't quite have exact binary storage.

Esteemed Advisor
Posts: 5,541

Re: Rounding issue.

Calculate your summaries (sums, etc.) at full precision.Round only at the end, for display purposes.

Ask a Question
Discussion stats
  • 2 replies
  • 1 like
  • 3 in conversation