11-02-2023
OliviaWright
SAS Employee
Member since
09-21-2015
- 67 Posts
- 129 Likes Given
- 1 Solutions
- 18 Likes Received
-
Latest posts by OliviaWright
Subject Views Posted 4801 09-18-2020 02:39 PM 4865 03-24-2020 02:33 PM 3986 03-17-2020 03:06 PM 3868 03-10-2020 10:48 AM 3492 03-03-2020 03:21 PM 7539 12-18-2019 11:00 AM 31029 11-27-2019 10:08 PM 964 10-23-2019 01:49 PM 1393 06-11-2019 11:02 PM 1484 06-04-2019 10:07 AM -
Activity Feed for OliviaWright
- Got a Like for Re: Challenge for SAS Nerds: Build a SAS Valentine. 02-11-2021 05:10 PM
- Posted Custom Task Tuesday: Advanced Techniques on SAS Communities Library. 09-18-2020 02:39 PM
- Posted Custom Task Tuesday: Advanced Custom Task Cheat Sheet on SAS Communities Library. 03-24-2020 02:33 PM
- Posted Custom Task Tuesday: Multiple-Task Workflow Example for Saving SAS Visual Analytics Report Images on SAS Communities Library. 03-17-2020 03:06 PM
- Posted Custom Task Tuesday: Sonification Using the SAS Graphics Accelerator on SAS Communities Library. 03-10-2020 10:48 AM
- Posted Custom Task Tuesday: My Favorite Mistakes, a Code Confession (& SGF Kickoff!) on SAS Communities Library. 03-03-2020 03:21 PM
- Liked Learn how to do anomaly detection in floodlights for Smart Campus using SAS Analytics for IoT for PriyaSharma. 03-03-2020 08:59 AM
- Liked Meet the Super FREQs for BeverlyBrown. 02-13-2020 09:54 AM
- Liked Re: Customs Task Christmas: Creating a Customizable Christmas Tree for laurafederline. 12-18-2019 03:20 PM
- Liked Re: Customs Task Christmas: Creating a Customizable Christmas Tree for RyanWest. 12-18-2019 02:17 PM
- Posted Customs Task Christmas: Creating a Customizable Christmas Tree on SAS Communities Library. 12-18-2019 11:00 AM
- Posted Re: Installing SASPy Kernel for Jupyter Notebooks and Jupyter Lab on SAS Communities Library. 11-27-2019 10:08 PM
- Liked Making a Viya Service API Call from a JES Input Form for Mike_Drutar. 10-31-2019 03:03 PM
- Liked Re: Programming in SAS in Jupyter Notebook AND Jupyter Lab for jpprovost. 10-24-2019 09:23 AM
- Liked Re: Programming in SAS in Jupyter Notebook AND Jupyter Lab for ChrisNZ. 10-24-2019 09:23 AM
- Got a Like for Programming in SAS in Jupyter Notebook AND Jupyter Lab. 10-23-2019 10:29 PM
- Got a Like for Programming in SAS in Jupyter Notebook AND Jupyter Lab. 10-23-2019 04:56 PM
- Got a Like for Programming in SAS in Jupyter Notebook AND Jupyter Lab. 10-23-2019 03:35 PM
- Got a Like for Programming in SAS in Jupyter Notebook AND Jupyter Lab. 10-23-2019 01:50 PM
- Posted Programming in SAS in Jupyter Notebook AND Jupyter Lab on SAS Programming. 10-23-2019 01:49 PM
-
Posts I Liked
Subject Likes Author Latest Post 4 41 4 2 3 -
My Liked Posts
Subject Likes Posted 4 10-23-2019 01:49 PM 1 07-13-2018 04:09 PM 4 01-25-2018 03:59 PM 7 01-25-2018 03:21 PM 1 11-06-2017 12:25 PM -
My Library Contributions
Subject Likes Author Latest Post 1 0 4 4 1
09-18-2020
02:39 PM
1 Like
Next week, we will walk through a task that does power analysis for one-way anova. It will be an a large-scale modification of the built-in task for power analysis for pearson correlation. However, there are two elements of custom task development that you need to understand before we dive in that monster of a task. This week's post will help lay the ground work for next week. The first is a control called an Option Table, and the second is the Requirements portion of the VTL code. Both of which will be used several times in our task for allowing the user to provide as many values as they want.
Option Tables
The OptionTable element allows you to organize options into columns. You can choose add the addRemoveRowTools attribute, which will allow the user to add and remove rows from the table. This comes in handy for our use in the power task because for Significance Levels, Sample Sizes, and Power Values, proc power allows the user to specify as many numbers as they want.
Here's an example of an option table from the built-in Pearson Correlation task:
Here's the Metadata code for the Significance Level option table:
<Option inputType="string" name="alphaGroup">SIGNIFICANCE LEVEL</Option>
<OptionTable addRemoveRowTools="true" initialNumberOfRows="1" label="Alpha values:" minimumRequiredRows="1" name="alphaTable" noIncompleteRows="true" showColumnHeadings="false">
<Columns>
<Column defaultValues="0.05" label="Alpha" name="alpha">
<Option decimalPlaces="1,15" inputType="numbertext" invalidMessage="Enter a number for alpha that is greater than zero and less than 1" maxValue="0.99999999999" minValue="0.00000000001" missingMessage="Enter a number for alpha that is greater than zero and less than 1" promptMessage="Enter a number for alpha that is greater than zero and less than 1" rangeMessage="Enter a number for alpha that is greater than zero and less than 1" required="false"/>
</Column>
</Columns>
</OptionTable>
Here's the SAS Code to access the values in the Significance Level option table:
## Alpha
#set($_alpha=[])
#foreach($item in $alphaTable.rows.values)
#if ($item.alpha)
#set($_dummy=$_alpha.add("$item.alpha"))
#end
#end
#if ($_alpha.size() > 0) alpha=#foreach($item in $_alpha) $item#end#end
Requirements
The requirements element allows you to specify a list of conditions (or requirements) that must be met before the task can be run. If the condition is false, a message is printed in green in the SAS Code window, and no code is generated. Each requirement has two pieces, the condition and the message. Conditions can be quickly become complex if your requirement is based on several controls in your task.
One common use of the requirements element is to require that one value be less than another value. This is helpful in situations where the user needs to specify a maximum and minimum. You do not want the code to generated if the user specifies a maximum that is less than the minimum.
Here's an example of a requirement from the Pearson Correlation Task that does just that:
<Requirement condition="!( ($powerBySampleSizePlot == '1') && ($solveFor == 'solveforPowerChoice') && ($usePlotMinSSValue == '1') && ($usePlotMaxSSValue == '1') && ($MathTool.toDouble($ssMinValue) > $MathTool.toDouble($ssMaxValue)) )">
<Message nlsKey="minMaxSampleSizePlotRequirementKey">The maximum sample size for the power by sample size plot cannot be less than the minimum value.</Message>
</Requirement>
Join the conversation on Twitter! Use the hashtag #CustomTaskTuesday and tweet @OliviaJWright with your Custom Task comments and questions!
SAS Studio Task GitHub
This post doesn't have a task to download, but check out all other tasks from the Custom Task Tuesday series on our SAS Studio GitHub.
Take Me to GitHub!
... View more
- Find more articles tagged with:
- Custom Task Tuesday
Labels:
03-24-2020
02:33 PM
2 Likes
Welcome back for another Custom Task Tuesday mini-series! For SAS Global Forum 2020 I have written a piper titled: SAS® Studio Custom Tasks: Tips and Tricks for the Adventurous Task Author. This paper focuses on advanced custom task topics that aren't normally covered introductory materials, such as optional task sections, multiple-task workflows, advanced velocity template language, and working with CAS tables.
I released blogs on custom task topics related to the material in the paper every Tuesday leading up to the release of the SGF proceedings.
For the fourth and final post in this mini-series, I am released the...
Advanced Custom Task Cheat Sheet
This cheat sheet contains lots of information and tips for custom task authors who are looking to start making more advanced or complicated tasks.
Bonus: Additional color option!
The cheat sheet also comes in the "Ignite" color scheme, shown below. The "Illuminate" (above) is probably better for printing purposes, but if you're just checking it out on your computer, you have your choice!
Check out the Original Custom Task Cheat Sheet
If you haven't seen it, check out the original which has lots of overview information and tips for beginners. The advanced cheat sheet is for those who have moved out of the beginner phase and are ready for more!
Use these sheets in the following ways:
download the PDFs, save them to your desktop to reference again and again (Helpful Links section can be clicked on digital version of PDF to visit websites with other resources)
download the PDFs, print them out and keep a copy on your desk (you can even take a pen and add your own notes)
bookmark this post and this post and come back to these images, without having to download anything at all
download the PNG images from this post, and share on social media with #CustomTaskTuesday!
Check out the Task Tuesday GitHub
Download the cheat sheet PDFs as well as all of the tasks from my SGF 2020 paper on the Task Tuesday GitHub. Head over to view the code and try them out for yourself!
Take Me to GitHub!
Join the Conversation on Twitter
Use the hashtag #CustomTaskTuesday and tweet @OliviaJWright with your Custom Task comments and questions!
... View more
Labels:
03-17-2020
03:06 PM
2 Likes
Welcome back for another Custom Task Tuesday mini-series! For SAS Global Forum 2020 I have written a piper titled: SAS® Studio Custom Tasks: Tips and Tricks for the Adventurous Task Author. This paper focuses on advanced custom task topics that aren't normally covered introductory materials, such as optional task sections, multiple-task workflows, advanced velocity template language, and working with CAS tables.
I released blogs on custom task topics related to the material in the paper every Tuesday leading up to the release of the SGF proceedings.
For the third post in this mini-series we looked at a multi-step two-task combination: “Step 1 – Retrieve Report Images” and “Step 2 – Save Report Images.”
Saving SAS Visual Analytics Report Images
These tasks take advantage of the SAS Viya reportImages Service and use code written by Mike Drutar that can be found on his GitHub page. These tasks must be run in SAS Studio 5.2 Enterprise (or later) session within a SAS Viya 3.4 (or later) environment that contains the SAS ® Visual Analytics report that is being called.
The Step 1 task enables you to enter a report URI for a SAS Visual Analytics report. It then retrieves images of each tab of the report and creates a table with information on each tab, as well as displays the report images in the results window.
Watch the GIF below to see how "Step 1" works:
The Step 2 task uses the table created in the first step to allow the user to choose a report tab and download the image file to their specified location.
Watch the GIF below to see how "Step 2" works:
Reasons for Creating a Multiple-Task Workflow
Often, task authors would like to run a section of code and incorporate the results back into the task prompt. While that isn’t something that is possible to accomplish within a single task, a common strategy is to create a multiple task workflow or dependent tasks labeled “Step 1,” “Step 2,” and so on. These separate tasks must then be run consecutively by the user.
It is helpful to label tasks with the prefix “Step 1” and “Step 2” because tasks are listed in alphabetical order in their folders. This naming practice also helps emphasize to the user that running the second step will not work unless you have previously run the first step.
Bonus: New Markdown Text Object!
The Step 1 task uses the new markdowntext object, available in SAS Studio 5.2. Markdown is a plain-text language that allows users to format their text to make it look more attractive. With Markdown, users can add text with headings, indentations, images, links, and things like bolding and italics to their tasks. The “Sample Task” available in SAS Studio 5.2 shows an example of all of the possible options in the markdown object.
Check out the Task Tuesday GitHub
Download both of these tasks (Step 1 and Step 2) from the Task Tuesday GitHub. Head over to view the code and try them out for yourself!
Take Me to GitHub!
Join the Conversation on Twitter
Use the hashtag #CustomTaskTuesday and tweet @OliviaJWright with your Custom Task comments and questions!
... View more
03-10-2020
10:48 AM
3 Likes
Welcome back for another Custom Task Tuesday mini-series! For SAS Global Forum 2020 I have written a piper titled: SAS® Studio Custom Tasks: Tips and Tricks for the Adventurous Task Author. This paper focuses on advanced custom task topics that aren't normally covered introductory materials, such as optional task sections, multiple-task workflows, advanced velocity template language, and working with CAS tables.
I released blogs on custom task topics related to the material in the paper every Tuesday leading up to the release of the SGF proceedings.
For the second post in this mini-series we looked at one of the tasks from my paper that uses Sonification from the SAS Graphics Accelerator. In the paper, I used this task as an example for using the two optional task sections: Dependencies and Requirements.
The Sonification Task
This task enables the user to select a data set and create a graph that is sonifiable and supported by the SAS Graphics Accelerator. In order to use this task, you must have installed the SAS Graphics Accelerator Chrome browser extension.
From the SAS Graphics Accelerator Product Page:
SAS Graphics Accelerator enables users with visual impairments or blindness to create, explore, and share data visualizations. It supports alternative presentations of data visualizations that include enhanced visual rendering, text descriptions, tabular data, and interactive sonification. Sonification uses non-speech audio to convey important information about the graph.
The chart types available in the task are those that are supported by the SAS Graphics Accelerator. Here's what the task looks like:
After you use the task to create a graph (and you have the SAS Graphics Accelerator Chrome Extension installed), you'll see a button that says "Accelerate."
Clicking that button will open your graph in the SAS Graphics Accelerator, where you can listen to the sonification: Note: As stated in the Task Instructions, you can turn on the accessible graph options for all graphs by going to "Preferences">"Results">"Enable Accessible Graph Option." After doing this, you can use any of the built-in graph tasks or write your own SGPLOT code to take advantage of the SAS Graphics Accelerator (you don't have to use this Sonification Task).
The Dependencies Section
The Dependencies section is the first optional task section. It specifies how certain options (or controls) rely on one another in order for the task to work properly. The Dependencies section is infinitely useful because it enables you to show/hide and enable/disable one control based on the current value of another control.
To create a dependency, you specify the dependency condition, the target control that you want to change if the condition is true, and the action that you want to take on the control if the condition is true. Action options include “show,” “hide,” “enable,” “disable,” and “set.”
Sonification Task Example
In the Sonification task, the Dependencies section is used to control which variable options appear for each chart type. For example, a bar chart requires only one variable (category) while a bubble plot requires three variables (x, y, and size). Here is the code for the Dependencies section:
<Dependencies> <Dependency condition="($comboTYPE == 'vbar' || $comboTYPE == 'hline' || $comboTYPE == 'pie')"> <Target option="VAR" conditionResult="true" action="show"/> <Target option="VAR" conditionResult="false" action="hide"/> </Dependency> <Dependency condition="($comboTYPE == 'vbox' || $comboTYPE == 'histogram')"> <Target option="NVAR" conditionResult="true" action="show" /> <Target option="NVAR" conditionResult="false" action="hide" /> </Dependency> <Dependency condition="($comboTYPE == 'bubble' || $comboTYPE == 'heatmap' || $comboTYPE == 'scatter')"> <Target option="XVAR" conditionResult="true" action="show"/> <Target option="XVAR" conditionResult="false" action="hide"/> <Target option="YVAR" conditionResult="true" action="show"/> <Target option="YVAR" conditionResult="false" action="hide"/> </Dependency> <Dependency condition="($comboTYPE == 'bubble')"> <Target option="SIZEVAR" conditionResult="true" action="show"/> <Target option="SIZEVAR" conditionResult="false" action="hide"/> </Dependency> </Dependencies>
The Requirements Section
The Requirements section is the second optional section. It specifies conditions for the task to run. If the condition has been met, then SAS code is generated. If the condition has not been met, the SAS code will not generate, and a message will be displayed. The Requirements section is not as widely used as the Dependencies section, but there are still times when it can come in handy.
To create a requirement, you specify the requirement condition and the message to be displayed if the requirement is not met. In most cases, it is easier to specify the condition that would fail the requirement and then negate it (by using the standard “!”), rather than specify the condition that would pass the requirement.
Sonification Task Example
In the Sonification task, the requirements are used to ensure that the user has selected the necessary variables for the chosen type. For example, if the user selects bar chart from the Chart Type combobox, we want to require that the category variable array is not empty. Here is the code for the Requirements section:
<Requirements> <Requirement condition="(!(($comboTYPE == 'vbar' || $comboTYPE == 'hline' || $comboTYPE == 'pie') && ($VAR.size() == 0)))" > <Message nlsKey="varSelectionMsgKey">Select a category variable.</Message> </Requirement> <Requirement condition="(!(($comboTYPE == 'vbox' || $comboTYPE == 'histogram') && ($NVAR.size() == 0)))"> <Message nlsKey="nvarSelectionMsgKey">Select an analysis variable.</Message> </Requirement> <Requirement condition="(!(($comboTYPE == 'bubble' || $comboTYPE == 'heatmap' || $comboTYPE == 'scatter') && ($XVAR.size() == 0)))"> <Message nlsKey="xvarSelectionMsgKey">Select an X variable.</Message> </Requirement> <Requirement condition="(!(($comboTYPE == 'bubble' || $comboTYPE == 'heatmap' || $comboTYPE == 'scatter') && ($YVAR.size() == 0)))"> <Message nlsKey="yvarSelectionMsgKey">Select a Y variable.</Message> </Requirement> <Requirement condition="(!(($comboTYPE == 'bubble') && ($SIZEVAR.size() == 0)))"> <Message nlsKey="sizevarSelectionMsgKey">Select a size variable.</Message> </Requirement> </Requirements>
Check out the Task Tuesday GitHub
Download the Sonification Task from the Task Tuesday GitHub. Head over to view the code and try it out for yourself!
Take Me to GitHub!
Join the Conversation on Twitter
Use the hashtag #CustomTaskTuesday and tweet @OliviaJWright with your Custom Task comments and questions!
... View more
03-03-2020
03:21 PM
7 Likes
Welcome back for another Custom Task Tuesday mini-series! For SAS Global Forum 2020 I have written a piper titled: SAS® Studio Custom Tasks: Tips and Tricks for the Adventurous Task Author. This paper focuses on advanced custom task topics that aren't normally covered introductory materials, such as optional task sections, multiple-task workflows, advanced velocity template language, and working with CAS tables.
I released blogs on custom task topics related to the material in the paper every Tuesday leading up to the release of the SGF proceedings.
To kick off the series, this Tuesday I started with my first code confession...
My Favorite Custom Task Mistakes
If you are a SAS programmer, you know the dreaded missing semicolon. The SAS Log provides useful targeted feedback, but it provides feedback on the kinds of errors most people make most often. Those are not necessarily the mistakes you, yourself, make most often. If you have tried to build one of the tasks from my Communities series or one of your own, you know there is even less feedback from the task debugger. Velocity can be written so many ways, it would be hard to capture every mistake anyone might make.
However, after having built a ton tasks over the past three years, there are a few mistakes I find myself making over and over. At the risk of personal embarrassment and for the good of the community, here is the list of mistakes I find I make most often and how I know how to find them.
1. Adding a control to the Metadata section, but forgetting to add it to the UI section
As we all know, when you want to add a new control (a drop down, checkbox, etc.) to your task, you have to add it to both the Metadata Section AND the UI Section. The Metadata Section is where you define all of the attributes/settings for your new control, but the UI section is what actually places the control in the interface.
This is probably my most common mistake, but lucky this one is pretty easy to spot. Making this mistake will not result in any errors when trying to open the task, but it will still be obvious because your new control will not be there! If you add a new control, run your task, and then think to yourself "Where is that check box I just added??" - I would start with checking the UI section.
2. Forgetting to access role selectors like arrays
This is another one that still trips me up from time to time. I will forget that I need to access the role selector like an array with a ".get()" or a "#foreach," and just put $VAR straight into my SAS code. Seen below:
You'll know you've made this mistake if you see [brackets] around your chosen variable in the code window. You won't get a Velocity error when opening the task, but you will get an error in the SAS log if you try to run the code.
3. Copy & pasting only one part of what you need from an example task
This mistake happened to me recently, and in an embarrassing fashion. @BrianGaines helped me catch myself on this and was nice enough not to laugh at me! I was working on a task for my SGF paper. Brian sent me an example that had a requirement that was similar to what I needed for my task. For the life of me, I couldn't figure out why the requirement worked in Brian's task and didn't work for me.
Check out this excerpt from our email conversation:
I had copy & pasted the requirement from Brians task, but I didn't take have the outer/parent <Requirement> tags. This didn't cause a Velocity error when I opened my task, but I knew the requirement wasn't working as expected. Sometimes you just need an extra pair of eyes... Thanks Brian!
Have any favorite task mistakes of your own? Tweet them to me!
Use the hashtag #CustomTaskTuesday and tweet @OliviaJWright with your favorite (or least favorite) mistakes. Task authors, let's commiserate with each other!
... View more
12-18-2019
11:00 AM
10 Likes
Merry #CustomTaskChristmas!
This week I'm sharing a short and sweet custom task to get us all in the holiday spirit. If you celebrate Christmas and don't have your Christmas Tree up yet, we here at SAS want to make it easy. This Christmas Custom Task will enable you in a matter of seconds to get your tree up and fully decorated with all of the Christmas color ornaments you like.
This task generates a Christmas tree made using PROC SGPLOT and allows users to customize ornament colors, ribbon color, Christmas tree size (short and fat, tall and skinny, or in the middle), and title.
Data Point Creation
This was done in collaboration with one of our outstanding SAS Technical Interns, Laura Federline, who built the data set and SGPLOT code. Here's Laura to explain how she created the plot:
To create the data for our Christmas tree, a web plot digitizer was used. This was a simple way to extract data points from a clip-art image (we used this one). After outlining each part of the Christmas tree, the data was exported to a CSV and given a label corresponding to the tree part.
Once imported to SAS, these labels allowed for different parts of the tree to appear differently on the scatter plot. An attribute map was created (inspired by this example) to control the color, symbol, and size of the data points for each part of the tree. Finally, the built-in SAS Studio task "Scatter Plot" was used to create the SGPLOT code, and our Christmas tree was brought to life!
Below is Laura's PROC SGPLOT code before it was Task-ified:
FILENAME REFFILE 'C:/data_christmas.csv';
PROC IMPORT DATAFILE=REFFILE
DBMS=CSV
OUT=WORK.tree;
GETNAMES=YES;
guessingrows=500;
RUN;
data myattrmap;
length markercolor $ 9 markersymbol $ 14;
input ID $ value $ markercolor $ markersymbol $ MARKERSIZE;
datalines;
myid tree green TriangleFilled 10
myid trunk MOBR SquareFilled 10
myid orn_1 yellow CircleFilled 10
myid orn_2 red CircleFilled 10
myid orn_3 VPAPB CircleFilled 10
myid star gold StarFilled 30
myid ribbon VLIB CircleFilled 10
;
run;
ods graphics / reset width=6.4in height=4.8in imagemap;
proc sgplot data=WORK.TREE dattrmap=myattrmap;
scatter x=x y=y / group=type attrid=myid;
xaxis grid;
yaxis grid;
run;
ods graphics / reset;
Hint: If you don't have SAS Studio to be able to run a Custom Task, use the above code in BASE SAS, SAS Enterprise Guide, or wherever you do your SAS Programming!
Custom Task Creation
This task was super simple. We have four groups of controls: FILE LOCATION, COLORS, TITLE, and SIZING. For changing the file location and title, we have a single TEXT BOXES for each. For the colors on the tree, we have 5 COLOR SELECTORS that allow users to change the 3 ornament colors, ribbon color, and background colors. Finally for sizing we have a COMBO BOX (or drop-down) that allows users to select "Short and Fat," "Tall and Skinny" or "In the Middle."
Here's the Code Portion of the Task, where I took Laura's SGPLOT code and plugged in Apache Velocity Macro Variables that were associated with all of our task controls.
FILENAME REFFILE '$textFILE';
PROC IMPORT DATAFILE=REFFILE
DBMS=CSV
OUT=WORK.tree;
GETNAMES=YES;
guessingrows=500;
RUN;
data myattrmap;
length markercolor $ 9 markersymbol $ 14;
input ID $ value $ markercolor $ markersymbol $ MARKERSIZE;
datalines;
myid tree green TriangleFilled 10
myid trunk MOBR SquareFilled 10
myid orn_1 $color1 CircleFilled 10
myid orn_2 $color2 CircleFilled 10
myid orn_3 $color3 CircleFilled 10
myid star gold StarFilled 30
myid ribbon $color4 CircleFilled 10
;
run;
#if ($comboSIZE == "short")
ods graphics / reset width=7in height=5in imagemap;
#end
#if ($comboSIZE == "medium")
ods graphics / reset width=6in height=7.5in imagemap;
#end
#if ($comboSIZE == "tall")
ods graphics / reset width=4in height=7.5in imagemap;
#end
title "$textTITLE";
proc sgplot data=WORK.TREE dattrmap=myattrmap;
styleattrs wallcolor=$color5;
scatter x=x y=y / group=type attrid=myid;
run;
ods graphics / reset;
Download the Task and Data and Try it for Yourself!
The CSV file for the data points and the CTK file for the task are both available for download the Custom Task Tuesday GitHub.
Take Me to GitHub!
Note: If you save the CSV file to your C:/ drive, you will not have to change the default file location in the task.
Share the Custom Task Christmas Magic
Make your own Custom Task Christmas Tree and post it in the comments section of this post, or on Twitter with the hashtag #CustomTaskChristmas!
Know someone else who still needs a tree? Feel free to share this code with anyone you know. Unlike a real tree, it weighs less than an ounce and can be shipped anywhere in the world with an Internet connection in minutes.
Click this button to tweet this article and share with your SAS programmer friends:
Take Me to Twitter!
As always, comment here or tweet @OliviaJWright with your Custom Task comments and questions!
... View more
Labels:
11-27-2019
10:08 PM
Hi @tf11 ! Is it possible that your problem is misspelling kernel as kernal? Sorry I can’t be much more help if it isn’t that, and you can follow @BeverlyBrown advice to make a new post. 🙂
... View more
10-23-2019
01:49 PM
4 Likes
SASpy Kernel lets you program in SAS in Jupyter Notebook and Jupyter Lab!
I updated an older post with instructions on how to set up the SAS kernel to reflect the fact that the instructions work for Jupyter Lab, too!
Here's what SAS programming in Jupyter Lab can look like:
Check out the updated article by hitting the orange button below!
Read It!
... View more
06-11-2019
11:02 PM
2 Likes
This post is part of a mini-series leading up to PharmaSUG 2019 where I will be leading a hands-on training titled: Developing Custom SAS Studio Tasks for Clinical Graphs. For those who can't attend in person, I'll be posting about all of the tasks here on SAS Communities. Each task allows users to customize a different clinical graph from Sanjay Matange’s posts on Graphically Speaking.
This week on Custom Task Tuesday we will look at a task for creating and customizing this survival analysis plot (from this post of @Jay54's on the Graphically Speaking blog):
This post is going to go through two different ways to task-ify this survival analysis plot:
creating a survival plot task from scratch
adding in plot customization to the built-in survival analysis task (new in SAS Studio 3.8!)
Creating a Survival Plot Task from Scratch
To use this made-from-scratch task, you would first run PROC LIFETEST (using code or the built-in task) to generate the necessary dataset for the graph, and then run the task to create the plot. Here's what the first tab (DATA) of the survival analysis task looks like:
It allows the user to specify whether they want to use the standard variable names (that come from the output of the LIFETEST procedure) or whether they need to specify their own. This can save the user some time because if they are using the standard names they will not have to do any variable selection.
And here's the second tab (APPEARANCE):
It allows the user to specify new plot titles, a new scatter symbol (instead of plus for censored observations, they could use a filled circle), as well as a new color scheme.
Adding in Plot Customization to Built-In Survival Analysis Task
Above is the new built-in Nonparametric Survival Analysis task with the added APPEARANCE tab to change the look of the survival plot. The built-in task runs PROC LIFETEST with the users selected options. There are standard plots that come with the output of PROC LIFETEST, but there is no way within the LIFETEST procedure to change colors, titles, etc. The APPEARANCE tab I added allows the task user to customize the plot that will be created with PROC SGPLOT. This added feature will allow the user to run the survival analysis and create the customize plot all in one step.
The Result: A Customized Survival Plot
Check out the Task Tuesday GitHub
Download the both of these survival analysis plot tasks on the Task Tuesday GitHub to view the code and try them out for yourself!
Take Me to GitHub!
Join the Conversation on Twitter
Use the hashtag #CustomTaskTuesday and tweet @OliviaJWright with your Custom Task comments and questions!
... View more
Labels:
06-04-2019
10:07 AM
2 Likes
This post is part of a mini-series leading up to PharmaSUG 2019 where I will be leading a hands-on training titled: Developing Custom SAS Studio Tasks for Clinical Graphs. For those who can't attend in person, I'll be posting about all of the tasks here on SAS Communities. Each task allows users to customize a different clinical graph from Sanjay Matange’s posts on Graphically Speaking.
This week on Custom Task Tuesday we will look at a task for creating and customizing this clinical waterfall graph (from this post of @Jay54's on the Graphically Speaking blog):
Like the post from last week and the post from the week before, this task includes options for changing the data source, variables, color scheme, legend position/location, and title. In addition to those options, this task also includes an option for a second title, as well as y-axis values (minimum, maximum, and increment).
Check out the task below:
Creating Controls for Y-Axis Values
I'll go through each portion of the task to show how to implement controls for customizing a Y-axis in a task for graph creation.
Metadata Section
Here is the code from the Metadata section. It includes a group for the Y-axis controls, as well as 3 number text controls (for minimum value, maximum value, and increment value).
<Option inputType="string" name="GROUPYAXIS">Y AXIS VALUES</Option>
<Option defaultValue="-100" inputType="numbertext" invalidMessage="Invalid value. Enter a number between 0 and 100." maxValue="100" minValue="-100" missingMessage="Enter a number between 0 and 100." name="minYAXIS" promptMessage="Enter a number between 0 and 100." rangeMessage="This number is out of range. Enter a number between 0 and 100.">Minimum:</Option>
<Option defaultValue="60" inputType="numbertext" invalidMessage="Invalid value. Enter a number between 0 and 100." maxValue="100" minValue="-100" missingMessage="Enter a number between 0 and 100." name="maxYAXIS" promptMessage="Enter a number between 0 and 100." rangeMessage="This number is out of range. Enter a number between 0 and 100.">Maximum:</Option>
<Option defaultValue="20" inputType="numbertext" invalidMessage="Invalid value. Enter a number between 0 and 100." maxValue="100" minValue="-100" missingMessage="Enter a number between 0 and 100." name="incrementYAXIS" promptMessage="Enter a number between 0 and 100." rangeMessage="This number is out of range. Enter a number between 0 and 100.">Increment:</Option>
UI Section
Below is the code for the UI section. The 3 numbertext controls go inside the YAXIS group.
<Group open="true" option="GROUPYAXIS">
<OptionItem option="minYAXIS"/>
<OptionItem option="maxYAXIS"/>
<OptionItem option="incrementYAXIS"/>
</Group>
CodeTemplate section
Finally, here is the CodeTemplate section for the Y-axis values. This is the yaxis statement for PROC SGPLOT. We reference the $minYAXIS, $maxYAXIS, and $incrementYAXIS velocity macro variables from our controls.
yaxis values=($minYAXIS to $maxYAXIS by $incrementYAXIS);
Final Product! Functioning Y-Axis Controls:
Check out the Task Tuesday GitHub
Download the change in tumor size waterfall graph task on the Task Tuesday GitHub!
Take Me to GitHub!
Join the Conversation on Twitter
Use the hashtag #CustomTaskTuesday and tweet @OliviaJWright with your Custom Task comments and questions!
... View more
- Find more articles tagged with:
- Custom Task Tuesday
Labels:
05-28-2019
10:16 AM
This post is part of a mini-series leading up to PharmaSUG 2019 where I will be leading a hands-on training titled: Developing Custom SAS Studio Tasks for Clinical Graphs. For those who can't attend in person, I'll be posting about all of the tasks here on SAS Communities. Each task allows users to customize a different clinical graph from Sanjay Matange’s posts on Graphically Speaking.
This week on Custom Task Tuesday we will look at a task for creating and customizing this clinical profile line chart:
Here's what the task looks like:
Tabs and Groups
While last week's task featured all of the options on one tab, this week's task divides up the controls into DATA and APPEARANCE. Dividing controls into tabs is standard for built-in SAS Studio tasks. Standard tab names are DATA, OPTIONS, OUTPUT, and APPEARANCE. The INFORMATION tab is always created automatically from the Registration section of the task.
Within the tabs, controls are structured into collapsible groups. On the DATA tab are DATA and ROLES groups, which are standard names for built-in tasks. On the APPEARANCE tab, there is a GRAPH OPTIONS group.
The UI section of a task shows the break-down of controls within groups within containers (tabs). The UI section for the Lipid Profile task is shown below:
<UI>
<Container option="DATATAB">
<Group option="DATAGROUP" open="true">
<DataItem data="DATASOURCE"/>
</Group>
<Group option="ROLESGROUP" open="true">
<RoleItem role="GROUPVAR"/>
<RoleItem role="DAYVAR"/>
<RoleItem role="MEDIANVAR"/>
<RoleItem role="LCLVAR"/>
<RoleItem role="UCLVAR"/>
</Group>
</Container>
<Container option="APPEARANCETAB">
<Group option="GROUPGRAPH" open="true">
<OptionItem option="textTITLE1"/>
<OptionChoice option="comboTHEME">
<OptionItem option="inspire"/>
<OptionItem option="illuminate"/>
<OptionItem option="grayscale"/>
<OptionItem option="pastel"/>
<OptionItem option="bright"/>
<OptionItem option="dark"/>
<OptionItem option="default"/>
</OptionChoice>
<OptionChoice option="comboLEGENDLOC">
<OptionItem option="inside"/>
<OptionItem option="outside"/>
</OptionChoice>
<OptionChoice option="comboLEGENDPOS">
<OptionItem option="bottom"/>
<OptionItem option="bottomleft"/>
<OptionItem option="bottomright"/>
<OptionItem option="left"/>
<OptionItem option="right"/>
<OptionItem option="top"/>
<OptionItem option="topleft"/>
<OptionItem option="topright"/>
</OptionChoice>
<OptionItem option="labelORIENTATION"/>
<OptionItem option="radioAuto"/>
<OptionItem option="radioHorizontal"/>
<OptionItem option="radioVertical"/>
</Group>
</Container>
</UI>
Check out the Task Tuesday GitHub
Download the lipid profile task on the Task Tuesday GitHub!
Take Me to GitHub!
Join the Conversation on Twitter
Use the hashtag #CustomTaskTuesday and tweet @OliviaJWright with your Custom Task comments and questions!
... View more
- Find more articles tagged with:
- Custom Task Tuesday
Labels:
05-21-2019
10:24 AM
5 Likes
This post is part of a mini-series leading up to PharmaSUG 2019 where I will be leading a hands-on training titled: Developing Custom SAS Studio Tasks for Clinical Graphs. For those who can't attend in person, I'll be posting about all of the tasks here on SAS Communities. Each task allows users to customize a different clinical graph from Sanjay Matange’s posts on Graphically Speaking.
This week on Custom Task Tuesday we will look at a task for creating and customizing this clinical grouped bar chart (from this post of @Jay54's on the Graphically Speaking blog):
Check out what the task looks like below:
This task offers the user a few simple graph customization options. For simplicity, all options appear on one tab called "GRAPH."
Parameterizing SGPLOT Code
I want to highlight which parts of the SGPLOT code are being replaced by task controls and which are not. In the photo below, the boxed portions of the code are going to be filled in by a task control, while the rest are hard coded:
You can see that there are plenty of additional parameters that could've been built into the task such as group display, x-axis order, font size, etc.
After we replace the code in those boxes with the velocity macro variables from our task controls, here's what the Code Template portion for this task looks like:
#if ($comboTHEME == 'inspire')
%let fillcolors= cx21b9b7 cx4141e0 cx7db71a cx8e2f8a cxd38506 cx0abf85 cx2f90ec;
#end
#if ($comboTHEME == 'illuminate')
%let fillcolors= cx00929f cxf08000 cx90b328 cx3d5aae cxffca39 cxa6427c cx9c2910 cx736519;
#end
#if ($comboTHEME == 'grayscale')
%let fillcolors= cx585858 cxa2a2a2 cx1e1e1e cx707070 cxbbbbbb cx3b3b3b cxd0d0d0;
#end
#if ($comboTHEME == 'pastel')
%let fillcolors= cxb3e2cd cxfdcdac cxcbd5e8 cxf4cae4 cxe6f5c9 cxfff2ae cxf1e2cc cxcccccc;
#end
#if ($comboTHEME == 'bright')
%let fillcolors= cx3190D0 cxFF991A cx3EBB3B cxF23E39 cxAF7ED9 cxA77063 cxFF8EDD cxD6D91A;
#end
#if ($comboTHEME == 'dark')
%let fillcolors= cx1b9e77 cxd95f02 cx7570b3 cxe7298a cx66a61e cxe6ab02 cxa6761d cx666666;
#end
title '$textTITLE1';
title2 '$textTITLE2';
proc sgplot data=$DATASOURCE nowall noborder;
#if ($comboTHEME != 'default')
styleattrs datacolors=(&fillcolors) datacontrastcolors=(black);
#end
vbar #foreach ($item in $TIMEVAR) $item #end / #foreach ($item in $RESPVAR) response=$item #end #foreach ($item in $GROUPVAR) group=$item #end groupdisplay=cluster baselineattrs=(thickness=0);
xaxis discreteorder=data;
yaxis offsetmax=0.2;
keylegend / title='' location=$comboLEGENDLOC position=$comboLEGENDPOS border autoitemsize valueattrs=(size=8) #if($radioORIENTATION == 'radioHorizontal') down=1 #end #if($radioORIENTATION == 'radioVertical') across=1 #end;
run;
title;
As always, the full code for this task is available for download on the Task Tuesday GitHub! Download the task and use it as-is or edit it to make it your own.
Check out the Task Tuesday GitHub
Download the injection site reaction task on the Task Tuesday GitHub!
Take Me to GitHub!
Join the Conversation on Twitter
Use the hashtag #CustomTaskTuesday and tweet @OliviaJWright with your Custom Task comments and questions!
... View more
- Find more articles tagged with:
- Custom Task Tuesday
Labels:
05-14-2019
09:45 AM
2 Likes
Over the next several #CustomTaskTuesdays, leading up to PharmaSUG 2019, I will be releasing tasks for customizing SGPLOT graphs. The graphs used will all be clinical graph examples from Sanjay Matange’s posts on Graphically Speaking.
At PharmaSUG, I will be leading a hands-on training titled: Developing Custom SAS Studio Tasks for Clinical Graphs. For those who can't attend in person, I'll be posting about all of the tasks here on SAS Communities.
Clinical Graphs from Graphically Speaking
These plots will be used from Sanjay’s blog to create graph customizing tasks. Over the next four weeks I will release posts for tasks that will allow users to create and customize each of these graphs!
Injection Site Reaction Grouped Bar Chart
Change in Tumor Size Waterfall Chart
Lipid Profile Line Chart
Survival Plot
Tasks for Clinical Graphs
There are many common changes users want to make to graphs, all of which we can build in as parameters for Custom Tasks using specific controls. These controls will be used in the upcoming posts of tasks for clinical graph creations. Let's take a look at the common changes users want to make to graphs and the task controls that go with them.
Choosing different data
Data set selector
Role (variable) selector
Changing the color scheme
Individual color selector
Combo box (drop down) populated with color themes
Creating a new title
Text input boxes
Changing legend attributes
Radio button with legend orientations
Drop downs for legend location and position
The upcoming posts will focus on the task creation for SGPLOT code. If you're interested in learning more about SGPLOT, here are some resources:
PROC SGPLOT Documentation
PROC SGPLOT Tip Sheet
Check out the Task Tuesday GitHub
This post doesn't have a task to download, but check out previous tasks on the Task Tuesday GitHub.
Take Me to GitHub!
Join the Conversation on Twitter
Use the hashtag #CustomTaskTuesday and tweet @OliviaJWright with your Custom Task comments and questions!
... View more
- Find more articles tagged with:
- Custom Task Tuesday
Labels:
04-23-2019
10:35 AM
2 Likes
@MichelleHomes Thank you so much! I collaborated with lots of folks on the SAS Studio team to perfect the design and the content. I'm really proud of the final result.
... View more
04-23-2019
09:37 AM
7 Likes
It's finally here: the ultimate "cheat sheet" for task authors!
What is a cheat sheet, you ask? It's a one-pager (front and back) that provides notes, syntax, and tips for a programming language. This sheet will be a one-stop shop for task authors who are just getting started, as well as a tool more experienced task authors can reference again and again.
Below are sneak peek images of the sheet (click on the images to enlarge), click HERE for the PDF download!
Use this sheet in the following ways:
download the PDF, save it to your desktop to reference again and again (Helpful Links section can be clicked on digital version of PDF to visit websites with other resources)
download the PDF, print it out and keep a copy on your desk (you can even take a pen and add your own notes)
bookmark this post and come back to these images, without having to download anything at all
download the PNG images from this post, and share on social media with #CustomTaskTuesday!
Custom Task Tuesday will return in about a month
Leading up to PharmaSUG 2019, where I will be leading a Hands-On Training titled "Developing Custom SAS Studio Tasks for Clinical Trial Graphs," I'll post tasks related to my paper and the workshop in the weeks preceding the conference.
Check out the Task Tuesday GitHub
Download the PDF of this sheet from this post or from the Task Tuesday GitHub.
Take Me to GitHub!
Join the Conversation on Twitter
Use the hashtag #CustomTaskTuesday and tweet @OliviaJWright with your Custom Task comments and questions!
... View more
- Find more articles tagged with:
- Custom Task Tuesday
Labels: