data diff;
a=2985014.3137841 ;
b=2985014.3137841;
dif=a-b;
run;
proc print noobs;run;
SAS Output
| The SAS System |
| a | b | dif |
|---|---|---|
| 2985014.31 | 2985014.31 | 0 |
The two number are not equal, they are just displayed as equal. A -4E-10 difference is not visible when you display only 7 decimals. See @novinosrin's demonstration above.
Why do you expect the difference to be zero?
@teja04 wrote:
I am not supposed to use ROUND function.
Don't be an idiot. The tool for removing such artifacts of SAS numerical precision issues is the round() function, so use it. See Maxim 14.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
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!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.