I have SAS 9.3 installed, but SAS seems to ignore the sheet= statement because the resulting dataset 'test' is made up of data from the first sheet in my excel file. Any idea how to fix this?
PROC IMPORT OUT=work.test
FILE='C;\user\test.xlsx'
DBMS=EXCEL REPLACE;
sheet='sheet4';
getnames=yes;
RUN;
One possible reason for this error is the Microsoft components must match the "bitness" of SAS. If you are running 32-bit SAS you need the 32-bit components, if you are running 64-bit SAS you need the 64-bit components.
Are you using SAS on Windows?
If so try importing via libname, then you can see the sheets and what SAS is seeing.
libname test excel "C;\user\test.xlsx";
Then check your libraries and see what the sheets look like. If you're after sheet4 for example:
data test;
set test.'Sheet4$'n;
run;
*Close the connection to the excel file;
libname test;
Hi Reeza,
I get the following error when I run the libname statement.
ERROR: Connect: Class not registered
ERROR: Error in the LIBNAME statement.
I googled it, and found that I need to download and install Microsoft's Data Connectivity Components, which I have done.
I'm running SAS 9.3 on a Windows 7 machine. That download should have fixed it, correct?
did the ; in FILE='C;\user\test.xlsx' give you problem?
One possible reason for this error is the Microsoft components must match the "bitness" of SAS. If you are running 32-bit SAS you need the 32-bit components, if you are running 64-bit SAS you need the 64-bit components.
Yes, it I have 32-bit office components, but 64-bit SAS. I think this is the issue.
Thanks.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!