BookmarkSubscribeRSS Feed
gskn
Obsidian | Level 7

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 😉

 

thank you for your help in advance. 

2 REPLIES 2
ballardw
Super User

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.

PGStats
Opal | Level 21

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

PG

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

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
  • 1379 views
  • 1 like
  • 3 in conversation