<?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: Gchart clustered bar chart in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/Gchart-clustered-bar-chart/m-p/732614#M21327</link>
    <description>&lt;P&gt;Thank you so much, it was very helpful!&lt;/P&gt;&lt;P&gt;One more question what would be the best wat to show the percentage for each bar?&lt;/P&gt;</description>
    <pubDate>Fri, 09 Apr 2021 19:35:28 GMT</pubDate>
    <dc:creator>JaneS</dc:creator>
    <dc:date>2021-04-09T19:35:28Z</dc:date>
    <item>
      <title>Gchart clustered bar chart</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Gchart-clustered-bar-chart/m-p/732576#M21321</link>
      <description>&lt;P&gt;I have a question how to create a clustered graph is SAS.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The data is the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Year&lt;/TD&gt;&lt;TD&gt;County&lt;/TD&gt;&lt;TD&gt;Statewide&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2015&lt;/TD&gt;&lt;TD&gt;20.00%&lt;/TD&gt;&lt;TD&gt;50.00%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2016&lt;/TD&gt;&lt;TD&gt;40.00%&lt;/TD&gt;&lt;TD&gt;32.00%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2017&lt;/TD&gt;&lt;TD&gt;30.00%&lt;/TD&gt;&lt;TD&gt;12.00%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2018&lt;/TD&gt;&lt;TD&gt;70.00%&lt;/TD&gt;&lt;TD&gt;0.00%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2019&lt;/TD&gt;&lt;TD&gt;90.00%&lt;/TD&gt;&lt;TD&gt;80.00%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2020&lt;/TD&gt;&lt;TD&gt;100.00%&lt;/TD&gt;&lt;TD&gt;90.00%&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;2021&lt;/TD&gt;&lt;TD&gt;100.00%&lt;/TD&gt;&lt;TD&gt;100.00%&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And the graph I am trying to create in SAS is the following:&amp;nbsp;&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="JaneS_0-1617991907196.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/57232i84BE416AFCDA2D8B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JaneS_0-1617991907196.png" alt="JaneS_0-1617991907196.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Could you please help with the code for it? I was thinking to use proc gchart but then it looks like there should be two vbar arguments and I am not sure how to combine them.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Fri, 09 Apr 2021 18:14:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Gchart-clustered-bar-chart/m-p/732576#M21321</guid>
      <dc:creator>JaneS</dc:creator>
      <dc:date>2021-04-09T18:14:39Z</dc:date>
    </item>
    <item>
      <title>Re: Gchart clustered bar chart</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Gchart-clustered-bar-chart/m-p/732605#M21326</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/351071"&gt;@JaneS&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I have a question how to create a clustered graph is SAS.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The data is the following:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD&gt;Year&lt;/TD&gt;
&lt;TD&gt;County&lt;/TD&gt;
&lt;TD&gt;Statewide&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;2015&lt;/TD&gt;
&lt;TD&gt;20.00%&lt;/TD&gt;
&lt;TD&gt;50.00%&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;2016&lt;/TD&gt;
&lt;TD&gt;40.00%&lt;/TD&gt;
&lt;TD&gt;32.00%&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;2017&lt;/TD&gt;
&lt;TD&gt;30.00%&lt;/TD&gt;
&lt;TD&gt;12.00%&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;2018&lt;/TD&gt;
&lt;TD&gt;70.00%&lt;/TD&gt;
&lt;TD&gt;0.00%&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;2019&lt;/TD&gt;
&lt;TD&gt;90.00%&lt;/TD&gt;
&lt;TD&gt;80.00%&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;2020&lt;/TD&gt;
&lt;TD&gt;100.00%&lt;/TD&gt;
&lt;TD&gt;90.00%&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;2021&lt;/TD&gt;
&lt;TD&gt;100.00%&lt;/TD&gt;
&lt;TD&gt;100.00%&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And the graph I am trying to create in SAS is the following:&amp;nbsp;&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="JaneS_0-1617991907196.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/57232i84BE416AFCDA2D8B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JaneS_0-1617991907196.png" alt="JaneS_0-1617991907196.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Could you please help with the code for it? I was thinking to use proc gchart but then it looks like there should be two vbar arguments and I am not sure how to combine them.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you!&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;To have reasonable control over the "clustering" you need to reshape the data a bit so that the same variable holds the county and statewide as values.&lt;/P&gt;
&lt;P&gt;Here is an example:&lt;/P&gt;
&lt;PRE&gt;data have;
   input Year	County:percent8.	Statewide:Percent8.;
datalines;
2015	20.00%	50.00%
2016	40.00%	32.00%
2017	30.00%	12.00%
2018	70.00%	0.00%
2019	90.00%	80.00%
2020	100.00%	90.00%
2021	100.00%	100.00%
;

proc transpose data=have out=need;
   by year;
run;   


proc sgplot data=need;
   vbar year / response=COL1 group=_name_
              groupdisplay=cluster;
   format col1 percent8.;
   label _name_='Source'
         col1 ='Value'
   ;
run;
    &lt;/PRE&gt;
&lt;P&gt;Proc transpose is a basic tool for reshaping the data. I did not get into any of the options for renaming variables.&lt;/P&gt;
&lt;P&gt;I strongly suggest use of SGPLOT instead of Gchart as there are more options to control appearance and is where SAS is concentrating improvements.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Apr 2021 19:04:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Gchart-clustered-bar-chart/m-p/732605#M21326</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-04-09T19:04:37Z</dc:date>
    </item>
    <item>
      <title>Re: Gchart clustered bar chart</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Gchart-clustered-bar-chart/m-p/732614#M21327</link>
      <description>&lt;P&gt;Thank you so much, it was very helpful!&lt;/P&gt;&lt;P&gt;One more question what would be the best wat to show the percentage for each bar?&lt;/P&gt;</description>
      <pubDate>Fri, 09 Apr 2021 19:35:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Gchart-clustered-bar-chart/m-p/732614#M21327</guid>
      <dc:creator>JaneS</dc:creator>
      <dc:date>2021-04-09T19:35:28Z</dc:date>
    </item>
    <item>
      <title>Re: Gchart clustered bar chart</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Gchart-clustered-bar-chart/m-p/732638#M21328</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/351071"&gt;@JaneS&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Thank you so much, it was very helpful!&lt;/P&gt;
&lt;P&gt;One more question what would be the best wat to show the percentage for each bar?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I suggest looking at the documentation here: &lt;A href="https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.4&amp;amp;docsetId=grstatproc&amp;amp;docsetTarget=n0yjdd910dh59zn1toodgupaj4v9.htm&amp;amp;locale=en"&gt;https://documentation.sas.com/?cdcId=pgmsascdc&amp;amp;cdcVersion=9.4_3.4&amp;amp;docsetId=grstatproc&amp;amp;docsetTarget=n0yjdd910dh59zn1toodgupaj4v9.htm&amp;amp;locale=en&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Knowing where to look is half the battle and since the SGPLOT procedure has roughly 50 different statements, some with 30+ options spend some getting famililiar.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The option DATALABEL will show default labels of values, or if have a different variable in the data set you want to show then Datalabel=thatvariablename&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Apr 2021 20:16:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Gchart-clustered-bar-chart/m-p/732638#M21328</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-04-09T20:16:15Z</dc:date>
    </item>
  </channel>
</rss>

