BI Tools

Tips and tricks for building information maps, OLAP cubes, reports, and dashboards

BI Admin

Learn your way around a SAS BI installation.

Visual Analytics

Learn your way around the SAS Visual Analytics tool

Coding & Data

Extract, transform, and load your data into the SAS BI toolset

Stored Processes

Create and design stored processes like a rock star

Home » Coding & Data, Stored Processes

SAS Stored Process: Debugging from the URL

Submitted by on 2012-12-18 – 4:56 AM 6 Comments

Here’s an excerpt from “The 50 Keys to Learning SAS Stored Processes” book, which is 20% off until Dec 31.

When Bad Things Happen to Good Stored Processes

When the stored process fails, a standard error message appears with a button to open the SAS log.  If stored process results are not returned as expected, the log may not appear either. So you do not know what happened. Rather than asking the SAS administrator to get the most recent log off the server, you can add a parameter to the URL path to see the log quickly.

From the SAS Stored Process Web Application, add the &_DEBUG=131 option to the end of the stored process path and press Enter.

The stored process runs and the log appears in the Web browser. You can scroll or search the log to locate errors or read the log messages.  [Yippie!]

 

Note: When creating custom forms and chaining stored process forms, the subsequent forms might not work using this method. During the development process, you must add the debug option as a hidden value.


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!

The following two tabs change content below.

Tricia Aanderud

Director of Data Visualization at Zencos Consulting
Tricia Aanderud is a SAS Business Intelligence and Visual Analytics consultant based in Raleigh, NC who works for Zencos Consulting. She has written several books about SAS, presented papers at many SAS conferences, and has been using SAS since 2001. Contact her for assistance with your next project.

Tags: , ,

6 Comments »

  • Kushal Ramani says:

    Hi Don,

    peachy pointout,

    Coder/admin should be in the picture while applying this, and this should be done in testing environment before going to the production.

  • Another carryover from the good old days of SAS/IntrNet. These are the same values as used by the SAS/IntrNet Application Dispatcher. See:

    http://support.sas.com/rnd/web/intrnet/dispatch/debuginp.html#list

    A few comments about these values. The numeric values correspond to powers of 2 so they can be added to combine options. So 131 really means:

    – echo the name/value pairs passed to the program (1)
    – show the broker time and sas powered image at the end (2) – this is not applicable to the Stored Process Server
    – display the log (128).

    So the 131 comes from setting all three of these options.

    And both IntrNet and the Stored Process Server now support named keywords (and for some reason the doc site for the Stored Process server does not reference the numeric values). So you could also specify:

    _debug=fields,log

    to get both.

    Or just

    _debug=log

    to get just the log.

  • Be careful with techniques like this since it can create a secondary error in production environments. Two issues to be careful of:

    – does the account running the stored process server (sassrv usually) have write access tot he directory?

    – two requests running at the same time will try to write to the same log file, thus causing a secondary error that makes it harder to debug your real error.

  • Great idea – tips like these are especially helpful when you have added HTML and JavaScript to your stored process. If something goes wrong then you really need to see the log!

    🙂

  • Kushal Ramani says:

    Hi Tricia,

    Greetings!!

    Really a short and easy technique, I was always looking for this kind a solution.

    Earlier I was inserting the following code to the stored process to generate logfile for that perticular stored process;

    filename dsn “C:\Users\Administrator\Desktop\logfile.lst”;
    proc printto log=dsn new;
    run;

    This could be used when person need a physical file for log.

    Regards,
    Kushal Ramani