SAS Proc SQL how to convert from Number to Character
25,253
You're close - you just need a numeric format, eg:
proc sql;
select put(A.column,11.) as new_column
from table A;
(You also needed a closing semicolon)
See documentation: https://documentation.sas.com/?docsetId=lefunctionsref&docsetTarget=n0mlfb88dkhbmun1x08qbh5xbs7e.htm&docsetVersion=9.4&locale=en
Related videos on Youtube
Author by
SASPYTHON
Updated on January 25, 2020Comments
-
SASPYTHON over 4 years
I am very new to SAS.
I want to convert Number to Character.
basically I want to use to_char function
so I try
proc sql; select put(A.column,$11.) as new_column from table A quit;
This causing error,
what is appropriate way to convert Number to Character???
-
Tom over 5 yearsCharacter formats (the ones starting the
$
) are applied to character values. You need to use a numeric format, such as11.
orZ11.
if you want for apply it to your numeric values.
-