BookmarkSubscribeRSS Feed
crzydzy
Calcite | Level 5

Lesson 2: Accessing Data: Creating an excel libref.

 

I succesfully created the code using  SAS Enterprose, ran the program, no errors, NP was successfully assigned.  Problem is that the NP libname does not appear in my list of libraries. Where is it?  I know it exists because I am able to complete the rest of the activity and SAS recognizes the library as I am writing the proc  contents data=np.parks

4 REPLIES 4
Reeza
Super User
If you press refresh does it show up?
crzydzy
Calcite | Level 5
Refreshing does not make the NP library appear.

As I proceed with the coding for the rest of the activity, the 3 data sets
(in the library) pop up in the suggestive mode feature in SAS Enterprise.

FYI, I have looked in every library on the server and I could not find it.
I even looked on my local hard drive to see if it were someplace.
Kurt_Bremser
Super User

This LIBNAME statement will always work:

libname test xlsx "some place that positively does not exist at all";

because you can use LIBNAME XLSX (and other similar engines) to create a new file. The ERROR will happen when you try to create a dataset in the library, or when you try to read something from there.

 

Your most probable mistake is using the local path to the Excel file in your code, while your SAS process runs in fact on a remote server.

 

Please post your code, and the log from this:

%put %sysfunc(pathname(work));
Cynthia_sas
Diamond | Level 26
Hi: Watch where you have your libname np clear; statement. Most of our examples show the use of the LIBNAME statement to point to the Excel workbook and then after the SAS code, we typically show a CLEAR for the LIBNAME. The reason is that Excel gets touchy when SAS holds a file open with the LIBNAME engine and can issue nasty "read-only" messages if you try to open the file in Excel while SAS is using it. If you look at your libraries list AFTER your program does the clear, you will no longer see the XLSX defined library in your list.

Cynthia

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

LIBNAME 101

Follow along as SAS technical trainer Dominique Weatherspoon expertly answers all your questions about SAS Libraries.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 4 replies
  • 1533 views
  • 2 likes
  • 4 in conversation