Search code examples
sasexport-to-excelexcel-2003

SAS: PROC EXPORT adds a "_" in the Excel sheet name but the _ is not there in SAS?


I have the following SAS code that exports to an .xls-file. (NB: I need the OLD 1997-2003 format).

I specify the sheet name to be: 'PB Organization'

but when the file is created the sheet name is 'PB_Organization'

An "_" has been added. What is happening?

PS: The file contains the right columns and rows, it is just the sheet name that is wrong.

%let Path_Org = "\\Folder\CurrentMonth - PB Organization"; 
proc export data=pb_org2
   outfile = &Path_Org 
   dbms=xls replace;
   sheet = 'PB Organization';
run;

Solution

  • from SAS docs:

    SHEET=sheet-name

    identifies a particular spreadsheet in an Excel workbook. Use the SHEET= option only when you want to import an entire spreadsheet. If the EXPORT procedure sheet-name contains special characters (such as space) SAS converts it to an underscore.

    The space is converted to an underscore. "Employee Information" becomes "Employee_Information"

    see also here http://support.sas.com/documentation/cdl/en/acpcref/63184/HTML/default/viewer.htm#a003103761.htm