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.

 

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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