BookmarkSubscribeRSS Feed

Custom Task Tuesday: One Click Load to CAS

Started ‎08-28-2018 by
Modified ‎10-30-2018 by
Views 1,941

Using the Data Size Reduction Task from this previous #CustomTaskTuesday post, we will add a one-click checkbox to load the output data set to CAS.medium.jpg


The purpose of the original Data Size Reduction Task was to delete duplicate records and drop variables to reduce overall data size. The new task has the same purpose, but it allows you to upload to the output data set to CAS with a single click. This one-click to CAS check box can be added to any Custom Task that produces an output data set!




This checkbox was added to the original task. With a single click...
one click.gif

 ... The following SAS code is generated:


libname mycaslib cas caslib=casuser;

data mycaslib.Dataset_Reduced;
	set Dataset_Reduced;


Because the goal was simplifying things to a single click, there is no opportunity here for the user to specify a specific caslib or caslib options. The same libname statement is used no matter what. However, each user can make their own version of this Custom Task that specifies the caslib they use most often or the one they would use for the specific task.


Note that PROC CASUTIL can be much more efficient in many cases, especially with large data. For those of you trying to ease yourselves into transitioning from V9 to Viya, you can still use the DATA Step you know and love! Below I have provided the VTL Code Portion for both ways:


Using the DATA Step:

#if( $chkCAS == 1)
    libname mycaslib cas caslib=casuser;
    data mycaslib.$textDATASET;
        set $textDATASET;


#if( $chkCAS == 1)
    libname mycaslib cas caslib=casuser;
    proc casutil;
        load data=$textDATASET replace;


After adding code for a single check-box to your Metadata and UI sections, called "chkCAS." Add the above code to the Code Portion at the bottom of your task and you will be set!


Don't forget: you can add this check-box-to-CAS to any task you want!


Can you think of other ways to incorporate Viya and CAS into your existing Custom Tasks? Let me know by commenting on this article!


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!


Want to try it yourself?

Visit our SAS Studio GitHub to download the code for this task and follow along. 

 Take Me to GitHub!


Version history
Last update:
‎10-30-2018 11:27 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