<?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: Change percent to freq in sgplot/hbar in Statistical Procedures</title>
    <link>https://communities.sas.com/t5/Statistical-Procedures/Change-percent-to-freq-in-sgplot-hbar/m-p/721619#M34961</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/370851"&gt;@FloB&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Thank you for the reference, but I have no problem to produce a 100% stacked bar plot.&lt;/P&gt;
&lt;P&gt;The only thing I want to change from the graph I posted is to get the freqencies instead of the percentages displayed inside the segments of the bars&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I suspect you'll have to summarize the data before plotting so you have a variable containing the frequency that can be used to display with a DATALABEL=&amp;lt;freqvar&amp;gt; if you are going to plot percentages.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Going back to the days of GCHART in SAS 6 almost never used the stat= approach to create graphs because I almost always wanted/needed something that was not available. So I would summarize the data to have all the values I needed and control the plot.&lt;/P&gt;</description>
    <pubDate>Wed, 24 Feb 2021 16:49:28 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2021-02-24T16:49:28Z</dc:date>
    <item>
      <title>Change percent to freq in sgplot/hbar</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Change-percent-to-freq-in-sgplot-hbar/m-p/721527#M34948</link>
      <description>&lt;P&gt;Dear all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to get a hbar graph using sgplot to represent the relative contribution of scores (0 to 3) in 2 groups.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="FloB_0-1614164637601.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/55109i8A01A8AD28185AFB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="FloB_0-1614164637601.png" alt="FloB_0-1614164637601.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I used the following code:&lt;/P&gt;&lt;P&gt;data tempo;&lt;BR /&gt;input codetrt score nbpat;&lt;BR /&gt;allpat=1;&lt;BR /&gt;cards;&lt;BR /&gt;1 0 12&lt;BR /&gt;1 1 8&lt;BR /&gt;1 2 5&lt;BR /&gt;1 3 8&lt;BR /&gt;2 0 5&lt;BR /&gt;2 1 6&lt;BR /&gt;2 2 9&lt;BR /&gt;2 3 15&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;proc sgplot data=tempo pctlevel=group ;&lt;BR /&gt;hbar codetrt / response=allpat group=score stat=percent seglabel freq=nbpat;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to get the frequency counts instead of percentages inside each segment.&lt;/P&gt;&lt;P&gt;Could anyone help?&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 24 Feb 2021 11:07:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Change-percent-to-freq-in-sgplot-hbar/m-p/721527#M34948</guid>
      <dc:creator>FloB</dc:creator>
      <dc:date>2021-02-24T11:07:18Z</dc:date>
    </item>
    <item>
      <title>Re: Change percent to freq in sgplot/hbar</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Change-percent-to-freq-in-sgplot-hbar/m-p/721528#M34949</link>
      <description>&lt;P&gt;Like this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sgplot data=tempo pctlevel=group ;
hbar codetrt / response=allpat group=score stat=freq seglabel freq=nbpat;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;P&gt;&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-center" image-alt="Udklip.PNG" style="width: 644px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/55110i4019416D3AB86AB7/image-size/large?v=v2&amp;amp;px=999" role="button" title="Udklip.PNG" alt="Udklip.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Feb 2021 11:17:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Change-percent-to-freq-in-sgplot-hbar/m-p/721528#M34949</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2021-02-24T11:17:45Z</dc:date>
    </item>
    <item>
      <title>Re: Change percent to freq in sgplot/hbar</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Change-percent-to-freq-in-sgplot-hbar/m-p/721531#M34950</link>
      <description>Not quite...&lt;BR /&gt;&lt;BR /&gt;As in the same time, I want the cumulative percent to add-up to 100% in each group, and get the cumulative percent on the x-axis.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 24 Feb 2021 11:27:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Change-percent-to-freq-in-sgplot-hbar/m-p/721531#M34950</guid>
      <dc:creator>FloB</dc:creator>
      <dc:date>2021-02-24T11:27:47Z</dc:date>
    </item>
    <item>
      <title>Re: Change percent to freq in sgplot/hbar</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Change-percent-to-freq-in-sgplot-hbar/m-p/721533#M34951</link>
      <description>&lt;P&gt;See the article &lt;A href="https://blogs.sas.com/content/iml/2014/04/08/construct-a-stacked-bar-chart-in-sas-where-each-bar-equals-100.html" target="_self"&gt;"Construct a stacked bar chart in SAS where each bar equals 100%"&lt;/A&gt;, which includes code for PROC SGPLOT. The article does not use the SEGLEVEL option, but I think you already know how to do that.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Feb 2021 11:40:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Change-percent-to-freq-in-sgplot-hbar/m-p/721533#M34951</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2021-02-24T11:40:23Z</dc:date>
    </item>
    <item>
      <title>Re: Change percent to freq in sgplot/hbar</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Change-percent-to-freq-in-sgplot-hbar/m-p/721538#M34952</link>
      <description>&lt;P&gt;Thank you for the reference, but I have no problem to produce a 100% stacked bar plot.&lt;/P&gt;&lt;P&gt;The only thing I want to change from the graph I posted is to get the freqencies instead of the percentages displayed inside the segments of the bars&lt;/P&gt;</description>
      <pubDate>Wed, 24 Feb 2021 11:58:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Change-percent-to-freq-in-sgplot-hbar/m-p/721538#M34952</guid>
      <dc:creator>FloB</dc:creator>
      <dc:date>2021-02-24T11:58:45Z</dc:date>
    </item>
    <item>
      <title>Re: Change percent to freq in sgplot/hbar</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Change-percent-to-freq-in-sgplot-hbar/m-p/721619#M34961</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/370851"&gt;@FloB&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Thank you for the reference, but I have no problem to produce a 100% stacked bar plot.&lt;/P&gt;
&lt;P&gt;The only thing I want to change from the graph I posted is to get the freqencies instead of the percentages displayed inside the segments of the bars&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I suspect you'll have to summarize the data before plotting so you have a variable containing the frequency that can be used to display with a DATALABEL=&amp;lt;freqvar&amp;gt; if you are going to plot percentages.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Going back to the days of GCHART in SAS 6 almost never used the stat= approach to create graphs because I almost always wanted/needed something that was not available. So I would summarize the data to have all the values I needed and control the plot.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Feb 2021 16:49:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Change-percent-to-freq-in-sgplot-hbar/m-p/721619#M34961</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2021-02-24T16:49:28Z</dc:date>
    </item>
    <item>
      <title>Re: Change percent to freq in sgplot/hbar</title>
      <link>https://communities.sas.com/t5/Statistical-Procedures/Change-percent-to-freq-in-sgplot-hbar/m-p/722077#M34984</link>
      <description>Thank you all for considering my request.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I finally managed to get what I wanted with the sganno= option and the annotate facilities using a table from a previous PROC FREQ&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 26 Feb 2021 09:31:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Statistical-Procedures/Change-percent-to-freq-in-sgplot-hbar/m-p/722077#M34984</guid>
      <dc:creator>FloB</dc:creator>
      <dc:date>2021-02-26T09:31:47Z</dc:date>
    </item>
  </channel>
</rss>

