BookmarkSubscribeRSS Feed
varmalh
Fluorite | Level 6

Hello,

Can someone please advise me that how i can connect with the excel using "Libname" statement as tried this in my crome and internet explores browser but nothing happen.

 

than

libname y xlsx "C:\Users\Hp\Desktop\Cost_Basis_Project\Market_Price_Sheet.xlsx";

proc contents data=x._all_ nods;

run;
proc print data=x.market;
run;

ks.Screenshot (11).png

10 REPLIES 10
SASKiwi
PROC Star

Please post your SAS log.

varmalh
Fluorite | Level 6

here i just run the libname statement ....Screenshot (13).png

Patrick
Opal | Level 21

@varmalh 

Looks like the Libname works. What does the Proc Contents return?

 

....and looking at the code you've posted:

Wouldn't you need to use libref Y instead of X?

proc contents data=Y._all_ nods;

run;quit;

varmalh
Fluorite | Level 6

@Patrick i don't think libname worked as u can see there is no sheet mention on the left hand side of libraries..!!

please also see the result of Proc content..!

Screenshot (17).png

Patrick
Opal | Level 21

The libname doesn't return an error so the file appears to exist. 

Make sure you don't have the file opened via Excel when you run your code (also I believe the libname would throw an error in such a case).

How does the data in your Excel actually look like. Does data start in cell A1 or is it in a different structure?

Can you share your Excel with us (as an attachment here)? Many people won't open Excels - but some do...

varmalh
Fluorite | Level 6
@Patrick i used libreg Y and X both just to be sure but nothing positive .....!!
SASKiwi
PROC Star

Please try the EXCEL engine on your LIBNAME rather than XLSX.

 

Also don't forget to refresh your server list after applying the LIBNAME. Tables / tabs won't show until you do this.

varmalh
Fluorite | Level 6

hi @SASKiwi @Patrick ,

i noticed one thing that i could not able to see my system folder i don't know why....!

 

Screenshot (20)_LI.jpg

SASKiwi
PROC Star

@varmalh  - Run PROC SETINIT and PROC PRODUCT_STATUS to confirm if you have SAS/ACCESS to PC Files - Excel LIBNAMES of any form won't work if you don't have the software:

 

proc setinit;
run;

proc product_status;
run;

 

 

Tom
Super User Tom
Super User

You appear to be connecting to SAS using the SAS/Studio application.  Make sure that the XLSX file you want to read is on the machine that is actually running SAS, it might a different machine (physically or logically) than the machine where you are running the browser that is connecting to SAS/Studio.

 

Note that if you issue that LIBNAME statement and the file does not exist then SAS will create an empty file so you can copy data into it.  That would explain why it appears to be empty.

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
  • 10 replies
  • 1386 views
  • 1 like
  • 4 in conversation