Hello
Are there only SAS data set files in SAS library or can be also other type of files?
For example:
Is it possible to store SAS program files in library?
A library is typically just a folder so you can definitely save the programs there but you won't see them in the library under the SAS Library Pane if that's what you're asking. You will see them under the SAS File Explorer or Servers Folders and Files pane.
It's rarely done but you can pre-compile SAS programs and store them in a catalog which then gets accessed via a library. So there can be more than only tables under a library but it's not something you normally use/access directly.
Other examples for things in SAS catalogs are compiled SAS macros and formats. To get access to these catalogs you need to have a library defined that points to the folder where the catalog file exists.
You can use SAS catalogs to store a lot of different types of things.
You can use a SOURCE entry to store the source code of a program.
On the most widely used platforms for SAS (Windows and UNIX), a SAS Base library is a directory in the file system. SAS stores datasets (.sas7bdat), views (.sas7bvew), indexes (.sas7bndx) and catalogs (.sas7bcat) there. And other stuff (the WORK of a workspace server is used by Enterprise Guide as intermediate storage for import/export files).
You can put any files you can think of into a library directory, but you will only see views and datasets via the library interface of your SAS GUI, as already mentioned (Display Manager will also show catalogs).
Storing stuff in catalogs for long-term is not recommended, as catalogs are platform- and version-specific. Always keep a source from which you can populate the catalogs.
SAS library is a folder / directory at the operating system level. One can indeed stores any type of file in that.
While SAS datasets can be accessed using the libname.datasetname syntax, for accessing code one needs the full physical path,
However, it is a good practice to store programs in their own folders.
Did you check the doc (#maxim1)?
https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/basess/p077cfj7uoozw7n13h5g1w8mnu72.htm
🙂
Bart
I do a lot of ad hoc small requests. Many of these require one or two data sets and one or two SAS programs (read provided data source or extract from permanent library and then manipulate to add analysis variables). I create a library to work in and the same folder will contain the output generated and often a copy of the request document(s).
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.