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.
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...
... The following SAS code is generated:
libname mycaslib cas caslib=casuser;
data mycaslib.Dataset_Reduced;
set Dataset_Reduced;
run;
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;
run;
#end
Using PROC CASUTIL:
#if( $chkCAS == 1)
libname mycaslib cas caslib=casuser;
proc casutil;
load data=$textDATASET replace;
run;
#end
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!
Use the hashtag #CustomTaskTuesday and tweet @OliviaJWright with your Custom Task comments and questions!
Visit our SAS Studio GitHub to download the code for this task and follow along.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
Data Literacy is for all, even absolute beginners. Jump on board with this free e-learning and boost your career prospects.