<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Juletip #8 - Orchestrate your SAS jobs like Santa’s workshop! in SAS Community Nordic</title>
    <link>https://communities.sas.com/t5/SAS-Community-Nordic/Juletip-8-Orchestrate-your-SAS-jobs-like-Santa-s-workshop/m-p/980356#M512</link>
    <description>&lt;P&gt;&lt;FONT size="5"&gt;&lt;STRONG&gt;A Festive Overview of Scheduling Options in SAS Viya&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;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!&lt;/P&gt;
&lt;P&gt;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:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jarno_0-1765176955984.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/111998i5C298B72D68AAA45/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jarno_0-1765176955984.png" alt="jarno_0-1765176955984.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;H2&gt;&amp;nbsp;&lt;/H2&gt;
&lt;H2&gt;&lt;STRONG&gt;1. Scheduling Jobs in SAS Studio&lt;/STRONG&gt;&lt;/H2&gt;
&lt;P&gt;SAS Studio, the premier web-based development environment in SAS Viya, allows job scheduling by:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Simply right-clicking on a program and selecting "Schedule."&lt;/LI&gt;
&lt;LI&gt;Using time trigger for defining frequency and time for execution.&lt;/LI&gt;
&lt;LI&gt;Tracking scheduled and executed jobs within the interface&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jarno_1-1765177062171.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/111999iD10F77EB35B36BD5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jarno_1-1765177062171.png" alt="jarno_1-1765177062171.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;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: &lt;A href="https://go.documentation.sas.com/doc/en/sasstudiocdc/v_069/webeditorcdc/webeditorjobsdg/n1xetnjuo4xyp3n1vlaf9dhqom9u.htm" target="_blank" rel="noopener"&gt;Scheduling and Deploying a SAS Job&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="5"&gt;&lt;STRONG&gt;2. Scheduling via SAS Environment Manager in Jobs and Flows&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;SAS Environment Manager provides a more advanced graphical interface for managing run schedules. Users can:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Monitor and schedule job requests from a variety of sources on the SAS Viya platform.&lt;/LI&gt;
&lt;/UL&gt;
&lt;UL&gt;
&lt;LI&gt;Graphical design of multi-step workflows with conditions and branching, which can contain multiple job requests (via job actions) and conditions.&lt;/LI&gt;
&lt;/UL&gt;
&lt;UL&gt;
&lt;LI&gt;Schedule job requests or job flows to run at a specific time or in response to a specific trigger.&lt;/LI&gt;
&lt;LI&gt;Edit an existing job request or job flow.&lt;/LI&gt;
&lt;LI&gt;Create a job request from a SAS DATA step program.&lt;/LI&gt;
&lt;LI&gt;View the execution history of a job instance or a job flow.&lt;/LI&gt;
&lt;LI&gt;Unschedule, delete, and view the properties of a job instance or job flow.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;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:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jarno_2-1765177236262.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/112000i3C49E6330D8F16F5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jarno_2-1765177236262.png" alt="jarno_2-1765177236262.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;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.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jarno_3-1765177301690.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/112001i52B67299332D9F49/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jarno_3-1765177301690.png" alt="jarno_3-1765177301690.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;More information on the Jobs and Flows capability in SAS Environment Manager can be found here: &lt;A href="https://go.documentation.sas.com/doc/en/sasadmincdc/v_070/evfun/n0b9cf8ru47gp6n1lvamxqwbr3by.htm" target="_blank" rel="noopener"&gt;SAS Viya Environment Manager: Jobs and Flows&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H2&gt;&lt;STRONG&gt;3. Using REST APIs for Job Execution&lt;/STRONG&gt;&lt;/H2&gt;
&lt;P&gt;SAS Viya exposes REST APIs that support programmatic control over job scheduling. This method enables:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Automated submission and scheduling via scripts and external applications.&lt;/LI&gt;
&lt;LI&gt;Integration with orchestration or DevOps tools.&lt;/LI&gt;
&lt;LI&gt;Retrieval of job status and logs programmatically.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;SAS Viya REST APIs are thoroughly documented and for example, the /jobExecution endpoint is described here: &lt;A href="https://developer.sas.com/rest-apis?categories=compute_and_jobs" target="_blank" rel="noopener"&gt;SAS Viya REST APIs - Compute and Jobs&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;In this example we first create a BASE_URI variable by extracting it with &lt;EM&gt;sysfunc(getoption(servicesbaseurl&lt;/EM&gt;&lt;/P&gt;
&lt;H2&gt;&lt;FONT size="3"&gt;Then assign a filename for the response JSON.&lt;/FONT&gt;&lt;/H2&gt;
&lt;P&gt;For the actual REST call we use the&lt;EM&gt; /jobExecution/jobRequests&lt;/EM&gt; endpoint and point it to a specific job with &amp;lt;JOBID&amp;gt; parameter. This ID is somthing that you can acquire in many ways, for example in the &lt;EM&gt;Submissions and Job Status &lt;/EM&gt;tool in SAS Studio:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jarno_4-1765177659429.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/112002i1CB955395D89506B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jarno_4-1765177659429.png" alt="jarno_4-1765177659429.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;The code looks like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%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="&amp;amp;BASE_URI/jobExecution/jobRequests/&amp;lt;JOBID&amp;gt;/jobs"
   method='POST'
   oauth_bearer=sas_services
   out=resp ;
run;

libname resp json;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;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.&lt;/P&gt;
&lt;P&gt;To verify that my job was actually executed, I can check the Jobs and Submission tab again:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jarno_5-1765177829693.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/112003i4E93E159AA50F1D9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jarno_5-1765177829693.png" alt="jarno_5-1765177829693.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;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.&lt;/P&gt;
&lt;H2&gt;&amp;nbsp;&lt;/H2&gt;
&lt;H2&gt;&lt;STRONG&gt;4. Scheduling via CLI with sas-viya command&lt;/STRONG&gt;&lt;/H2&gt;
&lt;P&gt;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:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Submitting jobs and managing schedules using command-line commands.&lt;/LI&gt;
&lt;LI&gt;Scripting and automating job scheduling as part of batch processes or CI/CD pipelines.&lt;/LI&gt;
&lt;LI&gt;Integrating with operating system task schedulers (e.g., crontab, Windows Task Scheduler) to invoke sas-viya commands at specified times.&lt;/LI&gt;
&lt;LI&gt;Listing, updating, or deleting scheduled jobs through CLI options.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;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.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jarno_6-1765177964490.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/112004iE82FDB58E33773ED/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jarno_6-1765177964490.png" alt="jarno_6-1765177964490.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;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.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;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 &lt;EM&gt;job requests execute &lt;/EM&gt;&amp;nbsp;command. The job runs immediately.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;sas-viya job requests execute --id request-ID&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jarno_7-1765178115417.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/112005iB048DF3B96A5BFFE/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jarno_7-1765178115417.png" alt="jarno_7-1765178115417.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;We could go to &lt;EM&gt;Jobs and Submission &lt;/EM&gt;interface again, but as we are already in the CLI, we can use the same &lt;STRONG&gt;job-request ID &lt;/STRONG&gt;to obtain status of that executed job request with command:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;sas-viya job requests list-history --id request-ID&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jarno_8-1765178198701.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/112006i083999AD236624EB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jarno_8-1765178198701.png" alt="jarno_8-1765178198701.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Job request state is &lt;EM&gt;Completed &lt;/EM&gt;so we know that it was executed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H2&gt;&lt;STRONG&gt;5. Integration with External Schedulers: SAS Provider for Airflow&lt;/STRONG&gt;&lt;/H2&gt;
&lt;P&gt;SAS Viya jobs can be orchestrated with enterprise-level schedulers such as:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Crontab (Linux/UNIX): Schedule shell scripts that submit jobs to SAS Viya.&lt;/LI&gt;
&lt;LI&gt;Third-party tools (e.g., &lt;STRONG&gt;Apache Airflow&lt;/STRONG&gt;, Control-M): Manage job workflows via APIs, CLI, or custom connectors.&lt;/LI&gt;
&lt;LI&gt;Apache Airflow has seen wide acceptance and is used for complex prchestration tasks in many organizations. SAS now provides an integration with &lt;A href="https://github.com/sassoftware/sas-airflow-provider" target="_blank" rel="noopener"&gt;&lt;STRONG&gt;SAS Airflow Provider&lt;/STRONG&gt;&lt;/A&gt; which you use to create Airflow DAGs to orchestrate and execute SAS Studio Flows and Jobs.&lt;/LI&gt;
&lt;LI&gt;SAS also provides Custom Steps to help in the creation of Airflow DAGs from SAS jobs or Flows in the publicly available &lt;A href="https://github.com/sassoftware/sas-studio-custom-steps/tree/main/Airflow%20-%20Generate%20DAG" target="_blank" rel="noopener"&gt;Github repository of SAS Studio Custom Steps&lt;/A&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jarno_9-1765178381397.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/112007i0E8ECB3338155F2D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jarno_9-1765178381397.png" alt="jarno_9-1765178381397.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;To compare between Airflow and SAS Viya internal scheduling and orchestration, this table will highlight the the differences:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jarno_10-1765178468494.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/112008iA2F14DD14D0196E1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jarno_10-1765178468494.png" alt="jarno_10-1765178468494.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;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: &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/SAS-Viya-and-Apache-Airflow-in-Kubernetes-A-Peaceful-Coexistence/ta-p/874152" target="_blank" rel="noopener"&gt;SAS Viya and Apache Airflow in Kubernetes: A Peaceful Coexistence&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H2&gt;&lt;STRONG&gt;Conclusion&lt;/STRONG&gt;&lt;/H2&gt;
&lt;P&gt;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”&amp;nbsp;&lt;FONT size="5"&gt;&lt;STRONG&gt;&lt;span class="lia-unicode-emoji" title=":christmas_tree:"&gt;🎄&lt;/span&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 09 Dec 2025 06:59:35 GMT</pubDate>
    <dc:creator>jarno</dc:creator>
    <dc:date>2025-12-09T06:59:35Z</dc:date>
    <item>
      <title>Juletip #8 - Orchestrate your SAS jobs like Santa’s workshop!</title>
      <link>https://communities.sas.com/t5/SAS-Community-Nordic/Juletip-8-Orchestrate-your-SAS-jobs-like-Santa-s-workshop/m-p/980356#M512</link>
      <description>&lt;P&gt;&lt;FONT size="5"&gt;&lt;STRONG&gt;A Festive Overview of Scheduling Options in SAS Viya&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;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!&lt;/P&gt;
&lt;P&gt;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:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jarno_0-1765176955984.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/111998i5C298B72D68AAA45/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jarno_0-1765176955984.png" alt="jarno_0-1765176955984.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;H2&gt;&amp;nbsp;&lt;/H2&gt;
&lt;H2&gt;&lt;STRONG&gt;1. Scheduling Jobs in SAS Studio&lt;/STRONG&gt;&lt;/H2&gt;
&lt;P&gt;SAS Studio, the premier web-based development environment in SAS Viya, allows job scheduling by:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Simply right-clicking on a program and selecting "Schedule."&lt;/LI&gt;
&lt;LI&gt;Using time trigger for defining frequency and time for execution.&lt;/LI&gt;
&lt;LI&gt;Tracking scheduled and executed jobs within the interface&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jarno_1-1765177062171.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/111999iD10F77EB35B36BD5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jarno_1-1765177062171.png" alt="jarno_1-1765177062171.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;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: &lt;A href="https://go.documentation.sas.com/doc/en/sasstudiocdc/v_069/webeditorcdc/webeditorjobsdg/n1xetnjuo4xyp3n1vlaf9dhqom9u.htm" target="_blank" rel="noopener"&gt;Scheduling and Deploying a SAS Job&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="5"&gt;&lt;STRONG&gt;2. Scheduling via SAS Environment Manager in Jobs and Flows&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;SAS Environment Manager provides a more advanced graphical interface for managing run schedules. Users can:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Monitor and schedule job requests from a variety of sources on the SAS Viya platform.&lt;/LI&gt;
&lt;/UL&gt;
&lt;UL&gt;
&lt;LI&gt;Graphical design of multi-step workflows with conditions and branching, which can contain multiple job requests (via job actions) and conditions.&lt;/LI&gt;
&lt;/UL&gt;
&lt;UL&gt;
&lt;LI&gt;Schedule job requests or job flows to run at a specific time or in response to a specific trigger.&lt;/LI&gt;
&lt;LI&gt;Edit an existing job request or job flow.&lt;/LI&gt;
&lt;LI&gt;Create a job request from a SAS DATA step program.&lt;/LI&gt;
&lt;LI&gt;View the execution history of a job instance or a job flow.&lt;/LI&gt;
&lt;LI&gt;Unschedule, delete, and view the properties of a job instance or job flow.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;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:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jarno_2-1765177236262.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/112000i3C49E6330D8F16F5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jarno_2-1765177236262.png" alt="jarno_2-1765177236262.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;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.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jarno_3-1765177301690.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/112001i52B67299332D9F49/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jarno_3-1765177301690.png" alt="jarno_3-1765177301690.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;More information on the Jobs and Flows capability in SAS Environment Manager can be found here: &lt;A href="https://go.documentation.sas.com/doc/en/sasadmincdc/v_070/evfun/n0b9cf8ru47gp6n1lvamxqwbr3by.htm" target="_blank" rel="noopener"&gt;SAS Viya Environment Manager: Jobs and Flows&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H2&gt;&lt;STRONG&gt;3. Using REST APIs for Job Execution&lt;/STRONG&gt;&lt;/H2&gt;
&lt;P&gt;SAS Viya exposes REST APIs that support programmatic control over job scheduling. This method enables:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Automated submission and scheduling via scripts and external applications.&lt;/LI&gt;
&lt;LI&gt;Integration with orchestration or DevOps tools.&lt;/LI&gt;
&lt;LI&gt;Retrieval of job status and logs programmatically.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;SAS Viya REST APIs are thoroughly documented and for example, the /jobExecution endpoint is described here: &lt;A href="https://developer.sas.com/rest-apis?categories=compute_and_jobs" target="_blank" rel="noopener"&gt;SAS Viya REST APIs - Compute and Jobs&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;In this example we first create a BASE_URI variable by extracting it with &lt;EM&gt;sysfunc(getoption(servicesbaseurl&lt;/EM&gt;&lt;/P&gt;
&lt;H2&gt;&lt;FONT size="3"&gt;Then assign a filename for the response JSON.&lt;/FONT&gt;&lt;/H2&gt;
&lt;P&gt;For the actual REST call we use the&lt;EM&gt; /jobExecution/jobRequests&lt;/EM&gt; endpoint and point it to a specific job with &amp;lt;JOBID&amp;gt; parameter. This ID is somthing that you can acquire in many ways, for example in the &lt;EM&gt;Submissions and Job Status &lt;/EM&gt;tool in SAS Studio:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jarno_4-1765177659429.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/112002i1CB955395D89506B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jarno_4-1765177659429.png" alt="jarno_4-1765177659429.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;The code looks like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%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="&amp;amp;BASE_URI/jobExecution/jobRequests/&amp;lt;JOBID&amp;gt;/jobs"
   method='POST'
   oauth_bearer=sas_services
   out=resp ;
run;

libname resp json;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;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.&lt;/P&gt;
&lt;P&gt;To verify that my job was actually executed, I can check the Jobs and Submission tab again:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jarno_5-1765177829693.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/112003i4E93E159AA50F1D9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jarno_5-1765177829693.png" alt="jarno_5-1765177829693.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;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.&lt;/P&gt;
&lt;H2&gt;&amp;nbsp;&lt;/H2&gt;
&lt;H2&gt;&lt;STRONG&gt;4. Scheduling via CLI with sas-viya command&lt;/STRONG&gt;&lt;/H2&gt;
&lt;P&gt;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:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Submitting jobs and managing schedules using command-line commands.&lt;/LI&gt;
&lt;LI&gt;Scripting and automating job scheduling as part of batch processes or CI/CD pipelines.&lt;/LI&gt;
&lt;LI&gt;Integrating with operating system task schedulers (e.g., crontab, Windows Task Scheduler) to invoke sas-viya commands at specified times.&lt;/LI&gt;
&lt;LI&gt;Listing, updating, or deleting scheduled jobs through CLI options.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;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.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jarno_6-1765177964490.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/112004iE82FDB58E33773ED/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jarno_6-1765177964490.png" alt="jarno_6-1765177964490.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;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.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;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 &lt;EM&gt;job requests execute &lt;/EM&gt;&amp;nbsp;command. The job runs immediately.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;sas-viya job requests execute --id request-ID&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jarno_7-1765178115417.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/112005iB048DF3B96A5BFFE/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jarno_7-1765178115417.png" alt="jarno_7-1765178115417.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;We could go to &lt;EM&gt;Jobs and Submission &lt;/EM&gt;interface again, but as we are already in the CLI, we can use the same &lt;STRONG&gt;job-request ID &lt;/STRONG&gt;to obtain status of that executed job request with command:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;sas-viya job requests list-history --id request-ID&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jarno_8-1765178198701.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/112006i083999AD236624EB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jarno_8-1765178198701.png" alt="jarno_8-1765178198701.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Job request state is &lt;EM&gt;Completed &lt;/EM&gt;so we know that it was executed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H2&gt;&lt;STRONG&gt;5. Integration with External Schedulers: SAS Provider for Airflow&lt;/STRONG&gt;&lt;/H2&gt;
&lt;P&gt;SAS Viya jobs can be orchestrated with enterprise-level schedulers such as:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Crontab (Linux/UNIX): Schedule shell scripts that submit jobs to SAS Viya.&lt;/LI&gt;
&lt;LI&gt;Third-party tools (e.g., &lt;STRONG&gt;Apache Airflow&lt;/STRONG&gt;, Control-M): Manage job workflows via APIs, CLI, or custom connectors.&lt;/LI&gt;
&lt;LI&gt;Apache Airflow has seen wide acceptance and is used for complex prchestration tasks in many organizations. SAS now provides an integration with &lt;A href="https://github.com/sassoftware/sas-airflow-provider" target="_blank" rel="noopener"&gt;&lt;STRONG&gt;SAS Airflow Provider&lt;/STRONG&gt;&lt;/A&gt; which you use to create Airflow DAGs to orchestrate and execute SAS Studio Flows and Jobs.&lt;/LI&gt;
&lt;LI&gt;SAS also provides Custom Steps to help in the creation of Airflow DAGs from SAS jobs or Flows in the publicly available &lt;A href="https://github.com/sassoftware/sas-studio-custom-steps/tree/main/Airflow%20-%20Generate%20DAG" target="_blank" rel="noopener"&gt;Github repository of SAS Studio Custom Steps&lt;/A&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jarno_9-1765178381397.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/112007i0E8ECB3338155F2D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jarno_9-1765178381397.png" alt="jarno_9-1765178381397.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;To compare between Airflow and SAS Viya internal scheduling and orchestration, this table will highlight the the differences:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jarno_10-1765178468494.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/112008iA2F14DD14D0196E1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jarno_10-1765178468494.png" alt="jarno_10-1765178468494.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;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: &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/SAS-Viya-and-Apache-Airflow-in-Kubernetes-A-Peaceful-Coexistence/ta-p/874152" target="_blank" rel="noopener"&gt;SAS Viya and Apache Airflow in Kubernetes: A Peaceful Coexistence&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H2&gt;&lt;STRONG&gt;Conclusion&lt;/STRONG&gt;&lt;/H2&gt;
&lt;P&gt;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”&amp;nbsp;&lt;FONT size="5"&gt;&lt;STRONG&gt;&lt;span class="lia-unicode-emoji" title=":christmas_tree:"&gt;🎄&lt;/span&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Dec 2025 06:59:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Community-Nordic/Juletip-8-Orchestrate-your-SAS-jobs-like-Santa-s-workshop/m-p/980356#M512</guid>
      <dc:creator>jarno</dc:creator>
      <dc:date>2025-12-09T06:59:35Z</dc:date>
    </item>
    <item>
      <title>Re: Juletip #8 - Orchestrate your SAS jobs like Santa’s workshop!</title>
      <link>https://communities.sas.com/t5/SAS-Community-Nordic/Juletip-8-Orchestrate-your-SAS-jobs-like-Santa-s-workshop/m-p/980549#M518</link>
      <description>&lt;P&gt;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).&amp;nbsp; You can also&amp;nbsp;&lt;SPAN&gt;edit the scheduled job's arguments or source code&lt;/SPAN&gt;.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://documentation.sas.com/doc/" target="_blank"&gt;https://documentation.sas.com/doc/&lt;/A&gt;cs/pgmsascdc/v_069/jobexecug/n1gt4ch06ktkzbn1qis2t6zislpv.htm&lt;/P&gt;</description>
      <pubDate>Wed, 10 Dec 2025 13:27:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Community-Nordic/Juletip-8-Orchestrate-your-SAS-jobs-like-Santa-s-workshop/m-p/980549#M518</guid>
      <dc:creator>DeMer</dc:creator>
      <dc:date>2025-12-10T13:27:21Z</dc:date>
    </item>
    <item>
      <title>Re: Juletip #8 - Orchestrate your SAS jobs like Santa’s workshop!</title>
      <link>https://communities.sas.com/t5/SAS-Community-Nordic/Juletip-8-Orchestrate-your-SAS-jobs-like-Santa-s-workshop/m-p/980700#M521</link>
      <description>&lt;P&gt;Thanks a lot&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/464041"&gt;@DeMer&lt;/a&gt;&amp;nbsp;for pointing this out&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;&amp;nbsp;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.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Dec 2025 07:55:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Community-Nordic/Juletip-8-Orchestrate-your-SAS-jobs-like-Santa-s-workshop/m-p/980700#M521</guid>
      <dc:creator>jarno</dc:creator>
      <dc:date>2025-12-12T07:55:12Z</dc:date>
    </item>
  </channel>
</rss>

