BookmarkSubscribeRSS Feed

Understanding the _action Parameter in the SAS Job Execution Web Application

Started 3 hours ago by
Modified 3 hours ago by
Views 51

The _action parameter is a powerful and flexible input used in the SAS Job Execution Web Application to control how jobs are executed, displayed, and managed. By specifying different values for _action, users can tailor the behavior of job execution to fit a wide range of scenarios, from displaying input forms to running jobs in the background or retrieving previous results.

 

Below, we detail each supported value for the _action parameter, as described in the official SAS documentation, and explain its usage.

 

 

Supported values for _action and their usage

 

1. execute

  • Usage: Runs the job immediately.
  • Description: This is the standard action to execute a job. When you specify _action=execute, the job is submitted for processing, and the output is returned to the client (typically the web browser).
  • Example:
    http://host:port/SASJobExecution/?_program=/SomeFolder/MyJob&_action=execute

 

2. form

  • Usage: Displays an HTML input form before job execution.
  • Description: When _action=form is specified, the application displays an HTML input form (if available) that allows users to enter parameters or other input before the job runs. This is useful for interactive jobs that require user input.
  • Example:
    http://host:port/SASJobExecution/?_program=/SomeFolder/MyJob&_action=form

 

3. prompts

  • Usage: Displays a prompt file before job execution.
  • Description: Similar to form, but specifically for XML prompt files. When _action=prompts is used, the application displays a prompt page for user input, typically defined in XML.
  • Example:
    http://host:port/SASJobExecution/?_program=/SomeFolder/MyJob&_action=prompts

 

4. background

  • Usage: Executes the job in the background.
  • Description: With _action=background, the job is submitted for execution, but the client does not wait for the job to finish. Instead, the job runs asynchronously, and the user can retrieve the results later.
  • Example:
    http://host:port/SASJobExecution/?_program=/SomeFolder/MyJob&_action=background

 

5. wait

  • Usage: Displays a wait screen with informational text while the job is executing.
  • Description: When _action=wait is specified, the application shows a "Please wait" message (or custom text) while the job runs. This is useful for long-running jobs where you want to inform the user that processing is ongoing.
  • Example:
    http://host:port/SASJobExecution/?_program=/SomeFolder/MyJob&_action=wait

 

6. lastjob

  • Usage: Displays output from a previous job execution if it has not yet expired.
  • Description: The _action=lastjob value allows users to retrieve and display the output from the most recent execution of a job, provided the output has not expired. This can improve performance and reduce server load for jobs with static or semi-static results.
  • Example:
    http://host:port/SASJobExecution/?_program=/SomeFolder/MyJob&_action=lastjob
  • Note: You can combine this with execute (e.g., _action=lastjob,execute) to force execution if no previous output exists.

 

7. schedule

  • Usage: Indicates that a job is to be scheduled.
  • Description: When _action=schedule is used, the job is prepared for scheduling rather than immediate execution. This is typically used in administrative or automated workflows.
  • Example:
    http://host:port/SASJobExecution/?_program=/SomeFolder/MyJob&_action=schedule

 

8. json

  • Usage: Returns a list of jobs or output files in JSON format.
  • Description: The _action=json value is used when programmatic access to job results or metadata is needed. Instead of returning HTML output, the application returns a JSON object with details about jobs or output files.
  • Example:
    http://host:port/SASJobExecution/?_program=/SomeFolder/MyJob&_action=json

 

How to use _action

 

The _ACTION parameter can be set in several ways:

 

XB_How_to_use_action.png

 

If you specify a value for _ACTION in the URL, it overrides any value set as a job definition parameter.

 

 

Combining _action values

 

You can specify multiple comma-separated values for _ACTION to combine behaviors. For example:

 

  • form,execute – Displays the form if it exists, otherwise executes the job.
  • lastjob,execute – Displays previous output if available, otherwise executes the job.
  • json,execute – Returns job output files as JSON and executes the job.

 

 

Examples

 

  • Display a form, then execute:

    XB_example1_2025-11-21_15-53-35.png

 

  • Display a form, then execute:

    XB_example2_2025-11-21_15-57-53.png

 

 

Advanced notes

 

  • Some _ACTION values (such as backgroundwaitlastjobschedule) are especially useful for automation, scheduling, and integration with other applications.
  • The _ACTION parameter can be used in conjunction with other parameters (such as _RESULTFILE_DEBUG_EXPIRATION) to further control job execution and output.
  • The default value for _ACTION is typically execute if not otherwise specified.

 

 

Reference table: _action values

 

Value Description
execute Executes the job immediately
form Displays an HTML input form before execution
prompts Displays a prompt file before execution
background Executes the job in the background
wait Displays a wait screen during execution
lastjob Displays previous job output if available
schedule Prepares the job for scheduling
json Returns job/output information in JSON format

 

 

Conclusion

The _action parameter is central to customizing how jobs are run and managed in the SAS Job Execution Web Application. By understanding and using the available values, users can create interactive, efficient, and user-friendly job execution workflows tailored to their needs. You can for example use the form value to display an HTML form and populate the src property of an iframe with the execute value to display both the form and the results on the same page. Mastering the _action parameter will clearly help you to build more advanced applications and tailor the Job Execution web application to your needs.

 

 

Find more articles from SAS Global Enablement and Learning here.

Contributors
Version history
Last update:
3 hours ago
Updated by:

SAS AI and Machine Learning Courses

The rapid growth of AI technologies is driving an AI skills gap and demand for AI talent. Ready to grow your AI literacy? SAS offers free ways to get started for beginners, business leaders, and analytics professionals of all skill levels. Your future self will thank you.

Get started

Article Tags