<?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 graph of column percentages for subgroups in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/Stacked-bar-graph-of-column-percentages-for-subgroups/m-p/728665#M21209</link>
    <description>&lt;P&gt;To display column percentages (instead of overall percentages) in a stacked bar chart, you can use the&amp;nbsp;&lt;A href="https://documentation.sas.com/?docsetId=statug&amp;amp;docsetTarget=statug_freq_syntax08.htm&amp;amp;docsetVersion=15.2&amp;amp;locale=en#statug.freq.freqpscale" target="_self"&gt;SCALE=GROUPPERCENT&lt;/A&gt;&amp;nbsp;plot-option in PROC FREQ.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc freq data=moroc6;
   tables disease * location / plots=freqplot(scale=grouppercent twoway=stacked);
   weight sampling_weight;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For a stacked bar chart (which doesn't display standard errors or confidence limits), you can use PROC FREQ instead of PROC SURVEYFREQ; specify the same WEIGHT statement in PROC FREQ (to produce the same estimates of frequencies and percentages that PROC SURVEYFREQ produces).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Yes, the column percentages (which are percentages of the column totals) will be different if you exclude the Disease='None' cases.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 24 Mar 2021 03:46:37 GMT</pubDate>
    <dc:creator>Watts</dc:creator>
    <dc:date>2021-03-24T03:46:37Z</dc:date>
    <item>
      <title>Stacked bar graph of column percentages for subgroups</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Stacked-bar-graph-of-column-percentages-for-subgroups/m-p/728598#M21206</link>
      <description>&lt;P&gt;Greetings,&lt;/P&gt;
&lt;P&gt;I have a data set of a survey, and the program below generates a stacked bar graph of the percentage of DISEASE status (3 categories) by LOCATION. However, the graph uses the percentages of the total sample, whereas I want the graph to show the column percentages, and only for diseased individuals.&lt;/P&gt;
&lt;P&gt;I tried using WHERE statement to include only the diseased groups, but the percentages becomes wrong. Is there a way around that?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;ods graphics on;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt; &lt;STRONG&gt;surveyfreq&lt;/STRONG&gt; data=moroc6 order=formatted;&lt;/P&gt;
&lt;P&gt;tables disease * location /col nowt nototal plots= freqplot(groupby=column twoway=stacked scale=percent);&lt;/P&gt;
&lt;P&gt;&amp;nbsp; where disease in ("Acute" , "Chron" , "None");&lt;/P&gt;
&lt;P&gt;cluster province;&lt;/P&gt;
&lt;P&gt;strata region;&lt;/P&gt;
&lt;P&gt;weight sampling_weight;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;run&lt;/STRONG&gt;;&lt;/P&gt;
&lt;P&gt;ods graphics off;&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-inline" image-alt="Jason2020_0-1616541934735.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/56345i398B92EDDA57628D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Jason2020_0-1616541934735.png" alt="Jason2020_0-1616541934735.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Mar 2021 23:27:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Stacked-bar-graph-of-column-percentages-for-subgroups/m-p/728598#M21206</guid>
      <dc:creator>Jason2020</dc:creator>
      <dc:date>2021-03-23T23:27:53Z</dc:date>
    </item>
    <item>
      <title>Re: Stacked bar graph of column percentages for subgroups</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Stacked-bar-graph-of-column-percentages-for-subgroups/m-p/728665#M21209</link>
      <description>&lt;P&gt;To display column percentages (instead of overall percentages) in a stacked bar chart, you can use the&amp;nbsp;&lt;A href="https://documentation.sas.com/?docsetId=statug&amp;amp;docsetTarget=statug_freq_syntax08.htm&amp;amp;docsetVersion=15.2&amp;amp;locale=en#statug.freq.freqpscale" target="_self"&gt;SCALE=GROUPPERCENT&lt;/A&gt;&amp;nbsp;plot-option in PROC FREQ.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc freq data=moroc6;
   tables disease * location / plots=freqplot(scale=grouppercent twoway=stacked);
   weight sampling_weight;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For a stacked bar chart (which doesn't display standard errors or confidence limits), you can use PROC FREQ instead of PROC SURVEYFREQ; specify the same WEIGHT statement in PROC FREQ (to produce the same estimates of frequencies and percentages that PROC SURVEYFREQ produces).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Yes, the column percentages (which are percentages of the column totals) will be different if you exclude the Disease='None' cases.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Mar 2021 03:46:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Stacked-bar-graph-of-column-percentages-for-subgroups/m-p/728665#M21209</guid>
      <dc:creator>Watts</dc:creator>
      <dc:date>2021-03-24T03:46:37Z</dc:date>
    </item>
    <item>
      <title>Re: Stacked bar graph of column percentages for subgroups</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Stacked-bar-graph-of-column-percentages-for-subgroups/m-p/728737#M21214</link>
      <description>&lt;P&gt;Thank you for the solution. I now can see that Proc Freq can produce a plot of column percentages (it is odd that surveyfreq couldn't). Although this is useful, it doesn't solve my other issue (i.e., select only diseased subjects, without changing the column percentages). I therefore will modify my question.&lt;/P&gt;
&lt;P&gt;The following program will output a subset of the column percentages to a new data set (see print out below). Can someone please direct me to which procedure will make the stacked plot, preferably if you can suggest the statement that will do the task. Thanks in advance.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc surveyfreq data=moroc6 order=formatted;&lt;BR /&gt;tables disease * location /col nowt; &lt;BR /&gt;cluster province;&lt;BR /&gt;strata region;&lt;BR /&gt;weight sampling_weight;&lt;BR /&gt;ods output crosstabs = Table1 (keep =disease location colPercent);&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc print data=table1;&lt;BR /&gt;where (disease ="Acute" or disease ="Chron") and location ne " ";&lt;BR /&gt;format colpercent 6.1;&lt;BR /&gt;run;&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="Jason2020_0-1616590682893.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/56392iFF4C54D448276F60/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Jason2020_0-1616590682893.png" alt="Jason2020_0-1616590682893.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Mar 2021 13:00:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Stacked-bar-graph-of-column-percentages-for-subgroups/m-p/728737#M21214</guid>
      <dc:creator>Jason2020</dc:creator>
      <dc:date>2021-03-24T13:00:01Z</dc:date>
    </item>
    <item>
      <title>Re: Stacked bar graph of column percentages for subgroups</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/Stacked-bar-graph-of-column-percentages-for-subgroups/m-p/728763#M21215</link>
      <description>&lt;P&gt;Actually did some research and found the solution:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;proc surveyfreq data=moroc6 order=formatted;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;tables disease * location /col nowt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;cluster province;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;strata region;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;weight sampling_weight;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ods output crosstabs = Table1 (keep =disease location colPercent);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;run;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sgplot data=table1 (where= ((disease ="Acute" or disease ="Chron") and location ne " "));&lt;BR /&gt;format colpercent 6.1;&lt;BR /&gt;vbar location / response=colpercent group=disease;&lt;BR /&gt;xaxis display=(nolabel);&lt;BR /&gt;yaxis grid;&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Wed, 24 Mar 2021 14:52:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/Stacked-bar-graph-of-column-percentages-for-subgroups/m-p/728763#M21215</guid>
      <dc:creator>Jason2020</dc:creator>
      <dc:date>2021-03-24T14:52:33Z</dc:date>
    </item>
  </channel>
</rss>

