Sample 24509: How to specify a sheet name when importing an Excel file with the LIBNAME access method
The Microsoft Jet Engine adds a '$' to the end of a spreadsheet name to differentiate between a spreadsheet and a named range in Excel. In order to specify a name that contains special characters in SAS, you need to use a name literal:
LIBNAME XLS 'C:\Excel Files\scores.xls';
DATA NEW;
SET XLS.'SHEET1$'n;
RUN;
or:
PROC SQL;
CREATE TABLE NEW AS SELECT * FROM XLS.'SHEET1$'n;
QUIT;
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
These sample files and code examples are provided by SAS Institute
Inc. "as is" without warranty of any kind, either express or implied, including
but not limited to the implied warranties of merchantability and fitness for a
particular purpose. Recipients acknowledge and agree that SAS Institute shall
not be liable for any damages whatsoever arising out of their use of this material.
In addition, SAS Institute will provide no support for the materials contained herein.
Date Modified: | 2008-02-19 14:31:44 |
Date Created: | 2006-05-31 13:51:04 |
Operating System and Release Information
SAS System | SAS/ACCESS Interface to PC Files | Windows | n/a | |