@sbxkoenk wrote:
Hello,
All three conversions below end up with 5 decimals.
Not sure why it "stops" at 5 decimals.
data test;
format CharVar $50. /* value_num1 value_num2 20.14 */;
CharVar="7663229328,8184132475796";
Value_num1 = input(tranwrd(CharVar,",","."), best32.); put Value_num1= 32.15;
Value_num2 = tranwrd(CharVar,",",".")*1; put Value_num2= 32.15;
Value_num3 = input(CharVar,commax32.); put Value_num3= 32.15;
run;
/* end of program */
Will investigate further tomorrow.
Koen
Simple, too many significant digits. Lots of precision discussions on this and other forums. You get about 15 significant digits in a Windows environment.
Move the comma and you get more decimals as the significant digits in the integer portion are fewer and allow more in the decimal (though still not 15 depending on where you place the decimal/comma in the original string).
11 data test;
12 format CharVar $50. /* value_num1 value_num2 20.14 */;
13 CharVar="76632,293288184132475796";
14 Value_num1 = input(tranwrd(CharVar,",","."), best32.); put Value_num1= 32.15;
15 Value_num2 = tranwrd(CharVar,",",".")*1; put Value_num2= 32.15;
16 Value_num3 = input(CharVar,commax32.); put Value_num3= 32.15;
17 run;
NOTE: Character values have been converted to numeric values at the places given by:
(Line):(Column).
15:18
Value_num1=76632.293288184100000
Value_num2=76632.293288184100000
Value_num3=76632.293288184100000
Count the digits in the about output, when you get to 15 everything after the "841" is 0.
... View more