BookmarkSubscribeRSS Feed
KK_QQ
Calcite | Level 5

I am using SAS University Edition. I tried to using below statment to access excel file

libname prod xlsx "/folders/myfolders/SAS/book1.xlsx";

Actually there is no error in log. But I can only see the prod libref is created but there is no way to access the data in the Excel file. 

 

I attach the book1 file, from sheet2 you can see the result from proc contents, there is connection, but can't read data. 

8 REPLIES 8
KK_QQ
Calcite | Level 5

Import is working. But I feel it works more like input, create new dataset. Not like libname create a link to file. 

KK_QQ
Calcite | Level 5
Sorry, I mean infile
Reeza
Super User

How did you try and 'read' the file. Did that generate an error? Include your code and log. 

KK_QQ
Calcite | Level 5
 libname prod xlsx "/folders/myfolders/SAS/book1.xlsx";
Log
1 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
55
56 libname prod xlsx "/folders/myfolders/SAS/book1.xlsx";
NOTE: Libref PROD was successfully assigned as follows:
Engine: XLSX
Physical Name: /folders/myfolders/SAS/book1.xlsx
57
58 OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
70
Reeza
Super User

Did you try accessing the data with a data step? Post that code

KK_QQ
Calcite | Level 5

No, I can't. After I use libname, there have libref created, but it empty, there is no data.

Reeza
Super User

How do you know it's empty? 

Did you try a data step? 

 

Data want;

set libname.'Sheet1$'n;

run;

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 8 replies
  • 1861 views
  • 0 likes
  • 3 in conversation