BookmarkSubscribeRSS Feed
jarno
SAS Employee

A Festive Overview of Scheduling Options in SAS Viya

 

Just as the holiday season brings joy, anticipation, and the magic of preparation, SAS Viya offers a festive array of scheduling options to help you orchestrate your analytical jobs with the precision of elves assembling gifts in Santa’s workshop. Whether you’re wrapping up data workflows or decking the halls with automated processes, mastering these scheduling methods ensures your SAS sleigh runs smoothly all year round!

Now I do realize that thoroughly explaining even one of these would be worthy of a blog or even a series of blogs. What I’m aiming at is to give an overview of the five topmost methods for executing and orchestrating SAS jobs and flows. These examples were gathered using SAS Viya 2025.10. Here’s the five most popular ways to schedule and orchestrate that I managed to cram into this Juletip:

jarno_0-1765176955984.png

 

1. Scheduling Jobs in SAS Studio

SAS Studio, the premier web-based development environment in SAS Viya, allows job scheduling by:

  • Simply right-clicking on a program and selecting "Schedule."
  • Using time trigger for defining frequency and time for execution.
  • Tracking scheduled and executed jobs within the interface

jarno_1-1765177062171.png

This is is by far the simplest way to schedule a SAS code or SAS Studio Flow, just and point and click and run it according to your schedule. For more information on scheduling inside SAS Studio, have a look here: Scheduling and Deploying a SAS Job

 

2. Scheduling via SAS Environment Manager in Jobs and Flows

SAS Environment Manager provides a more advanced graphical interface for managing run schedules. Users can:

  • Monitor and schedule job requests from a variety of sources on the SAS Viya platform.
  • Graphical design of multi-step workflows with conditions and branching, which can contain multiple job requests (via job actions) and conditions.
  • Schedule job requests or job flows to run at a specific time or in response to a specific trigger.
  • Edit an existing job request or job flow.
  • Create a job request from a SAS DATA step program.
  • View the execution history of a job instance or a job flow.
  • Unschedule, delete, and view the properties of a job instance or job flow.

It is based on job-definitions and job-requests that are used to call actual SAS codes and job flows, as depicted in the image below:

jarno_2-1765177236262.png

Job Flows can be created in the Job Flow editor by dragging deployed jobs into the workflow. AND and OR gates provide parallelism and dependencies. Triggers are either time-events or file-events.

jarno_3-1765177301690.png

More information on the Jobs and Flows capability in SAS Environment Manager can be found here: SAS Viya Environment Manager: Jobs and Flows

 

3. Using REST APIs for Job Execution

SAS Viya exposes REST APIs that support programmatic control over job scheduling. This method enables:

  • Automated submission and scheduling via scripts and external applications.
  • Integration with orchestration or DevOps tools.
  • Retrieval of job status and logs programmatically.

SAS Viya REST APIs are thoroughly documented and for example, the /jobExecution endpoint is described here: SAS Viya REST APIs - Compute and Jobs

