BookmarkSubscribeRSS Feed
muledivyaswapna
Calcite | Level 5

HI, my name is swapna, I am beginner of the sas programming, now I am learning to sas, i have one problem, I am importing excel sheet in sas ,and run the program but one error is occuring, 

 

 

PROC IMPORT DATAFILE="" 
OUT=WORK.Test 
DBMS=xls REPLACE; 
RUN; 


PROC PRINT DATA=WORK.Test; 
RUN;

 

 

plllllllllllllllllllz tell me the solution,iam trying to so many times but not comes the solution.

3 REPLIES 3
jklaverstijn
Rhodochrosite | Level 12

Hi Swapna,

 

Welcome in the world of SAS.

 

If you are refering to errors you are getting it would help us if the error message was present in your post. Also take care of the layout of any SAS code. Anything more elaborate than what you are sending us now would be illegible. Use the SAS code formatting (the little running man on the top of the editor window) and paste your code in there. Also use plenty linebreaks.

 

On the matter of your error: in your code ...

 

PROC IMPORT DATAFILE="" OUT=WORK.Test DBMS=xls REPLACE; RUN; 
PROC PRINT DATA=WORK.Test; 
RUN; 

... the datafile is not given. Instead an empty string is present. So SAS would not know what to import. The error message would probably have said so. Insert a valid filename here.

 

Hope this helps,

- Jan.

 

 

RW9
Diamond | Level 26 RW9
Diamond | Level 26

Couple of tips.  Put a descriptive thread title, "sas" is meaningless.  You can use the code window to post code and logs - its the {i} above the post area, this keeps formatting, and makes it easier to read.  Also, avoid coding in capitals - don't know what this trend came from but it really makes code hard to read, and appears rude.  You have not supplied a filename:

proc import datafile="<put your path and datafile here>"
                   out=work.test
                   dbms=xls 
                   replace;
run;

proc print data=work.test;
run;

Do also note that the DBMS option needs to acurately reflect the file type, if your file is XLSX, then don't specify XLS which is different.  

ChrisNZ
Tourmaline | Level 20

The error your code generates is very informative:

 

ERROR: Unable to import, please specify a DATAFILE.

 

This tells you exactly what is wrong here.

 

On the top of the valid comments above, here is another recommendation: always look in the log after you run something. 

 

Even if there are no errors, check that there are no messages informing you of some thing not quite as expected.

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
  • 3 replies
  • 434 views
  • 0 likes
  • 4 in conversation