SAS Color Waterfall Plot

 SAS Day 44:

Last time, we showed an example of Spider Plot for subjects response over time. Waterfall plot visualizes the best overall response in tumor size in each participating subjects oncology studies. Each of the bars in the plot describes the percentage of change (growth or reduction) in the target lesions as compared to the baseline measurements for each subject. 



Sample Response Dataset:

The data of Waterfall has been sorted in descending order of the variable Percent_change. This shows the responses with respect to tumor growth or shrinkage in the order of magnitude of treatment response.




Sample Waterfall Plot:


Sample Code:

proc sort data=f; by descending pchg;

ods results;
proc sgplot data=f noautolegend;
styleattrs datacolors=(blue green) datacontrastcolors=(black);
Vbar n1/ response=pchg transparency=0.2 name="resp"
group=group groupdisplay=cluster

nooutline datalabel=group datalabelattrs=(weight=bold size=9)datalabelpos=bottom;
xaxis display=none;
yaxis label="Maximum %Change from Baseline" labelattrs=(weight=bold size=9)
values=(-100 to 100 by 20) max=120;
Title "Sample Waterfall Plot";
*keylegend"resp"/noborder title="" location= inside position=top down=4;
refline 20-30 / axisy=y lineattrs=(color=red);


we use the Red Line to represent the Recisist Algorithm, (Progression Disease, Partial Response, Complete Response, Stable Disease)

Recisit 1.1 Criteria 

PD: Tumor Size Increase by 20% from baseline or more
PR: Tumor Size Decrease by 30% from baseline or more
CR: Tumor disappear
SD: Neither PD Nor PR

🌈Bonus Color Trick:

The color Scheme Blue and Yellow is to be color-blind friendly. ☺
Avoid these Color Combination in order to be Color-blind friendly

  • Red & green
  • Green & brown
  • Green & blue
  • Blue & gray
  • Blue & purple
  • Green & gray
  • Green & black

Thanks to wei zhao for sharing this considerate thoughts with me.


The waterfall plot clearly demonstrated Group A patients have a better response rate than Group B patients because the tumor size shrank 6/7 patient in Group A.  Hopefully, scientists can develop the drug to cure cancer soon!




Happy SAS Coding!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Social media & sharing icons powered by UltimatelySocial
%d bloggers like this: