<?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 SGPLOT error on Histogram counts in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/SGPLOT-error-on-Histogram-counts/m-p/401791#M13730</link>
    <description>&lt;P&gt;Using SAS 9.04.01 M3 on Windows 7, with EG 7.1 on a Linux Grid.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Counts are off by 7046 on first bin of histogram as compared to proc means. Values are 0 to 10. What am I missing? 30886-23840 = 7046&lt;/P&gt;&lt;DIV class="branch"&gt;&lt;TABLE cellspacing="1" cellpadding="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;title "Snacks test - All Qtysold bins 0 to 10";
proc sgplot data=sashelp.snacks;
   histogram qtysold/datalabel=count scale=percent showbins binstart=0 binwidth=10 boundary=lower;
run;
title "qtysold &amp;lt;11";
proc means data=sashelp.snacks(where=(0 le qtysold le 10)) n nmiss min p25 median p75 max mean ;
   var qtysold;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SGPlot histogram error.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/15672iB602C91DEAA4AB04/image-size/large?v=v2&amp;amp;px=999" role="button" title="SGPlot histogram error.png" alt="SGPlot histogram error.png" /&gt;&lt;/span&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class="branch"&gt;SAS Output&lt;DIV class="branch"&gt;&lt;TABLE cellspacing="1" cellpadding="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;qtysold &amp;lt;11&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;DIV class="c proctitle"&gt;The MEANS Procedure&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV align="center"&gt;Analysis Variable : QtySold Quantity sold&lt;/DIV&gt;&lt;DIV align="center"&gt;N N Miss Minimum 25th Pctl Median 75th Pctl Maximum Mean &lt;TABLE cellspacing="0" cellpadding="5"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;30886&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;2.0000000&lt;/TD&gt;&lt;TD&gt;5.0000000&lt;/TD&gt;&lt;TD&gt;10.0000000&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;2.9644464&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Fri, 06 Oct 2017 14:28:39 GMT</pubDate>
    <dc:creator>Steve_SAS</dc:creator>
    <dc:date>2017-10-06T14:28:39Z</dc:date>
    <item>
      <title>SGPLOT error on Histogram counts</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/SGPLOT-error-on-Histogram-counts/m-p/401791#M13730</link>
      <description>&lt;P&gt;Using SAS 9.04.01 M3 on Windows 7, with EG 7.1 on a Linux Grid.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Counts are off by 7046 on first bin of histogram as compared to proc means. Values are 0 to 10. What am I missing? 30886-23840 = 7046&lt;/P&gt;&lt;DIV class="branch"&gt;&lt;TABLE cellspacing="1" cellpadding="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;title "Snacks test - All Qtysold bins 0 to 10";
proc sgplot data=sashelp.snacks;
   histogram qtysold/datalabel=count scale=percent showbins binstart=0 binwidth=10 boundary=lower;
run;
title "qtysold &amp;lt;11";
proc means data=sashelp.snacks(where=(0 le qtysold le 10)) n nmiss min p25 median p75 max mean ;
   var qtysold;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="SGPlot histogram error.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/15672iB602C91DEAA4AB04/image-size/large?v=v2&amp;amp;px=999" role="button" title="SGPlot histogram error.png" alt="SGPlot histogram error.png" /&gt;&lt;/span&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class="branch"&gt;SAS Output&lt;DIV class="branch"&gt;&lt;TABLE cellspacing="1" cellpadding="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;qtysold &amp;lt;11&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;DIV class="c proctitle"&gt;The MEANS Procedure&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV align="center"&gt;Analysis Variable : QtySold Quantity sold&lt;/DIV&gt;&lt;DIV align="center"&gt;N N Miss Minimum 25th Pctl Median 75th Pctl Maximum Mean &lt;TABLE cellspacing="0" cellpadding="5"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;30886&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;TD&gt;2.0000000&lt;/TD&gt;&lt;TD&gt;5.0000000&lt;/TD&gt;&lt;TD&gt;10.0000000&lt;/TD&gt;&lt;TD&gt;&lt;P&gt;2.9644464&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 06 Oct 2017 14:28:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/SGPLOT-error-on-Histogram-counts/m-p/401791#M13730</guid>
      <dc:creator>Steve_SAS</dc:creator>
      <dc:date>2017-10-06T14:28:39Z</dc:date>
    </item>
    <item>
      <title>Re: SGPLOT error on Histogram counts</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/SGPLOT-error-on-Histogram-counts/m-p/401806#M13732</link>
      <description>&lt;P&gt;The boundaries used for this histogram with your options are 5, 15, 25, 35. Binstart does not actually set a boundary, it more associated with the displayed x value which would be the center of the bar range shown. Hence 10 is mid-point of the 5-15 range.&lt;/P&gt;
