08-08-2013 03:18 PM
I have a SAS dataset I need to export to excel or as a csv file and it is not exporting correctly. When I export it changes some character variables to numeric. I have number saved as character because excel drops leading zeros and has been putting random decimal places in the beginning of the numbers. Any suggestions to fix this would be appreciated.
08-08-2013 04:34 PM
You can force Excel to consider a field as text by prefixing it with an apostrophe. The apostrophe will not be displayed in the Excel worksheet.
libname xl Excel "path\myFile.xlsx";
create table xl.mySheet as
cats("'", myCharNumVar) as myCharNumVar