<?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: Help creating bar chart of binary variable within groups (and including CI or std) in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Help-creating-bar-chart-of-binary-variable-within-groups-and/m-p/641881#M191405</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/123566"&gt;@cjp13&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Could you please provide some sample data?&lt;/P&gt;
&lt;P&gt;Best,&lt;/P&gt;</description>
    <pubDate>Wed, 22 Apr 2020 11:30:10 GMT</pubDate>
    <dc:creator>ed_sas_member</dc:creator>
    <dc:date>2020-04-22T11:30:10Z</dc:date>
    <item>
      <title>Help creating bar chart of binary variable within groups (and including CI or std)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-creating-bar-chart-of-binary-variable-within-groups-and/m-p/641866#M191399</link>
      <description>&lt;P&gt;Really basic question here!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have categorized my data into age groups (age5y) and want to create a vertical bar chart of the percentage of each age group that has a certain health condition (IAD, UKAD, IAS02_new, IAR02_new). These health condition variables are binary (0=no, 1=yes). &amp;nbsp;The chart produced with the code below shows the percentage of the age group's frequency of having that condition out of the TOTAL number of cases in the sample instead of the percentage of those who have the condition among that age group.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried changing stat to percent as well but that doesn't help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sgplot data=recode;&lt;BR /&gt;vbar age5y / response=IAD stat=pct limitstat=clm;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am happy to change the chart type if necessary. &amp;nbsp;I would also like to include confidence intervals or standard deviations.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Eventually, I would like to cluster the conditions such that I have the percentage of each condition per age group in one chart.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks so much!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Apr 2020 10:08:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-creating-bar-chart-of-binary-variable-within-groups-and/m-p/641866#M191399</guid>
      <dc:creator>cjp13</dc:creator>
      <dc:date>2020-04-22T10:08:36Z</dc:date>
    </item>
    <item>
      <title>Re: Help creating bar chart of binary variable within groups (and including CI or std)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-creating-bar-chart-of-binary-variable-within-groups-and/m-p/641881#M191405</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/123566"&gt;@cjp13&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Could you please provide some sample data?&lt;/P&gt;
&lt;P&gt;Best,&lt;/P&gt;</description>
      <pubDate>Wed, 22 Apr 2020 11:30:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-creating-bar-chart-of-binary-variable-within-groups-and/m-p/641881#M191405</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2020-04-22T11:30:10Z</dc:date>
    </item>
    <item>
      <title>Re: Help creating bar chart of binary variable within groups (and including CI or std)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-creating-bar-chart-of-binary-variable-within-groups-and/m-p/641932#M191430</link>
      <description>&lt;P&gt;Try something like this:&lt;/P&gt;
&lt;P&gt;proc sgplot data=temp;&lt;BR /&gt;vbar x1 / group=age groupdisplay=cluster stat=percent;&lt;BR /&gt;where x1=1;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Apr 2020 13:42:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-creating-bar-chart-of-binary-variable-within-groups-and/m-p/641932#M191430</guid>
      <dc:creator>djmangen</dc:creator>
      <dc:date>2020-04-22T13:42:27Z</dc:date>
    </item>
    <item>
      <title>Re: Help creating bar chart of binary variable within groups (and including CI or std)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-creating-bar-chart-of-binary-variable-within-groups-and/m-p/642017#M191470</link>
      <description>&lt;P&gt;When I do that, I still get a chart that reports percentage of the total number of cases of all age groups.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2020-04-22 at 10.01.33 AM.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/38553i232D63B134C3A023/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Screen Shot 2020-04-22 at 10.01.33 AM.png" alt="Screen Shot 2020-04-22 at 10.01.33 AM.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like each bar to represent the percentage of positives per age group. &amp;nbsp;For example, for my &amp;lt;6m age group, there were 29/235 positive samples for 12.3% for IAD. &amp;nbsp;IAD is the variable name (this table is from Excel). Note: there are more age groups in my age6mo variable than I have listed in the table below. &amp;nbsp;It is abbreviated for brevity. &amp;nbsp;I am also trying to get the 95% CI on each bar.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;Age6mo&lt;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.8%&lt;/TD&gt;&lt;TD&gt;12.0%&lt;/TD&gt;&lt;TD&gt;15.1%&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;</description>
      <pubDate>Wed, 22 Apr 2020 17:09:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-creating-bar-chart-of-binary-variable-within-groups-and/m-p/642017#M191470</guid>
      <dc:creator>cjp13</dc:creator>
      <dc:date>2020-04-22T17:09:09Z</dc:date>
    </item>
    <item>
      <title>Re: Help creating bar chart of binary variable within groups (and including CI or std)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-creating-bar-chart-of-binary-variable-within-groups-and/m-p/642019#M191472</link>
      <description>I just posted some data below. Thank you!</description>
      <pubDate>Wed, 22 Apr 2020 17:09:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-creating-bar-chart-of-binary-variable-within-groups-and/m-p/642019#M191472</guid>
      <dc:creator>cjp13</dc:creator>
      <dc:date>2020-04-22T17:09:37Z</dc:date>
    </item>
    <item>
      <title>Re: Help creating bar chart of binary variable within groups (and including CI or std)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Help-creating-bar-chart-of-binary-variable-within-groups-and/m-p/642107#M191520</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/123566"&gt;@cjp13&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;I just posted some data below. Thank you!&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I don't see any data. I see a picture of a summary table of some sort.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Instructions here: &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712&lt;/A&gt; will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the &amp;lt;&amp;gt; icon or attached as text to show exactly what you have and that we can test code against.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Very likely your existing data needs to be massaged but can't make a specific recommendation because I can't see any data.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Apr 2020 22:19:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Help-creating-bar-chart-of-binary-variable-within-groups-and/m-p/642107#M191520</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2020-04-22T22:19:46Z</dc:date>
    </item>
  </channel>
</rss>

