BookmarkSubscribeRSS Feed
BenB
Calcite | Level 5

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).

  • Categories with stacked types
  • Labels for size of bars
  • Can save as image file for use elsewhere

Thanks.

DATA (ignore the differences in stage values, I merely changed the values even though the four possibilities remain the same)

stagetypevalue
Prev. OpenNon-Audit/Comp2
Prev. OpenAudit/Comp0
NewNon-Audit/Comp6
NewAudit/Comp15
CompletedAudit/Comp12
CompletedNon-Audit/Comp4
RemainingAudit/Comp3
RemainingNon-Audit/Comp4

DATA USED IN PROC TEMPLATE

stageNY
outstanding_prj20
new_prj615
completed_prj412
remaining_prj43

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;


stacked waterfall.jpg
1 REPLY 1
Haikuo
Onyx | Level 15

Bump! I feel the OP, tired of "clear/white bar", wanting to know if there are other ways.

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 1941 views
  • 0 likes
  • 2 in conversation