BookmarkSubscribeRSS Feed

CAS Actions for SAS® Visual Analytics Report Developers

Started ‎05-15-2018 by
Modified ‎05-15-2018 by
Views 3,293

This article contains supporting information for the 2018 SAS Global Forum paper: Just Enough SAS® Cloud Analytic Services: CAS Actions for SAS® Visual Analytics Report Developers.  This paper focuses on teaching the CAS Actions and in-memory data manipulation techniques needed by developers that are creating reports on the SAS Visual Analytics Platform.



SAS Visual Analytics includes all of the point-and-click functionality required to load data, manage data, and perform other back-end work necessary to make SAS Visual Analytics visualizations efficient and effective.  But there are a handful of critical tasks that are sometimes just easier to do with a few lines of code, especially if your end goal is to automate that that process.  While there is a substantial and growing codebase for CAS Actions and SAS Viya procedures, SAS Visual Analytics report developers need to focus on the creation and implementation of reports.  What we need is just enough CAS code to simplify the back-end work.  This paper presents some of the most common, most useful CAS actions that can be run from any SAS Viya powered code window, including the SAS Studio interface.  These bare bones code examples include:  loading a data set to a CAS server, using CAS actions to transform data from a “wide” to a “tall” structure, and other formatting operations that make data reporting-ready.  The paper demonstrates, using minimal code, how the scored output of a Viya-based model can be lifted into CAS and made ready for SAS Visual Analytics reporting.  Finally, the paper describes exactly how coded back-end actions affect the SAS Visual Analytics platform, including how to verify that back-end processes are working and ensure SAS Visual Analytics settings for refresh and automated data re-load are set to take advantage of the automated back-end processes implemented in code.




Online materials and examples

SAS Global Forum proceedings

The PDF version of the paper can be found here:

CAS Actions and Code

Several examples CAS actions and how to interact with CAS dataset within SAS Viya are included in the paper. 

These code examples are attached to this post and descriptions of each program is listed below:

    • Creates a CAS session and assigns all caslibs
    • Formats and loads the sashelp dataset BASEBALL into CAS.
    • Promotes the CAS dataset BASEBALL in order to make it available in SAS Visual Analytics
    • Runs the cas action 'listacsdata' to determine which groups have direct access to the caslib PUBLIC
    • Run the cas action 'userinfo' to determine which groups the current user is in
    • Runs a Viya Linear Regression model and captures it's output as a CAS Dataset
    • Promotes the output dataset from the Viya Linear Regression in order to make it available in SAS Visual Analytics
    • Saves the BASEBALL dataset in the caslib PUBLIC as the file BASEBALL_PRD.sashdat
    • Loads the file BASEBALL_PRD.sashdat to the caslib PUBLIC
    • Promotes the CAS dataset BASEBALL_PRD to make it available in SAS Visual Analytics
    • Runs the cas 'transpose' to convert a subset of the CAS dataset BASEBALL from a 'wide' to a 'tall' structure.


Version history
Last update:
‎05-15-2018 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