Hello,
I am trying to read in the '000010000' string to a numeric value of 1.0 (5 digit number and 4 decimals) but the syntax below would return the value of 0.1 instead.
Value=Input('000010000', 5.4);
Put Value=;
Log:
Value=0.1;
Does someone know how to convert the value properly?
Any help would be greatly appreciated.
Thanks,
Daniel
I believe the width needs to be the length of the string otherwise you lose the needed zeros.
Try:
data t;
Value=Input('000012000', 9.4);
Put Value=;
run;
Should get 1.2
Hope this helps!
EJ
I believe the width needs to be the length of the string otherwise you lose the needed zeros.
Try:
data t;
Value=Input('000012000', 9.4);
Put Value=;
run;
Should get 1.2
Hope this helps!
EJ
Thanks! the issue has been resolved.
Using the same reasoning, the results of your original test should have been 0.0001, not 0.1.
The "4" in "9.4" (or in "5.4") is actually tricky. It means, "Inspect the incoming string to see if it contains a decimal point. If it does, use it. But if there is no existing decimal point, assume that the last 4 digits read should fall after the decimal point."
Good luck.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.