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

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—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
  • 4 replies
  • 1591 views
  • 3 likes
  • 3 in conversation