<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Waterfall plot in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/Waterfall-plot/m-p/435134#M15035</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16961"&gt;@ChrisNZ&lt;/a&gt;, the inability to get the background bars without space might be choice of style and (guessing here) whether it uses a bar outline color.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I ran you code using style Meadow and get:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SGPlot.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/18393iAE79B1C79CD69AD5/image-size/large?v=v2&amp;amp;px=999" role="button" title="SGPlot.png" alt="SGPlot.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 08 Feb 2018 00:37:54 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2018-02-08T00:37:54Z</dc:date>
    <item>
      <title>Waterfall plot</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Waterfall-plot/m-p/434972#M15026</link>
      <description>&lt;P&gt;Does anyone know if the circled area in the screenshot below is possible to program?&amp;nbsp; It was manually inserted, thanks.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/18384i4D96008910DF9CC1/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Feb 2018 18:05:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Waterfall-plot/m-p/434972#M15026</guid>
      <dc:creator>HitmonTran</dc:creator>
      <dc:date>2018-02-07T18:05:37Z</dc:date>
    </item>
    <item>
      <title>Re: Waterfall plot</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Waterfall-plot/m-p/434986#M15027</link>
      <description>&lt;P&gt;It's probably possible using either POLYGON or possibly a MARKER PLOT since they're all the same size&lt;/P&gt;
&lt;P&gt;This assumes you're using SGPLOT or SG procedures in general though.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Feb 2018 18:20:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Waterfall-plot/m-p/434986#M15027</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-02-07T18:20:42Z</dc:date>
    </item>
    <item>
      <title>Re: Waterfall plot</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Waterfall-plot/m-p/435000#M15028</link>
      <description>&lt;P&gt;Using data from Sanjay's post on waterfall charts (&lt;A href="https://blogs.sas.com/content/graphicallyspeaking/2017/07/30/clinical-graphs-waterfall-plot/" target="_blank"&gt;https://blogs.sas.com/content/graphicallyspeaking/2017/07/30/clinical-graphs-waterfall-plot/&lt;/A&gt;), I created a little example that should get you going. The key here is using the Y2AXIS and adjusting the offsets of both the YAXIS and Y2AXIS so that the overlaid bar charts do not collide. You can use an attributes map to control the colors of the "coding" bar chart.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps!&lt;/P&gt;
&lt;P&gt;Dan&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data TumorSize;
  length Cid $ 3;
  label Change='Change from Baseline (%)';
  do Id=1 to 25;
    cid=put(id, 2.0);
    change=30-120*ranuni(2);
    Group=ifc(int(ranuni(2)+0.5), 'Treatment 1', 'Treatment 2');
        Duration=floor(50+100*ranuni(2));
        Drop=ifn(ranuni(2) &amp;lt; 0.3, floor(duration-10), .);
    if mod(id, 5) = 1 then Label='C';
    if mod(id, 5) = 2 then label='R';
    if mod(id, 5) = 3 then label='S';
    if mod(id, 5) = 4 then label='P';
    if mod(id, 5) = 0 then label='N';
    output;
  end;
run;

/* Add dummy response value for the "coding" bar chart */
data temp;
set TumorSize;
retain dummyvar 1;
run;

/* Sort it */
proc sort data=temp out=TumorSizeSort;
  by descending change;
run;

/* Draw it */
title "Waterfall";
proc sgplot data=TumorSizeSort;
xaxis display=none discreteorder=data;
yaxis offsetmin=0.15 min=-100 max=100;
y2axis display=none offsetmax=0.9;
vbarparm category=id response=change / group=group;
vbarparm category=id response=dummyvar / group=label y2axis name="code";
refline 20 / lineattrs=(color=green pattern=dash);
refline -30 / lineattrs=(color=blue pattern=dash);
keylegend "code";
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 07 Feb 2018 18:48:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Waterfall-plot/m-p/435000#M15028</guid>
      <dc:creator>DanH_sas</dc:creator>
      <dc:date>2018-02-07T18:48:43Z</dc:date>
    </item>
    <item>
      <title>Re: Waterfall plot</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Waterfall-plot/m-p/435119#M15033</link>
      <description>&lt;P&gt;None of my business, but if the bottom bars mean what I think, the chart may be easier to read this way:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/18391iE1C59A5B24BCF903/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;( it would probably be better to remove the space between the background bars but I couldn't).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data TumorSize;
  length Cid $ 3;
  label Change='Change from Baseline (%)';
  do Id=1 to 25;
    cid=put(id, 2.0);
    change=30-120*ranuni(2);
    Group=ifc(int(ranuni(2)+0.5), 'Treatment 1', 'Treatment 2');
        Duration=floor(50+100*ranuni(2));
        Drop=ifn(ranuni(2) &amp;lt; 0.3, floor(duration-10), .);
    if mod(id, 5) = 1 then Label='C';
    if mod(id, 5) = 2 then label='R';
    if mod(id, 5) = 3 then label='S';
    if mod(id, 5) = 4 then label='P';
    if mod(id, 5) = 0 then label='N';
    output;
  end;
run;

/* Add dummy response value for the "coding" bar chart */
data temp;
  set TumorSize;
  retain dummyvar 11;
run;

/* Sort it */
proc sort data=temp out=TumorSizeSort;
  by descending change;
run;

/* Draw it */
title "Waterfall";
proc sgplot data=TumorSizeSort;
  xaxis display=none discreteorder=data;
  yaxis offsetmin=0.15 min=-100 max=100;
  y2axis display=none offsetmax=0.9 min=0 max=1;
  vbarparm category=id response=change   / group=group ;
  vbarparm category=id response=dummyvar / group=label y2axis name="code" transparency=.8  barwidth=1  nooutline;
  refline 20 / lineattrs=(color=green pattern=dash);
  refline -30 / lineattrs=(color=blue pattern=dash);
  keylegend "code";
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Feb 2018 23:44:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Waterfall-plot/m-p/435119#M15033</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2018-02-07T23:44:54Z</dc:date>
    </item>
    <item>
      <title>Re: Waterfall plot</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Waterfall-plot/m-p/435134#M15035</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16961"&gt;@ChrisNZ&lt;/a&gt;, the inability to get the background bars without space might be choice of style and (guessing here) whether it uses a bar outline color.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I ran you code using style Meadow and get:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SGPlot.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/18393iAE79B1C79CD69AD5/image-size/large?v=v2&amp;amp;px=999" role="button" title="SGPlot.png" alt="SGPlot.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Feb 2018 00:37:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Waterfall-plot/m-p/435134#M15035</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-02-08T00:37:54Z</dc:date>
    </item>
  </channel>
</rss>

