06-05-2018 07:24 AM
No, it's not possible. Numbers do not contain a set of characters in SAS. Numbers store a numeric value, not the form in which it is expressed. You can always add a FORMAT statement later, when printing the numeric variable.
Just for the record, your INPUT functions are treading on dangerous ground. You would be safer using:
To see why, try this (and read the documentation):
06-05-2018 07:42 AM
I want 100.10 as a value of variable e. is it possible without using any format ?
SAS data step being turing-complete, it is of course possible. See here:
data test; have = '100.10'; want = 0; fr_count = .; do i = 1 to length(have); if substr(have,i,1) = '.' then fr_count = 0; else do; want = want * 10 + rank(substr(have,i,1)) - 48; if fr_count ne . then fr_count + 1; end; end; if fr_count ne . then want = want / 10 ** fr_count; run;
Note that I did this because sometimes I have enough time at hand to waste on stupid ideas