SAS Programming

DATA Step, Macro, Functions and more
BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
dht115
Calcite | Level 5

Hello, 

 

I do have following equation in excel. 

=ROUND(((SUM(O206+Q206+S206+U206+W206+Y206+AA206+AC206+AE206+AG206+AI206+AK206)-BK206)/11),0)

 

Here, Column "O" to Column "AK206" are my dmd data

Column "BK" is my maxtwelve

 

I use following equation in sas. 

round = round((sum(of Dmd1-Dmd12)-maxtwelve)/11);

In some incident, I am not getting same result. 

For example if Excel produce -66.45454545, Excel Output is -66. Whereas SAS output is -67. 

 

If I use 

int = int((sum(of Dmd1-Dmd12)-maxtwelve)/11);

In some incident, I am not getting same result. 

For example if Excel produce -463.5454545, Excel Output is -464. Whereas SAS output is -463. 

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

Did you check how both system handle rounding of negative numbers?

You could make you own test data to see.

 

If that does not provide an answer than check the individual pieces.  If you are adding enough numbers the sum of small differences in each could result in values to slip from one side of the up/down dividing line for rounding.

View solution in original post

1 REPLY 1
Tom
Super User Tom
Super User

Did you check how both system handle rounding of negative numbers?

You could make you own test data to see.

 

If that does not provide an answer than check the individual pieces.  If you are adding enough numbers the sum of small differences in each could result in values to slip from one side of the up/down dividing line for rounding.

sas-innovate-white.png

Join us for our biggest event of the year!

Four days of inspiring keynotes, product reveals, hands-on learning opportunities, deep-dive demos, and peer-led breakouts. Don't miss out, May 6-9, in Orlando, Florida.

 

View the full agenda.

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
  • 1 reply
  • 569 views
  • 0 likes
  • 2 in conversation