&lt;P&gt;If you really have to force displays to intervals of 0-10, 10-20 then use VBAR and a format to create ranges for the xaxis variable.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Oct 2017 15:04:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/SGPLOT-error-on-Histogram-counts/m-p/401806#M13732</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-10-06T15:04:32Z</dc:date>
    </item>
    <item>
      <title>Re: SGPLOT error on Histogram counts</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/SGPLOT-error-on-Histogram-counts/m-p/401815#M13733</link>
      <description>Why are zero values of qtysold ignored on histogram? Where is the first bin controlled so it is 5 to 15? What about 0,1,2,3,4 values?</description>
      <pubDate>Fri, 06 Oct 2017 15:28:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/SGPLOT-error-on-Histogram-counts/m-p/401815#M13733</guid>
      <dc:creator>Steve_SAS</dc:creator>
      <dc:date>2017-10-06T15:28:57Z</dc:date>
    </item>
    <item>
      <title>Re: SGPLOT error on Histogram counts</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/SGPLOT-error-on-Histogram-counts/m-p/401820#M13735</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;title "Snacks test Scale=pct Qtysold bins 0 to 10";
proc sgplot data=sashelp.snacks(where=(0 le qtysold le 100));
   histogram qtysold/datalabel=count showbins scale=percent binstart=5 binwidth=10 boundary=lower;
run;
title "qtysold &amp;lt;=10";
proc means data=sashelp.snacks(where=(0 le qtysold le 10)) n nmiss min p25 median p75 max mean ;
   var qtysold;
run;
title "qtysold 11? to 20 - non-integers in qtysold variable";
proc means data=sashelp.snacks(where=(10 lt qtysold le 20)) n nmiss min p25 median p75 max mean ;
   var qtysold;
run;

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This works. I'm still not sure how to control the first bin.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Oct 2017 15:45:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/SGPLOT-error-on-Histogram-counts/m-p/401820#M13735</guid>
      <dc:creator>Steve_SAS</dc:creator>
      <dc:date>2017-10-06T15:45:13Z</dc:date>
    </item>
    <item>
      <title>Re: SGPLOT error on Histogram counts</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/SGPLOT-error-on-Histogram-counts/m-p/401837#M13736</link>
      <description>&lt;P&gt;If you actually want a vertical bar chart with the width at points you control then use VBAR and a format to create groups&lt;/P&gt;
&lt;PRE&gt;proc format library=work;
value bins 
0  - 10 = ' 0'
10 &amp;lt;- 20 = '10'
20 &amp;lt;- 30 = '20'
30 &amp;lt;- 40 = '30'
40 &amp;lt;- 50 = '40'
50 &amp;lt;- 60 = '50'
60 &amp;lt;- 70 = '60'
70 &amp;lt;- 80 = '70'
80 &amp;lt;- 90 = '80'
90 &amp;lt;-100 = '90'
;
run;
proc sgplot data=sashelp.snacks(where=(0 le qtysold le 100));
   vbar qtysold/stat=freq datalabel;
   format qtysold bins.;
run;
&lt;/PRE&gt;</description>
      <pubDate>Fri, 06 Oct 2017 16:29:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/SGPLOT-error-on-Histogram-counts/m-p/401837#M13736</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-10-06T16:29:36Z</dc:date>
    </item>
  </channel>
</rss>

