BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
sarahsasuser
Quartz | Level 8

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;

1 ACCEPTED SOLUTION

Accepted Solutions
SASKiwi
PROC Star

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.

View solution in original post

5 REPLIES 5
Reeza
Super User

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;

sarahsasuser
Quartz | Level 8

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?

Linlin
Lapis Lazuli | Level 10

did the ; in   FILE='C;\user\test.xlsx' give you problem?

SASKiwi
PROC Star

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.

sarahsasuser
Quartz | Level 8

Yes, it I have 32-bit office components, but 64-bit SAS. I think this is the issue.

Thanks.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

Discussion stats
  • 5 replies
  • 2170 views
  • 1 like
  • 4 in conversation