<?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 Proc Sgplot Vbar with two columns as bars (stacked) in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Proc-Sgplot-Vbar-with-two-columns-as-bars-stacked/m-p/691984#M210703</link>
    <description>&lt;P&gt;Hello everyone!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm having a dataset in SAS which looks similar to the below picture one and I am trying to create the same graph in SAS with proc sgplot and vbar, however, I struggle to be able to choose the two columns for the bars. With the response and group command I can only choose one of each...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also tried it with two vbars in one proc sgplot&amp;nbsp;and the response being for one active cases and for the other passive cases, however, that did not work properly.&lt;/P&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;Is there any way how I can achieve creating the below graph? Or do I have to change my dataset first, if yes, how? I'd prefer to stay with proc sgplot, if possible. Any help is greatly appreciated &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2020-10-16 095535.png" style="width: 409px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/50700iC4BEE39FA7D3CF1B/image-dimensions/409x408?v=v2" width="409" height="408" role="button" title="Screenshot 2020-10-16 095535.png" alt="Screenshot 2020-10-16 095535.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 15 Oct 2020 23:03:53 GMT</pubDate>
    <dc:creator>CIG21</dc:creator>
    <dc:date>2020-10-15T23:03:53Z</dc:date>
    <item>
      <title>Proc Sgplot Vbar with two columns as bars (stacked)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Sgplot-Vbar-with-two-columns-as-bars-stacked/m-p/691984#M210703</link>
      <description>&lt;P&gt;Hello everyone!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm having a dataset in SAS which looks similar to the below picture one and I am trying to create the same graph in SAS with proc sgplot and vbar, however, I struggle to be able to choose the two columns for the bars. With the response and group command I can only choose one of each...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also tried it with two vbars in one proc sgplot&amp;nbsp;and the response being for one active cases and for the other passive cases, however, that did not work properly.&lt;/P&gt;&lt;DIV class="mceNonEditable lia-copypaste-placeholder"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;Is there any way how I can achieve creating the below graph? Or do I have to change my dataset first, if yes, how? I'd prefer to stay with proc sgplot, if possible. Any help is greatly appreciated &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2020-10-16 095535.png" style="width: 409px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/50700iC4BEE39FA7D3CF1B/image-dimensions/409x408?v=v2" width="409" height="408" role="button" title="Screenshot 2020-10-16 095535.png" alt="Screenshot 2020-10-16 095535.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Oct 2020 23:03:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Sgplot-Vbar-with-two-columns-as-bars-stacked/m-p/691984#M210703</guid>
      <dc:creator>CIG21</dc:creator>
      <dc:date>2020-10-15T23:03:53Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Sgplot Vbar with two columns as bars (stacked)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Sgplot-Vbar-with-two-columns-as-bars-stacked/m-p/691987#M210706</link>
      <description>&lt;P&gt;VBAR wants the data structured differently.&amp;nbsp; The stack value needs to be a variable.&amp;nbsp; Something like this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
  infile cards dsd;
  input weekday $ var1 var2;
  format datetime1 datetime2 datetime20.;
cards; 
Monday,23,12
Tuesday,21,4
Wednesday,4,5
Thursday,5,29
Friday,8,9
;
run;

data want;
  set have;
  actual = var1; cat="cat1"; output;
  actual = var2; cat="cat2"; output;
run;

proc sgplot data=want;
  title 'Actual Sales by Day';
  vbar weekday / response=actual group=cat stat=sum;
  xaxis display=(nolabel);
  yaxis grid  label='Sales';
  run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 15 Oct 2020 23:15:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Sgplot-Vbar-with-two-columns-as-bars-stacked/m-p/691987#M210706</guid>
      <dc:creator>CurtisMackWSIPP</dc:creator>
      <dc:date>2020-10-15T23:15:57Z</dc:date>
    </item>
    <item>
      <title>Re: Proc Sgplot Vbar with two columns as bars (stacked)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Proc-Sgplot-Vbar-with-two-columns-as-bars-stacked/m-p/691990#M210708</link>
      <description>Brilliant, exactly what I needed. Thank you!</description>
      <pubDate>Thu, 15 Oct 2020 23:24:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Proc-Sgplot-Vbar-with-two-columns-as-bars-stacked/m-p/691990#M210708</guid>
      <dc:creator>CIG21</dc:creator>
      <dc:date>2020-10-15T23:24:22Z</dc:date>
    </item>
  </channel>
</rss>

