Stored Process: Libname Not Assigned
Eeeeek!!! Your SAS Stored Process failed. It worked when in SAS Enterprise Guide! How could this disaster have happened? If you check the log, you may see an error similar to the following about the LIBNAME not assigned.
In this case, the PROC Report was using data called Sales_Candy_History from the MYLIB library. When executing the code, SAS was not able to determine where the data table was located. It could not find the library.
Assigning the Libname
Most likely you need to add the library to the stored process code and test again. For a stored process, you can use a metadata library or a file system library.
A file system library is what I think of as a BASE SAS library. The code looks like this:
LIBNAME Name “File System Path “;
LIBNAME MyLib "d:/data/public";
If you use this LIBNAME statement you have to make sure that file system permissions are available to the stored process or other users. Most likely having the data on your local C drive is not going to work. However, if the directory is on a common server that has open permissions, then you are probably okay.
Generally when creating a stored process in SAS Enterprise, you want to use the Metadata library. Metadata libraries are created in the SAS Management Console by a SAS Administrator (or someone with appropriate permissions.) The LIBNAME statement looks like this one:
LIBNAME YourName meta library=”Metadata Name “;
LIBNAME MyLib meta library="Candy Shop";
You may wonder how I knew to use Candy Shop as the library value. Here’s what my SAS Enterprise Guide session looks like. You can see the assigned libraries to the left. The first library is named Candy Shop.
Still Didn’t Work?
If this does not work, you may have access to the library using your Enterprise Guide profile connection, but the stored process may not have authorization to use the library. You may need to talk to your SAS administrator about permission settings or if there is a preferred library. [Another Article: 3 Most Common Stored Process Errors]
Going For the Deep Dive on Metadata
Here’s some excellent resources and explanations about metadata libraries and their usage:
- Data by Any Other Name – Greg Nelson
- Seeing SAS Data Through the Metadata – Greg Nelson
- What SAS administrators should know about libraries, metadata, and SAS Enterprise Guide – Chris Hemedinger
Learn More about SAS Stored Processes and Prompts
You can learn more tips and tricks for creating, debugging, and using SAS stored processes in the 50 Keys to Learning SAS Stored Processes book. It's a complete guide to SAS stored processes. Check Amazon for best pricing and quick shipping!
Latest posts by Tricia Aanderud (see all)
- Creating a Web Analytics Report in SAS Visual Analytics 8.1 - 2017-06-19
- Designing Dashboards: Sending Your Style Vibe - 2017-01-21
- SAS Visual Analytics: Design Versus Reality - 2016-10-05
- Seize the Day! Submit an #SASGF Abstract - 2016-09-21
- Need a Dynamic X-Axis with Your SAS Visual Analytics Report? - 2016-07-31