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?
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.
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.
this worked thank you very much
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;
it is giving me
b=2.27112 c=227112 d=227111 so it did not work but thank you for replying
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.