sas

Reply
New Contributor
Posts: 4

sas

[ Edited ]

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.

Valued Guide
Posts: 530

Re: sas

Posted in reply to muledivyaswapna

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.

 

 

Super User
Super User
Posts: 9,227

Re: sas

Posted in reply to muledivyaswapna

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.  

PROC Star
Posts: 2,231

Re: sas

[ Edited ]
Posted in reply to muledivyaswapna

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.

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