Three of the Most Common SAS Stored Process Errors
If you want to learn how to create a stored process at the SAS Global Forum 2013, then make sure you attend the “Building Your First Stored Process” Hands On workshop that Angela and are hosting on Wednesday morning. We will show you how to build a three different stored process with prompts in under 90 minutes. In the meantime, here are the most common errors that new developers make to help you as you get started.
Update: It was a fun presentation - here’s the paper.
Error #1: LIBNAME is Not Assigned
If you develop your stored process code in SAS Enterprise Guide, then the code uses your Connection Profile. Thus it has access to all of your libraries. When that code is moved to the stored process, you might find its generates a “LIBNAME not found error”. A best practice is to always add the LIBNAME statement to your stored process. You can learn more about how the libraries are assigned in the SAS 9.3 user documentation: “Assigning Libraries“. If you are still confused, I thought the SAS 9.2 documentation had a helpful description of pros and cons here.
You don’t have to read the entire background – just find the library connection you need to make as shown below. Note: For this example, system library simply means it does not exist in the metadata so you call the library from the file system.
Error #2: Unexpected or No Results with Macros
If you have added the %STPBegin and %STPEnd macros in your stored process, then you must ensure the Stored Process Wizard does not add it back. If you have added the macros and the wizard has added the macros, then you see where some interesting results might occur. The worse part of troubleshooting the issue is that it can take several hours with the log to determine the issue. Refer to the “Double, Triple Check Those STP Macros ” post for more help.
Error #3: Prompt Always Uses the Same Values
Did your prompt work, but it keeps making the same choice no matter way you select? For instance, you selected the East region but it returns the West region – no matter how many times you select it? You might want to double-check the code to see if you left the LET statements in it. Many programmers test the prompts to ensure they work or create errors to confirm the prompt will fail. If it’s a large stored process, then you may forget you did it. That’s worth some more time trying to find why your prompt failed.
This one has caught me more than once.
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)
- SAS Add-In for MS Office: Abe Lincoln Sends Glee in a Snowstorm - February 18, 2014
- #SASGF14: You’re Invited to a TweetUp! - February 10, 2014
- SAS Stored Process Dealing with Disappearing Results - January 31, 2014
- More SAS Stored Process Sleight of Hand Tricks - January 29, 2014
- Little Known Secrets from SAS Stored Process Magicians - January 26, 2014