LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (May 2002, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 3 May 2002 19:45:36 -0400
Reply-To:     "Delaney, Kevin P." <khd8@CDC.GOV>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         "Delaney, Kevin P." <khd8@CDC.GOV>
Subject:      Re: Example from SAS doesn't work!
Comments: To: "Smith, Curtis, Mr, DCAA" <Curtis.Smith@DCAA.MIL>,
          "chang5a@YAHOO.COM" <chang5a@YAHOO.COM>
Content-Type: text/plain; charset="iso-8859-1"

Actually, assuming you have the file "C:\myfiles\ACCOUNTS.XLS" available for SAS to find, what you need is a semi-colon. Just like the GETNAMES=YES; Sheet="SHEETNAME"; Is a separate "DBMS SPECIFIC" statement.

778 proc import datafile="c:\myfiles\Accounts.xls" 779 out=sasuser.accounts; 780 sheet="Prices"; 781 getnames=no; run;

NOTE: SASUSER.ACCOUNTS was successfully created. NOTE: PROCEDURE IMPORT used: real time 1.48 seconds cpu time 0.53 seconds

From the ONLINEDOC ->BASE SAS Software ->SAS Procedures Guide ->Procedures -> The Import Procedure-> Procedure Syntax ->Proc Import Statement:

PROC IMPORT can recognize the difference between Excel Version 4 and Version 5 spreadsheets when you use the extension .XLS, regardless of whether you specify DBMS=EXCEL, DBMS=EXCEL4, or DBMS=EXCEL5. However, you must specify DBMS=EXCEL97 to import Excel 97 spreadsheets. If you do not specify an identifier or if the extension of the filename is not recognized, an error is returned.

They must have caught up to EXCEL97 after the Online Doc was released (Version 8.??) because mine works fine without the DBMS= OPTION.

Kevin Delaney KDelaney@cdc.gov

-----Original Message----- From: Smith, Curtis, Mr, DCAA [mailto:Curtis.Smith@DCAA.MIL] Sent: Friday, May 03, 2002 6:26 PM Subject: Re: Example from SAS doesn't work!

I'm assuming that you are wanting to import an Excel file, based on the extension of your data file. I am also assuming that you have a license to SAS/Access for PC File Formats (required, of course, to import an Excel file).

What you are missing as the error 23-322 suggests, is the DBMS= option. In this case, you will want to insert DBMS=EXCEL somewhere in the proc statement. The form of the constant "EXCEL" may depend on the version of Excel you are using. I think in the documentation I have seen "EXCEL97" and "EXCEL2000" mentioned. I would try just "EXCEL" first.

Curt

-----Original Message----- From: Annie Chang [mailto:chang5a@YAHOO.COM] Sent: Friday, May 03, 2002 2:48 PM To: SAS-L@LISTSERV.UGA.EDU Subject: Example from SAS doesn't work!

I copied the following example from the SAS manual:

proc import datafile="c:\myfiles\Accounts.xls"

out=sasuser.accounts

sheet="Prices";

getnames=no; run;

It failed to work on my PC (win2000, SAS v8.1) and I got the following error message:

378 datafile="c:\myfiles\Accounts.xls" 379 380 out=sasuser.accounts 381 NOTE: SCL source line. 382 sheet="Prices"; ----- 22 76 ERROR 22-322: Syntax error, expecting one of the following: ;, DATAFILE, DATATABLE, DBMS, FILE, OUT, REPLACE, TABLE.

ERROR 76-322: Syntax error, statement will be ignored.

383 384 getnames=no; 385 run;

I don't know where to go but here. Hope someone knows what I missed.

Thanks much. A.

__________________________________________________ Do You Yahoo!? Yahoo! Health - your guide to health and wellness http://health.yahoo.com


Back to: Top of message | Previous page | Main SAS-L page