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-2024.png

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.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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