BookmarkSubscribeRSS Feed

Script to make a list of export targets for Viya's job flow.

Started ‎02-23-2022 by
Modified ‎02-24-2022 by
Views 1,845

After reading the article "Promoting SAS Viya Job Flows", I realized that I am a lazy person. Creating a JSON file that defines what to export is very time-consuming and can keep me focused if I only have to do it once. But if I needed to export many jobs many times, I thought I would write a script. And I managed to create a working script.


The example screenshot shows the procedure of exporting a test flow "ant-flow". You can specify the name or ID of the flow as an argument to the script. Please install the sas-viya CLI before running this script, this will not work with Viya 3.x.


The following shows how the script retrieves the desired ID and URI. First, get the ID of the flow from its name.



The next step is to use the ID of the flow as the key to search and get the URI of the flow and the jobs contained in the flow.



Retrieve the jobRequestUri by searching for Actions with the job ID as the key. The ID of the job flow is recursively broken down into jobs.



The script I attached is short and simple, and I think it can be easily modified. If you could point out any errors, I would be very grateful.

Version history
Last update:
‎02-24-2022 06:05 AM
Updated by:



Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

Free course: Data Literacy Essentials

Data Literacy is for all, even absolute beginners. Jump on board with this free e-learning  and boost your career prospects.

Get Started

Article Tags