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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 1111 views
  • 1 like
  • 3 in conversation