'How to reference a worksheet when creating a libref?
I am new to SAS and I am trying to create LibRef using an *.xls file. The Excel file has four worksheets: Sheet1, Sheet2, Sheet3 & Sheet4. How do I tell the libref to reference "Sheet1" only?
options validvarname = v7;
libname libxls "path ....xls";
Solution 1:[1]
AFAIK that isn't possible. You set up the libname as a connection to the Excel file (usually XLSX these days, not XLS) and then you can reference the Sheet as you would a data set.
libname libxls excel 'path....xls';
proc means data=libxls.'Sheet1'n;
run;
data myData;
set libxls.Sheet1;
run;
You don't always need the quotes and n, but I think you may with XLS files.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Reeza |