In this example we first create a BASE_URI variable by extracting it with sysfunc(getoption(servicesbaseurl

Then assign a filename for the response JSON.

For the actual REST call we use the /jobExecution/jobRequests endpoint and point it to a specific job with <JOBID> parameter. This ID is somthing that you can acquire in many ways, for example in the Submissions and Job Status tool in SAS Studio:

jarno_4-1765177659429.png

The code looks like this:

%let BASE_URI=%sysfunc(getoption(servicesbaseurl)); 

filename resp clear;
filename resp temp;
libname resp clear;

*** Execute a SAS job with a specific job ID ***;
proc http url="&BASE_URI/jobExecution/jobRequests/<JOBID>/jobs"
   method='POST'
   oauth_bearer=sas_services
   out=resp ;
run;

libname resp json;

Note that for OAUTH_BEARER I’m using SAS_SERVICES. It works as I’m already logged in SAS Viya. The SAS_SERVICES keyword specified in the OAUTH_BEARER option ensures that an access token is obtained using the identity of the user executing the job.

To verify that my job was actually executed, I can check the Jobs and Submission tab again:

jarno_5-1765177829693.png

So to wrap this part up, I can call this REST API endpoint to execute a SAS job from any REST client, just need to know the JOB ID and make sure that I’m properly authenticated to the SAS Viya platform.

 

4. Scheduling via CLI with sas-viya command

SAS Viya offers a Command Line Interface (CLI) utility called sas-viya that allows users to manage and schedule jobs directly from the terminal. Key capabilities include:

  • Submitting jobs and managing schedules using command-line commands.
  • Scripting and automating job scheduling as part of batch processes or CI/CD pipelines.
  • Integrating with operating system task schedulers (e.g., crontab, Windows Task Scheduler) to invoke sas-viya commands at specified times.
  • Listing, updating, or deleting scheduled jobs through CLI options.

This approach is especially useful for advanced users who wish to automate tasks outside the graphical interface, or who are integrating SAS Viya jobs into larger automated workflows.

jarno_6-1765177964490.png

In this image we can see that two plugins are installed: audit and job. Job plugin is the one we of course need to operate SAS jobs from the sas-viya CLI.

 

Borrowing from the REST example above, we can use the same JOB ID we learned and used for the REST call here as well: To execute a job using SAS Viya CLI we can use the job requests execute  command. The job runs immediately.

sas-viya job requests execute --id request-ID

jarno_7-1765178115417.png

We could go to Jobs and Submission interface again, but as we are already in the CLI, we can use the same job-request ID to obtain status of that executed job request with command:

sas-viya job requests list-history --id request-ID

jarno_8-1765178198701.png

Job request state is Completed so we know that it was executed.

 

5. Integration with External Schedulers: SAS Provider for Airflow

SAS Viya jobs can be orchestrated with enterprise-level schedulers such as:

  • Crontab (Linux/UNIX): Schedule shell scripts that submit jobs to SAS Viya.
  • Third-party tools (e.g., Apache Airflow, Control-M): Manage job workflows via APIs, CLI, or custom connectors.
  • Apache Airflow has seen wide acceptance and is used for complex prchestration tasks in many organizations. SAS now provides an integration with SAS Airflow Provider which you use to create Airflow DAGs to orchestrate and execute SAS Studio Flows and Jobs.
  • SAS also provides Custom Steps to help in the creation of Airflow DAGs from SAS jobs or Flows in the publicly available Github repository of SAS Studio Custom Steps

jarno_9-1765178381397.png

To compare between Airflow and SAS Viya internal scheduling and orchestration, this table will highlight the the differences:

jarno_10-1765178468494.png

I will not dive deeper into SAS and Airflow integration in this Juletip, but for those interested, this post is a great place to start: SAS Viya and Apache Airflow in Kubernetes: A Peaceful Coexistence

 

Conclusion

Much like a well-coordinated Christmas celebration—where every light twinkles on cue and every present arrives at the perfect moment—SAS Viya’s rich set of scheduling tools ensures your analytics run like clockwork. By using these flexible options, you can keep your data-driven operations merry and bright all year, ensuring that no matter the season, your organization’s jobs will always execute with priority “nice” 🎄

2 REPLIES 2
DeMer
Obsidian | Level 7

The SAS Job Execution Web Application can also be used to schedule jobs. You can schedule either job definitions (before a job has been run) or job execution objects (after a job was run).  You can also edit the scheduled job's arguments or source code.

https://documentation.sas.com/doc/cs/pgmsascdc/v_069/jobexecug/n1gt4ch06ktkzbn1qis2t6zislpv.htm

jarno
SAS Employee

Thanks a lot @DeMer for pointing this out 👍 The SAS Job Execution Web Application is a powerful tool and I feel the SAS9 Stored Process devs will feel right at home in that one. I'll save this for my next update on orchestration in SAS Viya.