Building models with SAS Enterprise Miner, SAS Factory Miner, SAS Visual Data Mining and Machine Learning or just with programming

Importing all the sheets in a excel file using libname statement. But getting errors

Reply
Contributor
Posts: 49

Importing all the sheets in a excel file using libname statement. But getting errors

I am trying to import all the sheets in a excel file using libname statement. But getting errors

libname klm ("C:\Documents and Settings\devarayulu.balanagu\Des

ktop\Test.xls");

This statement has created four datasets in libref dsd.

1)Change_status_Rev1$

2)Change_status_Rev2$

3)Template$

4)Template$_FilterDatabase

if we right click on these tables name feild is blank.

Actually what are these datafiles, shall we can use as sas datasets. if so why the following code is not working?

proc print data=klm.Change_status_Rev2;

run;

ERROR: File KLM.Change_status_Rev2.DATA does not exist

Can anyone help?

Contributor
Posts: 21

Re: Importing all the sheets in a excel file using libname statement. But getting errors

Posted in reply to devarayalu

Hi ,

Try this code:

libname klm excel "C:\Documents and Settings\devarayulu.balanagu\Des

ktop\Test.xls";

Now hopefully u'll get these files in the library klm:

1)Change_status_Rev1$

2)Change_status_Rev2$

3)Template$

4)Template$_FilterDatabase

Next write the proc print statement:

Proc print data  = klm."Change_status_Rev1$"n;

run;

Hope this helps.Good luck

Shaheen

Contributor
Posts: 49

Re: Importing all the sheets in a excel file using libname statement. But getting errors

Posted in reply to ShaheenRanalvi

Thank you for the answer.

With proc print, i am getting expected output along with junk. How to get rid of junk?

Frequent Contributor
Posts: 86

Re: Importing all the sheets in a excel file using libname statement. But getting errors

Posted in reply to devarayalu

Can you provide your spreadsheet and points out the output junk which you are getting?

Respected Advisor
Posts: 4,927

Re: Importing all the sheets in a excel file using libname statement. But getting errors

Posted in reply to devarayalu

What you are getting is the whole content of the Change_status_Rev1 datasheet. You can also specify a range of cells, as follows :

Proc print data  = klm.'Change_status_Rev1$A1:E99'n;

run;

PG

PG
Ask a Question
Discussion stats
  • 4 replies
  • 417 views
  • 3 likes
  • 4 in conversation