SUPPORT / SAMPLES & SAS NOTES
 

Support

Usage Note 39114: Tips for running a SAS® Stored Process in Background mode

DetailsAboutRate It

If you have a SAS® Stored Process that creates non–streaming output and you submit the SAS Stored Process using a Web browser, you can run the request in the foreground (the default) or in the background. Here are some notes about running a SAS Stored Process in the background using SAS® 9.2 and later releases.

  1. By default, a SAS Stored Process runs in the foreground and your Web browser will wait to receive the output until the SAS Stored Process completes execution. However, if you run a SAS Stored Process in the background, control is returned to your Web browser when the SAS Stored Process is submitted for execution.
  2. To execute the SAS Stored Process in background mode, you must add the _ACTION=BACKGROUND option to the SAS Stored Process execution using one of the following approaches:
    1. Add the _ACTION=BACKGROUND option directly to the URL for the SAS Stored Process. For example:
      http://your-server:8080/SASStoredProcess/do?_program=/MySTPs/test&_action=background

      Multiple values for the _ACTION= parameter are separated by a comma, for example:

      http://your-server:8080/SASStoredProcess/do?_program=/MySTPs/test&_action=strip,background
      
    2. If the SAS Stored Process has input parameters that require end user selections before submitting the SAS Stored Process, you can define _ACTION=BACKGROUND as a hidden input parameter for the SAS Stored Process definition in metadata. Note: the metadata–defined _ACTION=BACKGROUND hidden parameter is only used if the SAS Stored Process is submitted using the Property page supplied by SAS. In other words, this approach requires that there be other visible input parameters defined in metadata that the end user must select before running the SAS Stored Process.

      For example, create a SAS Stored Process with two input parameters, one is _action (NOTE: the name of the parameter, _action, must be specified in LOWER CASE) with default value of BACKGROUND (case insensitive) and the checkbox to "Hide from user" selected and the other parameter is AGE with values from 11 to 16 in a static list. The SAS Stored Process code is:

      %stpbegin; proc print data=sashelp.class; where age=&age; run; %stpend;

      When this SAS Stored Process is submitted from the SAS Property page, it will be executed in the background.

    3. If the SAS Stored Process does not require user interaction for input parameter selection, you can create a custom jsp file that automatically submits the SAS Stored Process with _ACTION=BACKGROUND. For example,
      <html><body onLoad="document.mystp.submit()"> <form name=mystp action="<%= request.getContextPath() %>/do"> <input type="hidden" name="_program" value="/MySTPs/test"> <input type="hidden" name="_action" value="background"> </form></body></html>
  3. Running a SAS Stored Process in the background causes an alert to be created. You can view your alerts (and any results from the SAS Stored Process) from the Stored Process Alerts Portlet in the SAS® Information Delivery Portal.
  4. In the SAS Information Delivery Portal, the following portlets are helpful when running SAS Stored Processes in background mode.
    1. The Stored Process Alerts Portlet
    2. Follow these steps to add the Stored Process Alerts Portlet to your SAS Information Delivery Portal Page:

      1. Select Options>Edit Page Content>Add Portlets.
      2. On the Add Portlets page, click Search and search for the Stored Process Alerts Portlet.
      3. Check the Stored Process Alerts Portlet box.
      4. Click Add and then click Done and OK.
    3. The Personal Repository Navigator.
    4. You can use the Personal Repository Navigator to access your Personal Repository (which resides on the SAS Content Server).

      Follow these steps to add the Personal Repository Manager to your SAS Information Delivery Portal Page:

      1. Select Options>Edit Page Content>Add Portlets.
      2. On the Add Portlets page, click Search and search for the Personal Repository Navigator.
      3. Check the Personal Repository Navigator box.
      4. Click Add and then click Done and OK.

    5. The WebDAV Navigator
    6. Follow these steps to add the WebDAV Navigator to your SAS Information Delivery Portal page:

      1. Select Options>Edit Page Content>Add Portlets.
      2. Under the Portlet type pulldown, select WebDAV Navigator.
      3. Click Add and then click Done and OK.
  5. When the SAS Stored Process is submitted, a message is returned to the browser window stating:
    Stored Process <stored process name> submitted for background processing.

    To change this message, you can create a Background.jsp file with custom text. See the Custom Responses for more information.

  6. When the SAS Stored Process competes execution, the following items occur:
    1. An alert message is added in the Stored Process Alert Portlet. You can click on the alert message to see your output.
    2. The output is stored on the SAS Content Server at:
      /sasdav/Users/<user name>/PR/MyDocuments
    3. You can also access your output via a Web browser outside of the SAS Information Delivery Portal. For example using your Web browser, reference an address similar to the following (where you specify your site–specific Web server and user account):
      http://your-server:8080/SASContentServer/repository/default/sasdav/Users/<user name>/PR/MyDocuments

      Then, select your *.spk output file, save it as a *.zip file and open it with a utility such as WinZip.

  7. For more information see the following resources:



Operating System and Release Information

Product FamilyProductSystemSAS Release
ReportedFixed*
SAS SystemSAS Integration Technologiesz/OS9.2 TS2M0
Microsoft® Windows® for 64-Bit Itanium-based Systems9.2 TS2M0
Microsoft Windows Server 2003 Datacenter 64-bit Edition9.2 TS2M0
Microsoft Windows Server 2003 Enterprise 64-bit Edition9.2 TS2M0
Microsoft Windows XP 64-bit Edition9.2 TS2M0
Microsoft® Windows® for x649.2 TS2M0
Microsoft Windows Server 2003 Datacenter Edition9.2 TS2M0
Microsoft Windows Server 2003 Enterprise Edition9.2 TS2M0
Microsoft Windows Server 2003 Standard Edition9.2 TS2M0
Microsoft Windows XP Professional9.2 TS2M0
Windows Vista9.2 TS2M0
64-bit Enabled AIX9.2 TS2M0
64-bit Enabled HP-UX9.2 TS2M0
64-bit Enabled Solaris9.2 TS2M0
HP-UX IPF9.2 TS2M0
Linux9.2 TS2M0
Linux for x649.2 TS2M0
OpenVMS on HP Integrity9.2 TS2M0
Solaris for x649.2 TS2M0
* For software releases that are not yet generally available, the Fixed Release is the software release in which the problem is planned to be fixed.