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

Share:
25,253

Related videos on Youtube

SASPYTHON
Author by

SASPYTHON

Updated on January 25, 2020

Comments

  • SASPYTHON
    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
      Tom over 5 years
      Character formats (the ones starting the $) are applied to character values. You need to use a numeric format, such as 11. or Z11. if you want for apply it to your numeric values.