BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
IGD
Calcite | Level 5 IGD
Calcite | Level 5

Hi everyone,

I cannot make sense of this output.

 

c=(abs(-2.271120)*100000);
d=floor(c);

 

output:

c=227112

d=227111

 

I expected to see d=227112 why i am getting this result?

 

1 ACCEPTED SOLUTION

Accepted Solutions
FreelanceReinh
Jade | Level 19

Hi @IGD and welcome to the SAS Support Communities!

 

Use the ROUND function to avoid the issue

c=round(abs(-2.271120)*100000,1e-8);

and see the 2015 thread ceil function bug? for explanations.

View solution in original post

4 REPLIES 4
FreelanceReinh
Jade | Level 19

Hi @IGD and welcome to the SAS Support Communities!

 

Use the ROUND function to avoid the issue

c=round(abs(-2.271120)*100000,1e-8);

and see the 2015 thread ceil function bug? for explanations.

IGD
Calcite | Level 5 IGD
Calcite | Level 5

this worked thank you very much

acordes
Rhodochrosite | Level 12

I suppose it has to do with the floating points. 

Try 

data _null_;

format b c d best12.;

b=abs(-2.271120);

c=(abs(-2.271120)*100000);
d=floor(c);

put b= c= d= ;

run;

 

IGD
Calcite | Level 5 IGD
Calcite | Level 5

it is giving me

b=2.27112 c=227112 d=227111 so it did not work but thank you for replying

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 4 replies
  • 1461 views
  • 3 likes
  • 3 in conversation