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.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 774 views
  • 0 likes
  • 3 in conversation