BookmarkSubscribeRSS Feed

Custom Task Tuesday: SAS Studio on Viya Intro

Started ‎08-21-2018 by
Modified ‎08-21-2018 by
Views 1,932

The Custom Task Tuesday article series is back, but reinvented. Previous #CustomTaskTuesday posts were about SAS Studio on SAS version 9. This post kicks off a series focused on transitioning from V9 to Viya, as well as using V9 and Viya code seamlessly together in one Custom Task.


Custom Task Tuesday.jpgLook for weekly posts leading up to Analytics Experience 2018 San Diego, where I will present the breakout session "V9 to Viya: Developing Efficient SAS Studio Custom Tasks." 


A Few Words about Numbers (Software Version Numbers)

These new Custom Task Tuesday posts will focus on how custom tasks developers can take advantage of the new features and functionality of Viya 3.4.  They'll show task builders how to make tasks that help their users bridge traditional SAS 9.4 code and Viya procedures.  All screenshots here are from SAS Studio 5.1.


This release has some new features that are particularly helpful for custom task developers.  But all of the tasks presented in this series can be run in SAS Studio 4.4 or 5.1.  If you want to know more about how your SAS Studio may differ from other versions, please see here:



If you go down to the Snippets section of SAS Studio, you will see a subfolder titled SAS Viya Cloud Analytic Services. In that folder, you will find useful snippets of SAS code that will help you connect to CAS and manage your CAS session. For those who have never used SAS Studio Snippets before, to bring a Snippet into your coding window, all you need to do is double click it.




Here’s an example of what a Viya Snippet will look like after you open it. If you already have a programming window open, the Snippet will be inserted wherever your cursor was in your program. If you don’t have a programming window open, the Snippet will open in a new window as in the screenshot below.




In addition to the Cloud Analytic Services Snippets subfolder, there are two more subfolders that come with SAS Studio on Viya: SAS Viya Machine Learning and SAS Viya Image Processing.



Under the Tasks and Utilities section, you will see several subfolders that begin with “SAS Viya.”




Two of those included are SAS Viya Unsupervised Learning and SAS Viya Supervised Learning subfolders that come with SAS Studio on Viya. These are built-in point-and-click Tasks that will generate the code to run Viya PROCs. A few of the options available are Clustering, Decision Trees, and Neural Networks.




Below is an example of what a built-in Viya Task (Clustering) will look like once you open it. You will see the point-and-click options on the left and the code window where the generated SAS code will appear on the right.





Data Processing

Another point to discuss about Viya, which will be relevant in future #CASCustomTask posts, is the idea of V9 PROC’s being CAS-enabled. With CAS-enabled processing, data stays in-memory, work is done by CAS Session workers and results are passed back to the client. With NOT CAS-enabled processing, data is passed from CAS session workers to the client for client-side processing, rather than using distributed server-side processing.


All new SAS Viya procedures and CAS Actions through CASL are all CAS-enabled. For SAS 9 procedures, some are CAS-enabled (examples are PROC TRANSPOSE and PROC TABULATE) and some are not (examples are PROC SQL and PROC FREQ).

For a full list of CAS-enabled PROCs in SAS 9.4 and Viya SAS 3.3:


Custom Tasks (New Features in 5.1)

A few new features are included in SAS Studio 5.1 that are helpful to Custom Task authors.


Expand and Collapse CTM File Sections

The first new feature is the ability to collapse and expand portions of your CTM file to focus on what you’re working on at the moment. For example, you can collapse the Registration and Code Template portions while you work on Metadata and UI. As you can see below, the minus symbol will collapse the section and the plus symbol will expand the section.





Create Sub-folders Under “My Tasks”

The second new feature for task authors is the ability to create subfolders under the “My Tasks” folder. This has helped me keep all of my tasks organized. It looks like this:7.PNG



There are two ways to add a folder to “My Tasks.” You can click “New” and then select “Folder”:8.png

 Or you can right-click on “My Tasks” and select “New Folder”:


A pop-up box will prompt you to enter a name for your new folder:8.PNG

 After you create your folder, all you have to do is drag and drop your tasks into your sub-folders.


Task Error Console

SAS Studio 5.1 also comes with a Task Console to help users of tasks correct errors they encounter while filling out a task. This console will alert users to what is stopping them from being able to run their task. For example, they haven’t made a selection for a required variable choice:



More #CASCustomTasks Articles Coming Soon!

I will link the articles here after they are posted, stay tuned!


Join the Conversation on Twitter

Use the hashtag #CustomTaskTuesday and tweet Twitter_bird_logo_2012.svg.png@OliviaJWright with your Custom Task comments and questions!


SAS Studio Task GitHub

This post doesn't have a task to download, but check out all other tasks from the Custom Task Tuesday series on our SAS Studio GitHub. 

 Take Me to GitHub!


Version history
Last update:
‎08-21-2018 01:53 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