in my work I have strings that contain only digits. Very long strings up to 32 characters. If I use the function input() to convert from character to numeric, but with strings longer than 16 characters the numeric result is visibly wrong. I include the code explaining the problem, and the printout of the results. Can anyone explain to me where am I wrong?
DATA TEST_INPUT ; INPUT CHAR_TEXT $32. ; DATALINES; 3659218487881310922172417 3662444754643708821993473 ;
RUN ;
DATA TEST_INPUT2 ; SET TEST_INPUT ; FORMAT CHAR_2_NUM 32. ; FORMAT CHAR_2_NUM_16_DIGIT 32. ; FORMAT CHAR_2_NUM_17_DIGIT 32.; CHAR_2_NUM = INPUT(CHAR_TEXT,32.); CHAR_2_NUM_16_DIGIT =INPUT(SUBSTR(CHAR_TEXT,1,16),32.); CHAR_2_NUM_17_DIGIT =INPUT(SUBSTR(CHAR_TEXT,1,17),32.); RUN ;
NUMB_TEXT
CHAR_2_NUM
CHAR_2_NUM_16_DIGIT
CHAR_2_NUM_17_DIGIT
3659218487881310922172417
3659218487881310752735232
3659218487881310
36592184878813112
3662444754643708821993473
3662444754643709451042816
3662444754643708
36624447546437088
... View more