<?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 creating a histogram for the total of a variable broken down by two crossed classification variables in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/creating-a-histogram-for-the-total-of-a-variable-broken-down-by/m-p/904516#M357361</link>
    <description>&lt;P&gt;I can get separate histograms for each occurrence of the variable "tipo" by using this code&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sgplot data=dc6 NOAUTOLEGEND;&lt;BR /&gt;vbar cod_prob /response=popresidente group=cod_prob;&lt;BR /&gt;title justify=center "xxxxx";&lt;BR /&gt;xaxis label='probability (%)' labelattrs=(size=7) valueattrs=(size=7);&lt;BR /&gt;yaxis label='population' labelattrs=(size=7) valueattrs=(size=7) values=(0 to 15000000 by 1000000);&lt;BR /&gt;format popresidente comma10.0;&lt;BR /&gt;by tipo;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wonder whether it is possibile with SAS to obtain a histogram with separate groups of bars, like in graph attached I made by using excel.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your help&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Leandro D'Aurizio&lt;/P&gt;&lt;P&gt;IVASS (Italy)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sat, 25 Nov 2023 15:25:12 GMT</pubDate>
    <dc:creator>leandro4</dc:creator>
    <dc:date>2023-11-25T15:25:12Z</dc:date>
    <item>
      <title>creating a histogram for the total of a variable broken down by two crossed classification variables</title>
      <link>https://communities.sas.com/t5/SAS-Programming/creating-a-histogram-for-the-total-of-a-variable-broken-down-by/m-p/904516#M357361</link>
      <description>&lt;P&gt;I can get separate histograms for each occurrence of the variable "tipo" by using this code&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc sgplot data=dc6 NOAUTOLEGEND;&lt;BR /&gt;vbar cod_prob /response=popresidente group=cod_prob;&lt;BR /&gt;title justify=center "xxxxx";&lt;BR /&gt;xaxis label='probability (%)' labelattrs=(size=7) valueattrs=(size=7);&lt;BR /&gt;yaxis label='population' labelattrs=(size=7) valueattrs=(size=7) values=(0 to 15000000 by 1000000);&lt;BR /&gt;format popresidente comma10.0;&lt;BR /&gt;by tipo;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wonder whether it is possibile with SAS to obtain a histogram with separate groups of bars, like in graph attached I made by using excel.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your help&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Leandro D'Aurizio&lt;/P&gt;&lt;P&gt;IVASS (Italy)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 25 Nov 2023 15:25:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/creating-a-histogram-for-the-total-of-a-variable-broken-down-by/m-p/904516#M357361</guid>
      <dc:creator>leandro4</dc:creator>
      <dc:date>2023-11-25T15:25:12Z</dc:date>
    </item>
    <item>
      <title>Re: creating a histogram for the total of a variable broken down by two crossed classification varia</title>
      <link>https://communities.sas.com/t5/SAS-Programming/creating-a-histogram-for-the-total-of-a-variable-broken-down-by/m-p/904519#M357363</link>
      <description>&lt;P&gt;In a DATA step, create a new variable which is the combination of the two classification variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;new_class_var = cats(tipo,'/'second_class_var);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 25 Nov 2023 16:50:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/creating-a-histogram-for-the-total-of-a-variable-broken-down-by/m-p/904519#M357363</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2023-11-25T16:50:21Z</dc:date>
    </item>
    <item>
      <title>Re: creating a histogram for the total of a variable broken down by two crossed classification varia</title>
      <link>https://communities.sas.com/t5/SAS-Programming/creating-a-histogram-for-the-total-of-a-variable-broken-down-by/m-p/904546#M357374</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*
I think your code is enough to get this kind of graph.
*/
proc format;
value cod_prob
1='0.00-0.05'
2='0.05-0.10'
3='0.10-0.15'
4='0.15-0.20'
;

value tipo
1='MPS04(median)'
2='PRASSE'
3='MPS19(mean)'
;
run;

data dc6;
call streaminit(123);
do tipo=1 to 3;
 do cod_prob=1 to 4;
   popresidente=rand('integer',1,100000);
   output;
 end;
end;
format tipo tipo. cod_prob cod_prob.;
run;

proc sgplot data=dc6 ;
vbar cod_prob /response=popresidente group=tipo groupdisplay=cluster;
title justify=center "xxxxx";
xaxis label='probability (%)' labelattrs=(size=7) valueattrs=(size=7);
yaxis label='population' labelattrs=(size=7) valueattrs=(size=7) ;
format popresidente comma10.0;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1700991568762.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/90192i17E2B16656C99CE8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1700991568762.png" alt="Ksharp_0-1700991568762.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 26 Nov 2023 09:39:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/creating-a-histogram-for-the-total-of-a-variable-broken-down-by/m-p/904546#M357374</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2023-11-26T09:39:36Z</dc:date>
    </item>
    <item>
      <title>Re: creating a histogram for the total of a variable broken down by two crossed classification varia</title>
      <link>https://communities.sas.com/t5/SAS-Programming/creating-a-histogram-for-the-total-of-a-variable-broken-down-by/m-p/904606#M357388</link>
      <description>&lt;P&gt;Thanks! It works perfectly.&lt;/P&gt;</description>
      <pubDate>Mon, 27 Nov 2023 09:32:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/creating-a-histogram-for-the-total-of-a-variable-broken-down-by/m-p/904606#M357388</guid>
      <dc:creator>leandro4</dc:creator>
      <dc:date>2023-11-27T09:32:58Z</dc:date>
    </item>
  </channel>
</rss>

