Three of the Most Common SAS Stored Process Errors

This post was kindly contributed by Business Intelligence Notes for SAS® BI Users - go there to comment and to read the full post.

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.

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.

Use the Libname Statement

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.

STP Macros Options

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.

SAS Stored Process LET Statement

 

 

What Tripped You Up?

Did you have a funny or hair-pulling experience troubleshooting a SAS Stored Process?  Share it in the comments.

Related Posts

The post Three of the Most Common SAS Stored Process Errors appeared first on Business Intelligence Notes for SAS® BI Users. Written by .

This post was kindly contributed by Business Intelligence Notes for SAS® BI Users - go there to comment and to read the full post.