07-03-2015 05:05 AM
Can anyone suggest me any function in SAS similar to Text function in excel. I need to change the format of the coulmn in SAS.
For eg from excel point of view, I would like to do something like this TEXT(A1,"00000").
Let me know if anything can done like this in SAS. Thanks in advance!
07-03-2015 05:28 AM
You would need to provide some more information, preferable before and after data in the form of a datastep. The reason is you can easily change the format of a column assuming that that column has data which is acceptable to the new format e.g:
length col $5;
format col_to_num 6.;
However, if your character data contained letters or non-numeric you would get missing, or have to error handle it.
07-03-2015 06:28 AM
If I understood you correctly, you cannot change a specific value from numeric to character. If need one has to apply the format to the variable and it applies to all values within that variable.
So if you have numeric column(right aligned) you can convert the same to character(left aligned) by PUT function.
x = 111; output;
x = 222; output;
y = put(x, 3.);
put y =;
Hope this suffices your requirement.