<?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: Trying to plot vbar with categorical variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Trying-to-plot-vbar-with-categorical-variable/m-p/609127#M177322</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/286271"&gt;@vedaj16&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;The output gives the GPA of all school size. PS SchoolSize variable have Large, Medium and Small categories.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How do I add group?&lt;/P&gt;
&lt;P&gt;if I add group :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;title h=14pt "GPA by Gender";&lt;/P&gt;
&lt;P&gt;proc sgplot data=BAS150.College;&lt;BR /&gt;vbar Gender / response=GPA stat=mean datalabel datalabelattrs=(size=14pt)&lt;BR /&gt;group= SchoolSize;&lt;BR /&gt;xaxis label="Gender" labelattrs=(size=14pt);&lt;BR /&gt;yaxis label="Mean GPA" labelattrs=(size=14pt);&lt;BR /&gt;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;then output is all the group of schoolsize in that vbar.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;By default the Vbar Group= option with create a vertical stack of the group values. If you want a single bar for each group add:&lt;/P&gt;
&lt;P&gt;Groupdisplay = Cluster to override the default Groupdisplay =Stack.&lt;/P&gt;
&lt;PRE&gt;title h=14pt "GPA by Gender";

proc sgplot data=BAS150.College;
   vbar Gender / response=GPA stat=mean datalabel datalabelattrs=(size=14pt)
       group= SchoolSize groupdisplay=cluster;
   xaxis label="Gender" labelattrs=(size=14pt);
   yaxis label="Mean GPA" labelattrs=(size=14pt);

run;
&lt;/PRE&gt;</description>
    <pubDate>Tue, 03 Dec 2019 17:37:57 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2019-12-03T17:37:57Z</dc:date>
    <item>
      <title>Trying to plot vbar with categorical variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Trying-to-plot-vbar-with-categorical-variable/m-p/608904#M177247</link>
      <description>&lt;P&gt;&lt;SPAN&gt;I am trying to create a vertical bar using a data set. The chart compares the mean GPA&amp;nbsp;by gender for medium-sized schools. I used below code:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;title h=14pt "GPA by Gender";&lt;/P&gt;&lt;P&gt;proc sgplot data=BAS150.College;&lt;BR /&gt;vbar Gender / response=GPA stat=mean datalabel datalabelattrs=(size=14pt);&lt;BR /&gt;xaxis label="Gender" labelattrs=(size=14pt);&lt;BR /&gt;yaxis label="Mean GPA" labelattrs=(size=14pt);&lt;BR /&gt;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;The output gives the GPA of all school size. PS SchoolSize variable have Large, Medium and Small categories.&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do I add group?&lt;/P&gt;&lt;P&gt;if I add group :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;title h=14pt "GPA by Gender";&lt;/P&gt;&lt;P&gt;proc sgplot data=BAS150.College;&lt;BR /&gt;vbar Gender / response=GPA stat=mean datalabel datalabelattrs=(size=14pt)&lt;BR /&gt;group= SchoolSize;&lt;BR /&gt;xaxis label="Gender" labelattrs=(size=14pt);&lt;BR /&gt;yaxis label="Mean GPA" labelattrs=(size=14pt);&lt;BR /&gt;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;then output is all the group of schoolsize in that vbar.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I filter schoolsize to medium and then plot the graph?&lt;/P&gt;&lt;P&gt;please help&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Dec 2019 01:45:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Trying-to-plot-vbar-with-categorical-variable/m-p/608904#M177247</guid>
      <dc:creator>vedaj16</dc:creator>
      <dc:date>2019-12-03T01:45:52Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to plot vbar with categorical variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Trying-to-plot-vbar-with-categorical-variable/m-p/608905#M177248</link>
      <description>&lt;P&gt;My bad &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I put medium instead of M&amp;nbsp;&lt;/P&gt;&lt;P&gt;My where statement worked not &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;title h=14pt "GPA by Gender of Medium Size School";&lt;/P&gt;&lt;P&gt;proc sgplot data=BAS150.COLLEGE (where =(SchoolSize = 'M'));&lt;BR /&gt;vbar Gender / response=GPA stat=mean datalabel datalabelattrs=(size=14pt)&lt;BR /&gt;;&lt;BR /&gt;xaxis label="Gender" labelattrs=(size=14pt);&lt;BR /&gt;yaxis label="Mean GPA" labelattrs=(size=14pt);&lt;BR /&gt;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Dec 2019 02:02:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Trying-to-plot-vbar-with-categorical-variable/m-p/608905#M177248</guid>
      <dc:creator>vedaj16</dc:creator>
      <dc:date>2019-12-03T02:02:01Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to plot vbar with categorical variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Trying-to-plot-vbar-with-categorical-variable/m-p/609127#M177322</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/286271"&gt;@vedaj16&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;The output gives the GPA of all school size. PS SchoolSize variable have Large, Medium and Small categories.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;How do I add group?&lt;/P&gt;
&lt;P&gt;if I add group :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;title h=14pt "GPA by Gender";&lt;/P&gt;
&lt;P&gt;proc sgplot data=BAS150.College;&lt;BR /&gt;vbar Gender / response=GPA stat=mean datalabel datalabelattrs=(size=14pt)&lt;BR /&gt;group= SchoolSize;&lt;BR /&gt;xaxis label="Gender" labelattrs=(size=14pt);&lt;BR /&gt;yaxis label="Mean GPA" labelattrs=(size=14pt);&lt;BR /&gt;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;then output is all the group of schoolsize in that vbar.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;By default the Vbar Group= option with create a vertical stack of the group values. If you want a single bar for each group add:&lt;/P&gt;
&lt;P&gt;Groupdisplay = Cluster to override the default Groupdisplay =Stack.&lt;/P&gt;
&lt;PRE&gt;title h=14pt "GPA by Gender";

proc sgplot data=BAS150.College;
   vbar Gender / response=GPA stat=mean datalabel datalabelattrs=(size=14pt)
       group= SchoolSize groupdisplay=cluster;
   xaxis label="Gender" labelattrs=(size=14pt);
   yaxis label="Mean GPA" labelattrs=(size=14pt);

run;
&lt;/PRE&gt;</description>
      <pubDate>Tue, 03 Dec 2019 17:37:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Trying-to-plot-vbar-with-categorical-variable/m-p/609127#M177322</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-12-03T17:37:57Z</dc:date>
    </item>
  </channel>
</rss>

