Hi Lani,
See here you are assigning the length of the string as 10 to the variable char Amount.
When you apply the comma10.2 to read it in input statement it will take the last two digits as the digits after decimal point.
for example:
data test;
input chars $10.;
cards;
$1,100.100
$1000.0000
$59,000.00
$59.000000
;
run;
data temp;
set test;
newnum=input(chars,dollar10.2);
run;
proc print;
run;
Running the above code will give you the right result. since the length is exactly 10 chars.
If you want to get the desired result on the data which you have provided just use comma10. or dollar10. format and not the decimal part of the formats.
Try following this code:
data test;
input chars $10.;
cards;
$1,100.1
$1000
$59,000
$59
;
run;
data temp;
format newnum 10.2;
set test;
newnum=input(chars,dollar10.);
run;
proc print;
run;
Thanks,
Saurabh.
Message was edited by: emerald85