HI,
I have a value x=0.032949.
if x >= 0.0001 then y=put(round(x,0.0001),7.4);
I am getting x=0.017.
Where as I should be getting 0.0329.
Why is this happening?
How do I fix this?
Thanks,
Archana
Post your full code and the log.
I suspect something is going on with your y variable as I can't reproduce your error with this program:
data junk;
x=0.032949;
if x >= 0.0001 then y=put(round(x,0.0001),7.4);
run;
I get the expected value.
And your reason for not using y=put(x,7.4); is exactly what?
SAS version? OS?
I couldn't repeat your issue.
23 data _null_ ;
24 x=0.032949;
25 y=put(round(x,0.0001),7.4);
26 put y=;
27 run;
y=0.0329
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
Following syntax is giving right numbers. Look for Y variable instead of X for rounded numbers
data _null_;
x=0.032949;
if x >= 0.0001 then y=put(round(x,0.0001),7.4);
put _all_;
run;
Post your full code and the log.
I suspect something is going on with your y variable as I can't reproduce your error with this program:
data junk;
x=0.032949;
if x >= 0.0001 then y=put(round(x,0.0001),7.4);
run;
I get the expected value.
And your reason for not using y=put(x,7.4); is exactly what?
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.