Write and run SAS programs in your web browser

error in using importing file

Reply
Contributor
Posts: 31

error in using importing file

/** Import an XLSX file.  **/
libname g '/folders/myfolders/';
PROC IMPORT DATAFILE="/folders/myfolders/grocery_coupons.xls";
      OUT=g.permanent
      DBMS=XLSX
      REPLACE;
RUN;

/** Print the results. **/

PROC PRINT DATA=g.permanent; RUN;

 

 

log

 

Engine: V9
Physical Name: /folders/myfolders
58 PROC IMPORT DATAFILE="/folders/myfolders/grocery_coupons.xls";
ERROR: Output SAS data set must be provided.
NOTE: The SAS System stopped processing this step because of errors.
NOTE: PROCEDURE IMPORT used (Total process time):
real time 0.00 seconds
cpu time 0.01 seconds
 
59 OUT=g.permanent
60 DBMS=XLSX
61 REPLACE;
62 RUN;
63
64 /** Print the results. **/
65
 
 
66 PROC PRINT DATA=g.permanent; RUN;
Super User
Posts: 19,058

Re: error in using importing file

The error is the same as in your last question. 

 

https://communities.sas.com/t5/SAS-Analytics-U/Error-using-Proc-import/m-p/290978

 

There is no semicolon after the file path. 

SAS Super FREQ
Posts: 8,818

Re: error in using importing file

Hi, in addition, please check the documentation for DBMS=XLSX -- you show that your file name is .XLS, not .XLSX, so you may be trying the wrong engine to read the file, once you get your syntax worked out.

cynthia
Super User
Super User
Posts: 6,842

Re: error in using importing file

[ Edited ]

I always place the semi-colon on a multiple line statement on a new line and align it with the beginning of the statement. The lines in between are indented. The same way that I format DO/END blocks of code.  

 

I find that is makes it much less likely that I will accidently insert an extra semi-colon into the middle of long statements.

 

libname g '/folders/myfolders/';
PROC IMPORT
  DATAFILE='/folders/myfolders/grocery_coupons.xlsx'
  OUT=g.permanent
  DBMS=XLSX
  REPLACE
;
RUN;

 

Ask a Question
Discussion stats
  • 3 replies
  • 525 views
  • 0 likes
  • 4 in conversation