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.
Please post your SAS log.
here i just run the libname statement ....
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;
@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..!
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...
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 - 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;
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 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.