BookmarkSubscribeRSS Feed
teleous0
Fluorite | Level 6

* Using SAS Studio 9.2, I believe

THE CHALLENGE

Sometimes the simplest things throw you. As I review, I find I am having trouble importing an excel spreadsheet. I have written 

PROC IMPORT DATAFILE="/home/teleous0/Cody/drugtest.xls"
		    OUT=mtl.drugtest;
		    DBMS=XLS;
		    GETNAMES=drugtest;
RUN;

 

I am receiving the following message:

ERROR: Output SAS data set must be provided.

 

No warnings but I have five notes (three of the notes are standard but the other two I don’t fully understand, given the statements I’ve written (see below)

 

NOTE: ODS PDF(WEB) printed no output.
       (This sometimes results from failing to place a RUN statement before the ODS PDF(WEB) CLOSE statement.)
 70         FILENAME _GSFNAME;
 NOTE: Fileref _GSFNAME has been deassigned.

 

I'VE TRIED 

I have (1) copied and pasted the path directly from properties, (2) double checked to be sure the dbms is .xls, (3) used the same name and different six character names for the “out=statement, (4) added ‘replace’ as part of the out statement (5) added & deleted the ‘sheet=xyz’ statement (there is only one sheet) (6) responded to “get names with ‘Yes’, ‘No’ and deleting the statement all together and (7) I've tried it saving the data in both the work and the permanent library. I’ve been on line and nothing I’ve tried works; I still get the error message. Please help me.

 

Thank you. 

NOTE: Using the SNIPPET didn’t work either.

Thanks

1 REPLY 1
mohamed_zaki
Barite | Level 11

You have extra semicolons in your PROC IMPORT statments.

OUT, DBMS, REPLACE are all parts of PROC IMPORT, and must end up by only one semicolon.

Try this:

PROC IMPORT DATAFILE="/home/teleous0/Cody/drugtest.xls"
		    OUT=mtl.drugtest
		    DBMS=XLS;

GETNAMES=YES;
RUN;

 

Also GETNAMES valid values only is YES or NO. Which specifies whether the IMPORT procedure generate SAS variable names from the data values in the first record in the input file or not.

 

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 1 reply
  • 1990 views
  • 2 likes
  • 2 in conversation