BookmarkSubscribeRSS Feed

SAS Viya Jobs in a SAS Visual Analytics report

Started ‎05-05-2021 by
Modified ‎05-05-2021 by
Views 8,040

If you are unfamiliar with Jobs in SAS Viya then check out Gerry Nelson’s article: Jobs: Stored processes in Viya.


Essentially it’s the new way to submit code to be processed by one of SAS’ analytic engines. There many use cases that can be solved using Viya Jobs, here are a few articles that cover a variety of examples:

This article will cover the three ways you can include a Job in a SAS Visual Analytics report: Job Content object, Web Content object or Data-Driven Content object.

Example Viya Job Used

The Viya Job I will be using for this article is a vanilla flavored, no frills job. This means that this job isn’t surfacing any fancy custom web application code or model scoring in the background.


The example job makes use of the SASHELP.CARS data source and uses XML to build the Task prompts. There are two prompts: one for Make and one for Type and the results are streamed using the _output_type of ods_html5.


Could the below behavior be modified for a more seamless integration of the Viya Job, absolutely. Take a look at the examples listed at the top or bottom of this article for more in-depth examples.

Job Content Object

Introduced in the April stable release of SAS Viya (2020.1.5) is the Job Content object that will display the output from SAS Viya Jobs.


Adding the object to the report canvas and navigating to your desired Job is straight forward.


Use the Object pane and add the Job content object to the report.



Select any image to see a larger version.
Mobile users: To view the images, select the "Full" version at the bottom of the page.


Next, use either the Select a job. button from the object or the Browse button from the Options pane to navigate to the desired Viya Job.




In this example, the Viya Job has default values assigned to the two prompts which are used for the initial execution. The results are displayed in SAS VA report in the Job content object.




Use the object’s overflow menu and select Set job parameters… to bring up the dialogue to select different prompt values. When you click Close the job is executed.




Configuration tip: To ensure the best performance, adjust the minimum number of SAS Compute servers available to your environment. This will save time so that when the SAS VA report is opened and the Viya Job needs to execute, time is not spent waiting for a SAS Compute server to be spun up. See the SAS Viya Administration Documentation under Configure a Pool of Available Servers.

Web Content Object

The second way you can show results of a Viya Job in a SAS VA report is using the Web content object.




Once the object is added to the VA report, use the Options pane and replace the default URL value with your SAS Viya Job URL.




You can get the Viya Job URL from SAS Studio’s Properties pane.




You can see that using the Web content object displays the Job’s prompt form in the VA report window. After you make your selections, the default values are pre-populated here, the results open in a new browser window.






If you see this error: Popups must be enabled




Then follow the instructions for adding the allow-popups to the sas.visualanalytics IFrame Sandbox Attribute Value property as described under the SAS Visual Analytics Documentation: Configuration Properties for SAS Visual Analytics. This note is also mentioned under the Working with Job Content.




Remember you could code a more custom web application that surfaces an HTML form with both the prompts and Job results in the same window. For more examples, take a look at Mike's articles mentioned earlier:

Data-Driven Content Object

For this object, when using a "typical" Viya Job, it behaves like the Web Content object. That is once you define the URL Option property the results will open in a new tab.




The one main difference is that the Data-driven content object requires a Role assignment.






The true power behind the Data-driven content object is that you can essentially surface a custom web application and as many of our dedicated coders know, this can be achieved through a Viya Job. Take a look at some of Xavier’s articles mentioned earlier for integrating both Viya Jobs and the Data-driven content object.

  • Xavier Bizoux’s: Data Entry in SAS Visual Analytics 8.1 Series: Part 1 | Part 2 | Part 3 | YouTube
  • Xavier Bizoux’s: VA Report Example: Geographic data, SAS Viya Jobs, Data Driven Content, and REST APIs! Article | YouTube


Let’s outline the important takeaways for our options for executing Viya Jobs in a SAS VA report:

  • Job content object
    • Job results are displayed inside the SAS VA report, not in a separate browser tab
    • You must use the object’s overflow menu to open the prompt window to select different prompt values
  • Web content object
    • Prompt window is displayed inside the SAS VA report
    • Using default configuration, job results are displayed in a separate browser tab
    • Able to customize Viya Job code to be rendered as an HTML page with the ability to surface both prompts and results inside the SAS VA report.
  • Data-driven content object
    • Using default configuration, the prompt window is displayed inside the SAS VA report
    • Using default configuration, the job results are displayed in a separate browser tab
    • Able to customize Viya Job code to be rendered as an HTML page with the ability to surface both prompts and results inside the SAS VA report.

Regardless of the object you use to display the results of your Viya Job, be sure to get the most from your environment by making sure these configurations are set:




I love the possibilities that arise from using viya jobs.I use them to score new data or to transpose the data.

And I'm wondering if I can display back to the report a graph generated via job and proc sgplot.

I know how to pass the data with DDC and use json to write it to a table and run proc sgplot.

But how can I achieve that the graph displays inside the ddc object itself?


Based on my understanding of your question, you have a web page that is displayed in the DDC object. You are passing data to the web page and the data are then used to call a Viya Job. The step you are missing is how-to display the generated image in the web page without overwriting the actual web page with an html output streamed from the job. 

If my understanding is correct, I think the following example will help you in the process of retrieving an image generated by a SAS Viya Job:

In the example, you will see how you can generate multiple output files using a job. The biggest difference with the example is the way you will return the reference to your image. The reference should be returned as a JSON object. This way you will be able to further process the image in the web page displayed in the DDC object. 

Let me know if you need more information. 





Hey @XavierBizoux ,

when I go into VA, and look under Objects/content I do not see the Job Content option. We have SAS viya V.03.05M0P111119, is this option not available in this release?



@jimbobob  - Looks like you are using Viya 3.5. The functionality in the article was introduced in Viya 4 aka Viya 2020.1.5.

Hi @jimbobob

The Job content object is only available as from Viya 2020.1.5 stable release.

In Viya 3.5, the best option is to use the Data-Driven Content object. It will add some extra functionalities compared to Web Content object.



I always like reading your article. Is there an OOTB dynamic interaction between VA report objects and objects created by SAS Job Execution? I saw a couple of blogs and videos from Xavier, and he is using javascript for the magic.

Hi @pritesh_sas , 

Thank you for the positive comment. 

There is no interaction out-of-the-box between VA report object and SAS Job Execution object. The only option is to use a Data-Driven Content object and to build a custom web page to handle the parameters collection and the job execution. The logic will be to pass data from the VA report to the DDC object for example when you select a row in a list table. Then the web page used for the DDC object will manipulate the data and send the request to the Job Execution which will execute and return the result. You have different options to launch the job, you trigger the job execution as soon as the data selection changes without user interaction in the DDC object. Or you populate a form in the DDC object and the user needs to trigger the execution by clicking on a submit button for example. 

I hope this helps you. 

If you have questions, please don't hesitate to contact me. 



Version history
Last update:
‎05-05-2021 01:26 PM
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