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:
SAS Studio, the premier web-based development environment in SAS Viya, allows job scheduling by:
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:
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:
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.
More information on the Jobs and Flows capability in SAS Environment Manager can be found here: SAS Viya Environment Manager: Jobs and Flows
SAS Viya exposes REST APIs that support programmatic control over job scheduling. This method enables:
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
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:
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:
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.
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:
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.
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
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
Job request state is Completed so we know that it was executed.
SAS Viya jobs can be orchestrated with enterprise-level schedulers such as:
To compare between Airflow and SAS Viya internal scheduling and orchestration, this table will highlight the the differences:
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
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” 🎄
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
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.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!