<?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: Representation of a histogram stacked at 100% in SAS Visual Analytics</title>
    <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Representation-of-a-histogram-stacked-at-100/m-p/873837#M17177</link>
    <description>&lt;P&gt;Read &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;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you don't need the labels for each segment, PROC FREQ can create the entire plot. FOr more control, use PROC SGPLOT, as shown:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc transpose data=piechart Name=Period out=temp(rename=(col1=Count));
by secteur;
var Annee_2017 Annee_2018 Annee_2019;
run;

/* stacked, but no bar labels */
proc freq data=temp;
tables Period*secteur / plots=freqplot(twoway=stacked scale=grouppct); 
weight Count;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 04 May 2023 10:07:11 GMT</pubDate>
    <dc:creator>Rick_SAS</dc:creator>
    <dc:date>2023-05-04T10:07:11Z</dc:date>
    <item>
      <title>Representation of a histogram stacked at 100%</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Representation-of-a-histogram-stacked-at-100/m-p/873814#M17175</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Gick_1-1683183809605.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/83589iA45623AC4380BEDA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Gick_1-1683183809605.png" alt="Gick_1-1683183809605.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/* Creating the table */
data piechart;
  input secteur $ Annee_2017 Annee_2018 Annee_2019;
  datalines;
  A 35 12 3
  B 10 2 0
  C 22 22 13
  D 40 67 7
  ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;SPAN class="jCAhz ChMk0b"&gt;&lt;SPAN class="ryNqvb"&gt;I wish to have this graph (in image above).&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="jCAhz ChMk0b"&gt;&lt;SPAN class="ryNqvb"&gt;Which procedure allows to have it.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="jCAhz ChMk0b"&gt;&lt;SPAN class="ryNqvb"&gt;Best regards,&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="jCAhz ChMk0b"&gt;&lt;SPAN class="ryNqvb"&gt;Gick&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 04 May 2023 07:05:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Representation-of-a-histogram-stacked-at-100/m-p/873814#M17175</guid>
      <dc:creator>Gick</dc:creator>
      <dc:date>2023-05-04T07:05:27Z</dc:date>
    </item>
    <item>
      <title>Re: Representation of a histogram stacked at 100%</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Representation-of-a-histogram-stacked-at-100/m-p/873820#M17176</link>
      <description>&lt;P&gt;for start use this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data piechart;
  input secteur $ Annee_2017 Annee_2018 Annee_2019;
  datalines;
  A 35 12 3
  B 10 2 0
  C 22 22 13
  D 40 67 7
  ;
run;

proc transpose data=piechart out=temp;
by secteur;
var Annee_2017 Annee_2018 Annee_2019;
run;
data temp;
set temp;
period = _name_;
drop _name_;
run;
proc sort data=temp; 
  by period secteur;
run;

proc freq data=temp noprint;
by period;
table secteur / out=temp1;
weight col1;
run; 

PROC SGPLOT DATA=temp1;
  VBAR period / 
  GROUP=secteur 
  RESPONSE=percent 
  SEGLABEL
  SEGLABELFITPOLICY= NONE
;
RUN;&lt;/CODE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;
&lt;P&gt;you should get (even in M3):&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="yabwon_0-1683186077977.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/83592iAB0B9BC8B8761BDF/image-size/medium?v=v2&amp;amp;px=400" role="button" title="yabwon_0-1683186077977.png" alt="yabwon_0-1683186077977.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;then read about:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1) proc SGPLOT VBAR:&amp;nbsp;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/grstatproc/n0p7vdd69sgf3wn1479qxqxuryrt.htm" target="_blank"&gt;https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/grstatproc/n0p7vdd69sgf3wn1479qxqxuryrt.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;2) some general overview:&amp;nbsp;&lt;A href="https://www.lexjansen.com/wuss/2008/how/how05.pdf" target="_blank"&gt;https://www.lexjansen.com/wuss/2008/how/how05.pdf&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;3) blog posts about plotting with SGPLOT:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;a)&amp;nbsp;&lt;A href="https://blogs.sas.com/content/tag/proc-sgplot/" target="_blank"&gt;https://blogs.sas.com/content/tag/proc-sgplot/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;b)&amp;nbsp;&lt;A href="https://blogs.sas.com/content/tag/sgplot-procedure/" target="_blank"&gt;https://blogs.sas.com/content/tag/sgplot-procedure/&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Bart&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 May 2023 07:41:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Representation-of-a-histogram-stacked-at-100/m-p/873820#M17176</guid>
      <dc:creator>yabwon</dc:creator>
      <dc:date>2023-05-04T07:41:25Z</dc:date>
    </item>
    <item>
      <title>Re: Representation of a histogram stacked at 100%</title>
      <link>https://communities.sas.com/t5/SAS-Visual-Analytics/Representation-of-a-histogram-stacked-at-100/m-p/873837#M17177</link>
      <description>&lt;P&gt;Read &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;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you don't need the labels for each segment, PROC FREQ can create the entire plot. FOr more control, use PROC SGPLOT, as shown:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc transpose data=piechart Name=Period out=temp(rename=(col1=Count));
by secteur;
var Annee_2017 Annee_2018 Annee_2019;
run;

/* stacked, but no bar labels */
proc freq data=temp;
tables Period*secteur / plots=freqplot(twoway=stacked scale=grouppct); 
weight Count;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 04 May 2023 10:07:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Visual-Analytics/Representation-of-a-histogram-stacked-at-100/m-p/873837#M17177</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2023-05-04T10:07:11Z</dc:date>
    </item>
  </channel>
</rss>

