SAS Office Analytics, SAS Add-In for Microsoft Office, and other integrations

Reading a sheet from an Excel file into SAS.

Reply
N/A
Posts: 0

Reading a sheet from an Excel file into SAS.

Am a novice in SAS. Have a question that may be pretty basic to most of you.I am trying to read a particular sheet from an Excel file into SAS. I use SAS V8.2 on Windows XP.

I used proc import -

proc import datafile="c:/Shares.xls" out=test1;
sheet="SS_Shr";
run;


but am getting the following error.

ERROR: File _IMEX_.'SS_Shr$'n.DATA does not exist.
ERROR: Import unsuccessful. See SAS Log for details.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE IMPORT used:
real time 0.15 seconds
cpu time 0.03 seconds


I also 'googled' and tried using -

PROC IMPORT OUT= WORK.auto1
DATAFILE= "C:\Shares.xls"
DBMS=EXCEL REPLACE;
SHEET="SS_Shr";
GETNAMES=YES;
MIXED=YES;
USEDATE=YES;
SCANTIME=YES;
RUN;
proc print data=auto1;
run;


but this doesn't work either. The following error message is displayed.

771 PROC IMPORT OUT= WORK.auto1
772 DATAFILE= "C:\Shares.xls"
773 DBMS=EXCEL REPLACE;
NOTE: The previous statement has been deleted.
NOTE: The previous statement has been deleted.
NOTE: The previous statement has been deleted.
774 SHEET="SS_Shr";
775 GETNAMES=YES;
NOTE: SCL source line.
776 MIXED=YES;
-----
180
NOTE: SCL source line.
777 USEDATE=YES;
-------
180
NOTE: SCL source line.
778 SCANTIME=YES;
--------
180
ERROR 180-322: Statement is not valid or it is used out of proper order.

779 RUN;


Can any of you know what I am missing? I am just trying to import a sheet from an Excel file into SAS.

Thx.
SAS Super FREQ
Posts: 8,718

Re: Reading a sheet from an Excel file into SAS.

Hi:
Refer to these Tech Support notes. There is a special way to refer to sheets:
http://support.sas.com/kb/2/529.html
http://support.sas.com/kb/1/849.html

cynthia
N/A
Posts: 0

Re: Reading a sheet from an Excel file into SAS.

Thanks Cynthia.
Ask a Question
Discussion stats
  • 2 replies
  • 207 views
  • 0 likes
  • 2 in conversation