<?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 Chart with 3 variables that total in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/Stacked-Bar-Chart-with-3-variables-that-total/m-p/310230#M10902</link>
    <description>&lt;P&gt;If your data is in the Excel multi-column format, transform it into the grouped data like shown below. &amp;nbsp;Then you can create the required bar chart. &amp;nbsp;You can some options to make it look closer to what you have shown. &amp;nbsp;You can add other options to to get data or segment labels. &amp;nbsp;Fixed code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data excel;&lt;BR /&gt; label Materials='Raw Materials';&lt;BR /&gt; label Labour='Production Labour';&lt;BR /&gt; label Contrib='Gross Contribution Margin';&lt;BR /&gt; input Customer $1-12 Materials Labour Contrib;&lt;BR /&gt; datalines;&lt;BR /&gt;Customer 1 1915740 1234973 2076755&lt;BR /&gt;Customer 2 2838960 1103123 1955923&lt;BR /&gt;Customer 3 2838960 1103123 1955923&lt;BR /&gt;Customer 4 1915740 1234973 2076755&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data stacked;&lt;BR /&gt; length Group $25;&lt;BR /&gt; keep Customer Group Value;&lt;BR /&gt; set excel;&lt;BR /&gt; Group='Raw Materials'; Value=Materials; output;&lt;BR /&gt; Group='Production Labour'; Value=Labour; output;&lt;BR /&gt; Group='Gross Contribution Margin'; Value=Contrib; output;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ods listing;&lt;BR /&gt;proc sgplot data=stacked noborder;&lt;BR /&gt;&amp;nbsp; styleattrs datacolors=(orange gray yellow) datacontrastcolors=(black);&lt;BR /&gt;&amp;nbsp; vbarparm category=customer response=value / group=group &lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;barwidth=0.4;&lt;BR /&gt;&amp;nbsp; yaxis display=(noline noticks) grid;&lt;BR /&gt;&amp;nbsp; xaxis display=(nolabel noticks);&lt;BR /&gt;&amp;nbsp; keylegend / noborder;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/5717iDC4FB04E80AFC7EB/image-size/medium?v=v2&amp;amp;px=-1" border="0" alt="SGPlot9.png" title="SGPlot9.png" /&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 08 Nov 2016 20:53:20 GMT</pubDate>
    <dc:creator>Jay54</dc:creator>
    <dc:date>2016-11-08T20:53:20Z</dc:date>
    <item>
      <title>Stacked Bar Chart with 3 variables that total</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Stacked-Bar-Chart-with-3-variables-that-total/m-p/310214#M10900</link>
      <description>&lt;P&gt;Good day,&lt;/P&gt;&lt;P&gt;I am trying to re-create a chart created with Excel where the value of 3 variables are stacked to show a total $ value for each customer.&lt;/P&gt;&lt;P&gt;See Excel example below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Working in Enterprise Guide 7.12 with SAS 9.4 I haven't found any way to do this. I've tried Proc Chart, SGPLOT, FREQ.&lt;/P&gt;&lt;P&gt;Seems this should be simple to do...any help is appreciated.&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG width="546" height="239" title="Excel Example" alt="Excel Example" src="https://communities.sas.com/t5/image/serverpage/image-id/5715i67520A8A0204200C/image-size/original?v=v2&amp;amp;px=-1" border="0" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Nov 2016 19:31:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Stacked-Bar-Chart-with-3-variables-that-total/m-p/310214#M10900</guid>
      <dc:creator>BHull</dc:creator>
      <dc:date>2016-11-08T19:31:01Z</dc:date>
    </item>
    <item>
      <title>Re: Stacked Bar Chart with 3 variables that total</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Stacked-Bar-Chart-with-3-variables-that-total/m-p/310228#M10901</link>
      <description>&lt;P&gt;You just need to transpose you data so that you have three columns: one for the category, one for the response, and one for the group. The first two customers will look like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;U&gt;Customer&lt;/U&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;U&gt;Value&lt;/U&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;U&gt;Breakdown&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;Customer 1 &amp;nbsp; &amp;nbsp; &amp;nbsp;191574 &amp;nbsp; &amp;nbsp; &amp;nbsp;Raw Materials&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Customer 1 &amp;nbsp; &amp;nbsp;1234973 &amp;nbsp; &amp;nbsp; &amp;nbsp;Production Labor&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;Customer 1 &amp;nbsp; &amp;nbsp;2076775 &amp;nbsp; &amp;nbsp; &amp;nbsp;Gross Contribution Margin (before fixed cost)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;Customer 2 &amp;nbsp; &amp;nbsp;4283896 &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;SPAN&gt;Raw Materials&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;Customer 2 &amp;nbsp; &amp;nbsp;1103123 &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;SPAN&gt;Production Labor&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;Customer 2 &amp;nbsp; &amp;nbsp;1955923 &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;SPAN&gt;Gross Contribution Margin (before fixed cost)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;Then, any of the rendering methods you listed should work.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;Hope this helps!&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;SPAN&gt;Dan&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Nov 2016 20:07:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Stacked-Bar-Chart-with-3-variables-that-total/m-p/310228#M10901</guid>
      <dc:creator>DanH_sas</dc:creator>
      <dc:date>2016-11-08T20:07:07Z</dc:date>
    </item>
    <item>
      <title>Re: Stacked Bar Chart with 3 variables that total</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Stacked-Bar-Chart-with-3-variables-that-total/m-p/310230#M10902</link>
      <description>&lt;P&gt;If your data is in the Excel multi-column format, transform it into the grouped data like shown below. &amp;nbsp;Then you can create the required bar chart. &amp;nbsp;You can some options to make it look closer to what you have shown. &amp;nbsp;You can add other options to to get data or segment labels. &amp;nbsp;Fixed code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data excel;&lt;BR /&gt; label Materials='Raw Materials';&lt;BR /&gt; label Labour='Production Labour';&lt;BR /&gt; label Contrib='Gross Contribution Margin';&lt;BR /&gt; input Customer $1-12 Materials Labour Contrib;&lt;BR /&gt; datalines;&lt;BR /&gt;Customer 1 1915740 1234973 2076755&lt;BR /&gt;Customer 2 2838960 1103123 1955923&lt;BR /&gt;Customer 3 2838960 1103123 1955923&lt;BR /&gt;Customer 4 1915740 1234973 2076755&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data stacked;&lt;BR /&gt; length Group $25;&lt;BR /&gt; keep Customer Group Value;&lt;BR /&gt; set excel;&lt;BR /&gt; Group='Raw Materials'; Value=Materials; output;&lt;BR /&gt; Group='Production Labour'; Value=Labour; output;&lt;BR /&gt; Group='Gross Contribution Margin'; Value=Contrib; output;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ods listing;&lt;BR /&gt;proc sgplot data=stacked noborder;&lt;BR /&gt;&amp;nbsp; styleattrs datacolors=(orange gray yellow) datacontrastcolors=(black);&lt;BR /&gt;&amp;nbsp; vbarparm category=customer response=value / group=group &lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;barwidth=0.4;&lt;BR /&gt;&amp;nbsp; yaxis display=(noline noticks) grid;&lt;BR /&gt;&amp;nbsp; xaxis display=(nolabel noticks);&lt;BR /&gt;&amp;nbsp; keylegend / noborder;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/5717iDC4FB04E80AFC7EB/image-size/medium?v=v2&amp;amp;px=-1" border="0" alt="SGPlot9.png" title="SGPlot9.png" /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 08 Nov 2016 20:53:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Stacked-Bar-Chart-with-3-variables-that-total/m-p/310230#M10902</guid>
      <dc:creator>Jay54</dc:creator>
      <dc:date>2016-11-08T20:53:20Z</dc:date>
    </item>
    <item>
      <title>Re: Stacked Bar Chart with 3 variables that total</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Stacked-Bar-Chart-with-3-variables-that-total/m-p/310233#M10903</link>
      <description>&lt;P&gt;Works perfectly...THANKS eveyone!&lt;/P&gt;</description>
      <pubDate>Tue, 08 Nov 2016 20:30:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Stacked-Bar-Chart-with-3-variables-that-total/m-p/310233#M10903</guid>
      <dc:creator>BHull</dc:creator>
      <dc:date>2016-11-08T20:30:40Z</dc:date>
    </item>
  </channel>
</rss>

