BookmarkSubscribeRSS Feed

Custom Task Tuesday: CAS Administrative Functions

Started ‎04-02-2019 by
Modified ‎04-11-2019 by
Views 1,170

Custom Task Tuesday is back again with a new series of articles over the next few weeks leading up to SAS Global Forum 2019. My colleagues, Elliot Inman and Ryan West, and I wrote a paper titled Kustomizing Your SAS Viya Engine Using SAS Studio Custom Tasks and D3.js. Custom Task Tuesday readers will get to preview the tasks associated with the paper, before the paper comes out! Once the paper does come out, I will add a link to it here. Ryan West, author of D3Thursdays will be doing the same thing with his medium.jpgseries leading up to SGF starting next week. All of these tasks will work with SAS Studio on Viya 3.4.

 

 

The first task is called CAS Min-Admin. Essentially, the task is the minimum administrative functions you will need to perform to be able to use CAS. It will connect to CAS, create a CAS session, disconnect, reconnect, etc. Here’s a short gif that shows the different options in the task:

 

CAS MinAdmin.gif

 

All of the code for this task came from the built-in code Snippets in the SAS Viya Cloud Analytic Services folder. As always when building a task, it’s best to start out with SAS code that you have already written and know will be re-run over and over. Here’s the list of Snippets that come with SAS Studio on Viya, boxed are the Snippets used in our task:snippets.PNG

As you can see in the gif, there are only text boxes and radio buttons in the task, so the controls aren’t very complicated. However, the Dependencies section plays a huge role. We are executing completely different programs based on the user’s radio button choice. Here’s what the Dependencies section looks like for this task:

<Dependencies>
    <Dependency condition="($radioACTION == 'disconnect')">
        <Target action="show" conditionResult="true" option="labelTIMEOUT2"/>
        <Target action="hide" conditionResult="false" option="labelTIMEOUT2"/>
        <Target action="show" conditionResult="true" option="timeOUT2"/>
        <Target action="hide" conditionResult="false" option="timeOUT2"/>
    </Dependency>
    <Dependency condition="($radioOPTIONS == 'sessionsCLIENT')">
        <Target action="hide" conditionResult="true" option="GROUPTEXT"/>
        <Target action="show" conditionResult="false" option="GROUPTEXT"/>
    </Dependency>
    <Dependency condition="($radioCHOICE == 'radioNEW')">
        <Target action="show" conditionResult="true" option="CASSERVERGROUP"/>
        <Target action="hide" conditionResult="false" option="CASSERVERGROUP"/>
        <Target action="show" conditionResult="true" option="CASSESSGROUP"/>
        <Target action="hide" conditionResult="false" option="CASSESSGROUP"/>
    </Dependency>
    <Dependency condition="($radioCHOICE == 'radioDIAGNOSE')">
        <Target action="show" conditionResult="true" option="DRTSESSGROUP"/>
        <Target action="hide" conditionResult="false" option="DRTSESSGROUP"/>
    </Dependency>
    <Dependency condition="($radioCHOICE == 'radioLIST')">
        <Target action="show" conditionResult="true" option="GROUPLIST"/>
        <Target action="hide" conditionResult="false" option="GROUPLIST"/>
        <Target action="show" conditionResult="true" option="GROUPTEXT"/>
        <Target action="hide" conditionResult="false" option="GROUPTEXT"/>
    </Dependency>
</Dependencies>

 

In the Code Template, everything will be surrounded with #if statements based on the value of the radio button. See the below example:

#if ($radioCHOICE == 'radioNEW')

/*****************************************************************************/
/*  Set the options necessary for creating a connection to a CAS server.     */
/*  Once the options are set, the cas command connects the default session   */
/*  to the specified CAS server and CAS port, for example the default value  */
/*  is 5570.                                                                 */
/*****************************************************************************/

options cashost="<$serverNAME>" casport=$portNUMBER;

cas;

/*****************************************************************************/
/*  Start a session named mySession using the existing CAS server connection */
/*  while allowing override of caslib, timeout (in seconds), and locale     */
/*  defaults.                                                                */
/*****************************************************************************/

cas $sessionNAME sessopts=(caslib=$caslib timeout=$timeOUT locale="$locale");

#end

 

This task is designed to make CAS administrative tasks as easy as a click of a button! Download the task from the Custom Task Tuesday GitHub to view all of the code. Try it out and modify it to make it your own!

 Take Me to GitHub!

Join the Conversation on Twitter

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

Version history
Last update:
‎04-11-2019 03:45 PM
Updated by:

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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