BookmarkSubscribeRSS Feed
jaliu
Quartz | Level 8

I'm kind of confused about what a library is. I think it's just a folder that contains folders and files, but this is not clear to me. If a library doesn't have any files (but rather has files in subfolders), will files not be accessible? Would we/can therefore add another libref to a subfolder to access those files within subfolders?

14 REPLIES 14
PaigeMiller
Diamond | Level 26

Whatever folder(s) the LIBNAME statement mentions must contain the SAS data set files. SAS doesn't look in subfolders, unless you specifically state the subfolder in the LIBNAME statement.

 

Would we/can therefore add another libref to a subfolder to access those files within subfolders?

Other way around ... add a subfolder to the LIBNAME statement.

--
Paige Miller
akhan1971
Fluorite | Level 6

I have a question about library in SAS ODA. In the screenshot shared below, please see the library 'CURESDAY', which was originally created as a SAS ODA library and it used to be displayed as a library under 'My Library' folder. However, from yesterday I don't see that library listed under 'My library'. Instead, I see it under files table. Also, please note that 'Files (Home)' used to be displayed on the left-hand panel of the screen, but it is currently now showing there either. 

Please advise on how I can see my "CURESDAY" library and 'My Files (home)' items on the left hand side of my SAS ODA screen as it was shown earlier until yesterday evening.

Thank  you in advance for your advice.

With regards,

 

 

 

akhan1971_1-1706715505389.png

 

 

tom_grant
SAS Super FREQ

Cool feature in SAS Studio is you can right-click on a folder when in the Server Files and Folders tab, & then select Create -> Library.  This will bring up a pop-up window where you can supply the libref for this folder & also check a box to assign the library every time you start SAS Studio so you never have to do this again (librefs are deleted when you close or reset your SAS session).

Note: This only works for creating Base SAS libraries.

 

tom_grant_1-1706717088998.png

 

akhan1971
Fluorite | Level 6

Thank you for your advise. But I beleive I could convey my encountered issue clearly. I wanted to mean that my encirled folders in blue line were once shown on the left hand side menu, but at present they seem to have disappeared from the left hand side menu. How can I bring these essential folders such as "odaws01-ws2' folder , 'File (home)' , and a library folder named 'curesday' etc. back to left hand side menu? Thank you once again. (please see the screenshot in this regard shared below and also attached as PDF file. Thank you.)

akhan1971_1-1706794581191.png

 

akhan1971
Fluorite | Level 6
Thank you for your advise. But I beleive I could convey my encountered issue clearly. I wanted to mean that my encirled folders in blue line were once shown on the left hand side menu, but at present they seem to have disappeared from the left hand side menu. How can I bring these essential folders such as 'File (home)' , a library folder named 'curesday' etc. back to left hand side menu? Thank you once again.
tom_grant
SAS Super FREQ
Can you send a screen shot of what your Server Files and Folders tab looks like now??
akhan1971
Fluorite | Level 6

Thank you Mr. Grant for your response!

Please see attached the screen shot in pdf format (the same screenshot is copied below in .jpeg format).

Please note that at present i don't see 'odaws01'  folder, "files (home)" folder, and "CURESDAY" folder on the left hand side.

But they were available on the left hand side menu a previously. Something has happened, causing them to disappear (aparently to to another location that I am having issues in relocating).

Thank you.

akhan1971_0-1706796056803.png

 

tom_grant
SAS Super FREQ

Thanks for screen shot.  So you've lost your Server Files and Folders tab.  This is an easy fix.  Go to the icon on Top Right that looks like a hamburger & click & select View.  Then check the Server Files and Folders.  Somehow it got un-selected.

tom_grant_0-1706802844636.png

 

akhan1971
Fluorite | Level 6
Thank you so much!
It worked!
Best regards.
Kurt_Bremser
Super User

A library in SAS is a reference to a location that contains SAS files like datasets, views or catalogs.

On UNIX systems and Windows that location is a directory.

Libraries cannot be nested (a library cannot contain another library, all libraries exist on the same level side by side).

It is possible to create a directory as a subdirectory of another, and assign library references to both, but when viewing from inside SAS, that hierarchy will not be represented.

Panagiotis
SAS Employee

SAS libraries access data. You set a library to some location (folder, database, Excel workbook). You can then references that library name when working with the data in those locations.

 

You can also check out the free SAS Programming course. Go to Lesson 2, then Accessing Data Through Libraries. Practices doing that with the Excel file, and folder paths.

 

 

ThdB
Obsidian | Level 7

It is possible to use multiple folders in one library 

libname income ('corpsale','retail');

However, if a dataset is stored in both folders with the same name, sas uses the dataset from the first folder.

Panagiotis
SAS Employee

Seems like you can. Here is an example in the LIBNAME statement documentation: https://go.documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/lestmtsglobal/n1nk65k2vsfmxfn1wu17fntzszbp...

 

I tested it on my local SAS install and it worked.

libname x ('S:/workshop/data' 'S:/courses/SQLM6/data');
Log:
69 libname x ('S:/workshop/data' 'S:/courses/SQLM6/data');
NOTE: Libref X was successfully assigned as follows:
Levels: 2
Engine(1): V9
Physical Name(1): S:\workshop\data
Engine(2): V9
Physical Name(2): S:\courses\SQLM6\data
ThdB
Obsidian | Level 7

You can add multiple folders to a library, however, if you have files with the same name in multiple folders, sas will only use the first folder where the file is located

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 14 replies
  • 5244 views
  • 10 likes
  • 7 in conversation