BookmarkSubscribeRSS Feed

Custom Task Tuesday: Saving Model Output Data

Started ‎04-16-2019 by
Modified ‎04-16-2019 by
Views 1,219

This post is another in a series of posts leading up to SAS Global Forum 2019. My colleagues, Elliot Inman and Ryan West, and I wrote a paper titled Kustomizing Your 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.

 

medium.jpg

This is the third and final task related to the paper. The post for the first task is here. The post for the second task is here.

 

This week’s task allows users to save a permanent version of their model output data as a SAS data set, as well as export as a CSV. This task is essentially an optional “Step 2” for last week’s task, but the concept could be used for any analytic model output data.

 

Here’s what the task looks like:

Segmentation Data Save FINAL.png

 

Users may want to export their model data for further processing or analysis once a desired modeling result has been achieved. This task makes that process simple. Additionally, when using the “output data” object, the task will add a prefix of 0001 to each data set name that will increase (0002, 0003…) each time the task is opened. This keeps users from accidentally overwriting a previous result, though overwriting using the “overwrite data” check box is still an option if that is desired.

 

This task is repetitive as it offers the same options for each of the 6 modeling output data sets (output from Segmentation Modeling task). I’ll show all portions of the task for one of the data sets (don’t forget to download the task from GitHub to view the entire thing!).

 

Metadata:

<Option defaultValue="CASUSER.clusterwide" indent="1" inputType="outputdata" name="cluswName" 
    required="true">Cluster Wide Data Set Name: </Option>
<Option name="chkclusw" defaultValue="0" inputType="checkbox" indent="2">Export as CSV</Option>
<Option name="fileclusw" inputType="sasserverpath"  defaultName="ClusterWide" pathType="file" 
    defaultExtension="csv" indent="2">Select a new or existing file:</Option>

 

UI:

<OptionItem option="cluswName"/>
<OptionItem option="chkclusw"/>
<OptionItem option="fileclusw"/>

 

Dependencies:

<Dependency condition="($chkclusw == '1')">
    <Target option="fileclusw" conditionResult="true"  action="show"/>
    <Target option="fileclusw" conditionResult="false" action="hide"/>
</Dependency>          

 

CodeTemplate:

data $cluswName;
    set casuser.clusters;
run;

#if ($chkclusw == '1')
proc export data=casuser.clusters
    outfile="$fileclusw.fullPath"
    dbms=csv;
run;
#end

 

Download the task from the Custom Task Tuesday GitHub to view all of the code. Can you think of any other use cases for a task like this? Have ideas for improvements? Let me know in the comments!

 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-16-2019 02:41 PM
Updated by:

SAS Innovate 2025: Call for Content

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 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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