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?

4 REPLIES 4
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
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
Fluorite | Level 6

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.

SAS INNOVATE 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

5 Steps to Your First Analytics Project Using SAS

For SAS newbies, this video is a great way to get started. James Harroun walks through the process using SAS Studio for SAS OnDemand for Academics, but the same steps apply to any analytics project.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 4 replies
  • 820 views
  • 7 likes
  • 5 in conversation