Posts

Showing posts with the label Numeric to character conversion

Convert values from character to numeric or from numeric to character.

Image
Convert values from character to numeric or from numeric to character\Convert variable values using either the INPUT or PUT function. Convert a character value to a numeric value by using the INPUT function. Specify a numeric informat that best describes how to Read the data value into the numeric variable. When changing types a new variable name is required. If you need to keep the original variable name for the new type, use the RENAME = option as illustrated in Sample 2. data char; input string : $8. date : $6.; numeric= input (string, 8.); sasdate= input (date, mmddyy6.); format sasdate mmddyy10.; datalines ; 1234.56 031704 3920 123104; proc print; run ; data now_num; input num date: mmddyy6.; datalines ; 123456 110204 1000 120504;   run; data now_char ; set now_num (rename=(num=oldnum date=olddate)); num = put (oldnum,6. -L); date = put ( olddate , date9 .); run ; proc print ; run ; Source: support.sas.com Here ...