Syntax for specifying worksheet name with spaces using LIBNAME engine for Excel


The following is an example of the correct syntax to specify an Excel worksheet name that contains spaces. 

After assigning a LIBREF to the Excel workbook, worksheets with names that contain spaces or special characters must be referenced using SAS name literal syntax. Enclose the worksheet name in single quotes and append the letter n. For Excel worksheets, you need to include the trailing dollar sign ($) as part of the worksheet name.

Example:

libname mylib odbc dsn=EXCEL;

proc print data=mylib.'This Sheet$'n; 
run;

data mylib.new; 
  set mylib.'This Sheet$'n;
run;