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.
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."
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.
Download the injection site reaction task on the Task Tuesday GitHub!
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.
Data Literacy is for all, even absolute beginners. Jump on board with this free e-learning and boost your career prospects.