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.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
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
  • 541 views
  • 0 likes
  • 3 in conversation