BookmarkSubscribeRSS Feed

Custom Task Tuesday: Clinical Waterfall Graph

Started ‎06-04-2019 by
Modified ‎06-05-2019 by
Views 1,585

 

medium.jpgThis 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):

plot 2.png

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:waterfall.png

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:

yaxis.PNG

 

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

 

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

Version history
Last update:
‎06-05-2019 09:20 AM
Updated by:

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

SAS AI and Machine Learning Courses

The rapid growth of AI technologies is driving an AI skills gap and demand for AI talent. Ready to grow your AI literacy? SAS offers free ways to get started for beginners, business leaders, and analytics professionals of all skill levels. Your future self will thank you.

Get started

Article Labels
Article Tags