<?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: Stacked bar charts with positive and negative values in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/Stacked-bar-charts-with-positive-and-negative-values/m-p/437696#M15088</link>
    <description>&lt;P&gt;Is this what you want?&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="patients.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/18625i9BA025B7E204ECE6/image-size/large?v=v2&amp;amp;px=999" role="button" title="patients.png" alt="patients.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Basically, this required a little data tweak in a temporary data set that was, then, fed into PROC SGPLOT. The code is below. Let me know if this works for you,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks!&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 have;
input group percent response;
cards;
1 14.3 -3
1 14.3 -2
1 14.3 -1
1 14.3 0
1 14.3 1
1 14.3 2
1 14.3 3
0 14.3 -3
0 14.3 -2
0 14.3 -1
0 14.3 0
0 14.3 1
0 14.3 2
0 14.3 3
;
run;

proc format;
value grpfmt 0="Group 0"
             1="Group 1";
run;

data temp;
set have;
format group grpfmt.;
if response &amp;lt; 0 then percent = percent * -1;
else if response=0 then percent=0;
run;

proc sgplot data = temp;
styleattrs datacolors=( cxAACEE2 cx65ABC4 cx017BA8 cx004159 cxA88BDD cx8959E0 cx643BAF)
datacontrastcolors=( cxAACEE2 cx65ABC4 cx017BA8 cx004159 cxA88BDD cx8959E0 cx643BAF);
vbar group / response= percent group=response ;
yaxis label = 'Percent (%)' ;
xaxis label =' ';
title 'Change from Baseline Frequencies  - Month 3';
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 15 Feb 2018 17:04:23 GMT</pubDate>
    <dc:creator>DanH_sas</dc:creator>
    <dc:date>2018-02-15T17:04:23Z</dc:date>
    <item>
      <title>Stacked bar charts with positive and negative values</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Stacked-bar-charts-with-positive-and-negative-values/m-p/437638#M15085</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have change data on a 4-point response scale. So patients can have up to a 3 category improvement, stay the same, or have up to a 3 category deterioration. So I have 7 categories a pt can fall into.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;At the moment I have the data structured as below and use&amp;nbsp; proc sgpanel with vbar. This gets me close, but what I want to have is the stable (response = 0) in the middle, with the 0 y axis starting here with those who improved stacked on top, and then below the 0 axis have those who worsened.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Something like this (vertical or horizontal isn't a major worry)&amp;nbsp;&lt;A href="https://www.google.com/search?q=stacked+bar+chart+of+change&amp;amp;source=lnms&amp;amp;tbm=isch&amp;amp;sa=X&amp;amp;ved=0ahUKEwiR94CYoKjZAhUrTt8KHd7YC9sQ_AUICigB&amp;amp;biw=1536&amp;amp;bih=760#imgrc=HeZwCdF_J4qaGM:&amp;nbsp;" target="_blank"&gt;https://www.google.com/search?q=stacked+bar+chart+of+change&amp;amp;source=lnms&amp;amp;tbm=isch&amp;amp;sa=X&amp;amp;ved=0ahUKEwiR94CYoKjZAhUrTt8KHd7YC9sQ_AUICigB&amp;amp;biw=1536&amp;amp;bih=760#imgrc=HeZwCd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cx017BA8 cx004159 cxA88BDD cx8959E0 cx643BAF)&lt;BR /&gt;datacontrastcolors=( cxAACEE2 cx65ABC4 cx017BA8 cx004159 cxA88BDD cx8959E0 cx643BAF);&lt;BR /&gt;vbar group / response= percent group=response ;&lt;BR /&gt;rowaxis label = 'Percent (%)' ;&lt;BR /&gt;colaxis label =' ' display=(novalues notick);&lt;/P&gt;&lt;P&gt;title 'Change from Baseline Frequencies&amp;nbsp; - Month 3';&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!!&lt;/P&gt;</description>
      <pubDate>Thu, 15 Feb 2018 15:40:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Stacked-bar-charts-with-positive-and-negative-values/m-p/437638#M15085</guid>
      <dc:creator>Bellak</dc:creator>
      <dc:date>2018-02-15T15:40:22Z</dc:date>
    </item>
    <item>
      <title>Re: Stacked bar charts with positive and negative values</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Stacked-bar-charts-with-positive-and-negative-values/m-p/437696#M15088</link>
      <description>&lt;P&gt;Is this what you want?&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="patients.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/18625i9BA025B7E204ECE6/image-size/large?v=v2&amp;amp;px=999" role="button" title="patients.png" alt="patients.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Basically, this required a little data tweak in a temporary data set that was, then, fed into PROC SGPLOT. The code is below. Let me know if this works for you,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks!&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 have;
input group percent response;
cards;
1 14.3 -3
1 14.3 -2
1 14.3 -1
1 14.3 0
1 14.3 1
1 14.3 2
1 14.3 3
0 14.3 -3
0 14.3 -2
0 14.3 -1
0 14.3 0
0 14.3 1
0 14.3 2
0 14.3 3
;
run;

proc format;
value grpfmt 0="Group 0"
             1="Group 1";
run;

data temp;
set have;
format group grpfmt.;
if response &amp;lt; 0 then percent = percent * -1;
else if response=0 then percent=0;
run;

proc sgplot data = temp;
styleattrs datacolors=( cxAACEE2 cx65ABC4 cx017BA8 cx004159 cxA88BDD cx8959E0 cx643BAF)
datacontrastcolors=( cxAACEE2 cx65ABC4 cx017BA8 cx004159 cxA88BDD cx8959E0 cx643BAF);
vbar group / response= percent group=response ;
yaxis label = 'Percent (%)' ;
xaxis label =' ';
title 'Change from Baseline Frequencies  - Month 3';
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 15 Feb 2018 17:04:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Stacked-bar-charts-with-positive-and-negative-values/m-p/437696#M15088</guid>
      <dc:creator>DanH_sas</dc:creator>
      <dc:date>2018-02-15T17:04:23Z</dc:date>
    </item>
    <item>
      <title>Re: Stacked bar charts with positive and negative values</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Stacked-bar-charts-with-positive-and-negative-values/m-p/437701#M15089</link>
      <description>&lt;P&gt;Thank you!! This now has the 0 line where I need it, just one small problem the 3 category deterioration is directly below the 0 line, I guess I can just flip the change (my worry is that gets a little confusing) but I don't see a way around. Any order like ideas that would prevent possible confusion would be appreciated!&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="Presentation2.jpg" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/18626i3D95AFFC1B709700/image-size/large?v=v2&amp;amp;px=999" role="button" title="Presentation2.jpg" alt="Presentation2.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Feb 2018 17:29:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Stacked-bar-charts-with-positive-and-negative-values/m-p/437701#M15089</guid>
      <dc:creator>Bellak</dc:creator>
      <dc:date>2018-02-15T17:29:56Z</dc:date>
    </item>
  </channel>
</rss>

