BookmarkSubscribeRSS Feed
NewUserSravya
Calcite | Level 5

Hi All,
I'm new to SAS and below is  the code for creating new library and importing data to library from excel

 

code
libname mylib '/home/u61033161';
data employee;
set mylib.employee;
run;


Response :

69 libname mylib '/home/u61033161';
NOTE: Libref MYLIB was successfully assigned as follows:
Engine: V9
Physical Name: /home/u61033161
70 data employee;
71 set mylib.employee;
ERROR: File MYLIB.EMPLOYEE.DATA does not exist.
72 run; 
 
even though the data is available in excel sheet i am getting the above error when i execute the code.
can anyone guide me through.
2 REPLIES 2
Reeza
Super User

That isn't how you access an Excel sheet. 

 

You can access it via a libname but it would have to point directly to the file.

 

This blog post covers the topic of how to access an Excel file using the libname option.

https://blogs.sas.com/content/sasdummy/2015/05/20/using-libname-xlsx-to-read-and-write-excel-files/

 

Otherwise, you can import the Excel file and then save it to a library as a SAS data set to access later.

 


@NewUserSravya wrote:

Hi All,
I'm new to SAS and below is  the code for creating new library and importing data to library from excel

 

code
libname mylib '/home/u61033161';
data employee;
set mylib.employee;
run;


Response :

69 libname mylib '/home/u61033161';
NOTE: Libref MYLIB was successfully assigned as follows:
Engine: V9
Physical Name: /home/u61033161
70 data employee;
71 set mylib.employee;
ERROR: File MYLIB.EMPLOYEE.DATA does not exist.
72 run; 
 
even though the data is available in excel sheet i am getting the above error when i execute the code.
can anyone guide me through.

 

tarheel13
Rhodochrosite | Level 12

I usually just use proc import to get data from Excel.