I would like to know how I can create a stacked waterfall chart using proc template (waterfallchart) and sgrender. I can use another graphing procedure if it allows me to save the image as a file (I use this image for a website). I have seen the other approaches (clear/white bar chart, also using annotate with gplot) but those seem to be workarounds before the waterfall chart option in 9.3.
My data consists of stages (aka categories, 4 of them) and types (2) of them. Any suggestions?
For reference, here is the data as well as procedures. The final output should look something like the picture attached (the values do not match the datasets below, ignore that).
Thanks.
DATA (ignore the differences in stage values, I merely changed the values even though the four possibilities remain the same)
stage | type | value |
Prev. Open | Non-Audit/Comp | 2 |
Prev. Open | Audit/Comp | 0 |
New | Non-Audit/Comp | 6 |
New | Audit/Comp | 15 |
Completed | Audit/Comp | 12 |
Completed | Non-Audit/Comp | 4 |
Remaining | Audit/Comp | 3 |
Remaining | Non-Audit/Comp | 4 |
DATA USED IN PROC TEMPLATE
stage | N | Y |
outstanding_prj | 2 | 0 |
new_prj | 6 | 15 |
completed_prj | 4 | 12 |
remaining_prj | 4 | 3 |
PROC TEMPLATE
%let opts = linearopts=(viewmin=0 viewmax=&max_hght tickvaluesequence=(start=0 end=&max_hght increment=5));* tickvaluelist=(-0.1 0 0.1)) offsetmin=0.1 offsetmax=0.1;
proc template;
define statgraph waterfallchart;
begingraph;
layout overlay / yaxisopts=(&opts);
waterfallchart category=stage response=total /
colorgroup=type barlabel=true
display=(fill)
name="Project Throughput" dataskin=gloss;* filltype=gradient;
endlayout;
endgraph;
end;
run;
ODS Rendering
ods html path="&base_rpt" (url=none);
ods graphics / width=300px reset=index imagename="DP_water_&dt._" ;
proc sgrender data=wf_dp template=waterfallchart;
run;
Bump! I feel the OP, tired of "clear/white bar", wanting to know if there are other ways.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.