BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
sanjay1
Obsidian | Level 7

HI Sas Experts,

 

I wanted to remove the final bar from the waterfall chart. Please guide

Please check  the attched image.


waterfall chart.png
1 ACCEPTED SOLUTION

Accepted Solutions
BrunoMueller
SAS Super FREQ

Yes there is.

 

You will need to use GTL to do this.

 

For a start you can use your Proc SGPLOT code and add the TMPLOUT= option. This will write out the GTL code to a file.

 

proc sgplot data=sashelp.class tmplout="c:\temp\sgplot.sas";
  waterfall category=age response=height ;
run;

Then adapt the code like below. Check the doc for the WATERFALLCHART statement it has the DISPLAY= option.

ods path
  (prepend) work.mytemplates (update)
;

proc template;
  define statgraph sgplot_waterfall;
    begingraph / collation=binary;
      layout overlay / yaxisopts=(labelFitPolicy=Split) y2axisopts=(labelFitPolicy=Split);
        WaterfallChart Category=Age Response=Height / 
          primary=true LegendLabel="Height" NAME="WATERFALL"
          display=(
          FILL 
          /*            FINALBAR displays the “final” bar */
          OUTLINE 
          CONNECT 
          )
        ;
      endlayout;
    endgraph;
  end;
run;

proc sgrender data=sashelp.class template=sgplot_waterfall;
run;

Bruno

View solution in original post

3 REPLIES 3
BrunoMueller
SAS Super FREQ

Yes there is.

 

You will need to use GTL to do this.

 

For a start you can use your Proc SGPLOT code and add the TMPLOUT= option. This will write out the GTL code to a file.

 

proc sgplot data=sashelp.class tmplout="c:\temp\sgplot.sas";
  waterfall category=age response=height ;
run;

Then adapt the code like below. Check the doc for the WATERFALLCHART statement it has the DISPLAY= option.

ods path
  (prepend) work.mytemplates (update)
;

proc template;
  define statgraph sgplot_waterfall;
    begingraph / collation=binary;
      layout overlay / yaxisopts=(labelFitPolicy=Split) y2axisopts=(labelFitPolicy=Split);
        WaterfallChart Category=Age Response=Height / 
          primary=true LegendLabel="Height" NAME="WATERFALL"
          display=(
          FILL 
          /*            FINALBAR displays the “final” bar */
          OUTLINE 
          CONNECT 
          )
        ;
      endlayout;
    endgraph;
  end;
run;

proc sgrender data=sashelp.class template=sgplot_waterfall;
run;

Bruno

sanjay1
Obsidian | Level 7

Hi Bruno,

 

Thats working fine, can i also get the values on the top of the each bar.(and I also want to get the space between each bar is there is anyway to do this). 

 

Thank you very much.

BrunoMueller
SAS Super FREQ

Hi

 

Have a look at the doc for the WATERFALL statement, data values can usally be displayed with the DATALABEL option.

 

Bruno

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
  • 3 replies
  • 1542 views
  • 2 likes
  • 2 in conversation