<?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: group extreme values in a single bin in a histogram in Graphics Programming</title>
    <link>https://communities.sas.com/t5/Graphics-Programming/group-extreme-values-in-a-single-bin-in-a-histogram/m-p/233855#M8467</link>
    <description>&lt;P&gt;Thanks &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/32733"&gt;@FreelanceReinh﻿&lt;/a&gt;&amp;nbsp;for the answer. Midpoints works well, especially that it can be added from the histogram task in enterprise miner.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;MK&lt;/P&gt;</description>
    <pubDate>Mon, 09 Nov 2015 15:52:59 GMT</pubDate>
    <dc:creator>majdi_ka</dc:creator>
    <dc:date>2015-11-09T15:52:59Z</dc:date>
    <item>
      <title>group extreme values in a single bin in a histogram</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/group-extreme-values-in-a-single-bin-in-a-histogram/m-p/233470#M8456</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm trying to create a histogram, and I want to group extreme values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I created a format that looks like this :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
value hist_fmt &amp;nbsp;2000&amp;lt;-high = "&amp;gt;2000"&amp;nbsp;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I created a histogram with&amp;nbsp;enterprise guide histogram wizard and tried also with sgplot.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sgplot data=dataset;
&amp;nbsp; &amp;nbsp;histogram var1;
&amp;nbsp; &amp;nbsp;format var1 hist_fmt.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;the result that I had is repeated "&amp;gt;2000" value instead of grouping these values.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any ideas to get the result ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;thanks !&lt;/P&gt;</description>
      <pubDate>Fri, 06 Nov 2015 16:18:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/group-extreme-values-in-a-single-bin-in-a-histogram/m-p/233470#M8456</guid>
      <dc:creator>majdi_ka</dc:creator>
      <dc:date>2015-11-06T16:18:35Z</dc:date>
    </item>
    <item>
      <title>Re: group extreme values in a single bin in a histogram</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/group-extreme-values-in-a-single-bin-in-a-histogram/m-p/233544#M8457</link>
      <description>&lt;P&gt;I think the GCHART&amp;nbsp;procedure (requires SAS/GRAPH) allows for more flexibility regarding the bins of a histogram.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data dataset;
do _n_=1 to 200;
  var1=2500*ranuni(31416);
  output;
end;
run;

proc gchart data=dataset;
format var1 hist_fmt.;
vbar var1 / midpoints=100 to 2100 by 200;
run;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Even without the FORMAT statement the resulting histogram would group the "extreme" values (&amp;gt;=2000) into the rightmost bin, but the label of that bin would then be displayed as "2100" rather than "&amp;gt;2000".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please note that in the above example the exact value 2000 would be assigned to the "&amp;gt;2000" category. If this was an issue, you could extend your format definition to cover the whole range of possible VAR1 values and then use the DISCRETE option of the VBAR statement. Thus, the bins would correspond 1:1 to the format categories. In particular, only values &amp;gt;2000 would go into the "&amp;gt;2000" bin.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Example:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc format;
value hist_fmt
   0&amp;lt;-  500 = '   0&amp;lt;- 500'
 500&amp;lt;- 1000 = ' 500&amp;lt;-1000'
1000&amp;lt;- 1500 = '1000&amp;lt;-1500'
1500&amp;lt;- 2000 = '1500&amp;lt;-2000'
2000&amp;lt;- high = '&amp;gt;2000'
;
run;

proc gchart data=dataset;
format var1 hist_fmt.;
vbar var1 / discrete;
run;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;A warning about "not evenly spaced" intervals may be written to the log. There is an older thread about this warning:&amp;nbsp;&lt;A href="https://communities.sas.com/t5/SAS-GRAPH-and-ODS-Graphics/Suppress-WARNING-The-intervals-on-the-axis-labeled-x-are-not/td-p/194265" target="_blank"&gt;https://communities.sas.com/t5/SAS-GRAPH-and-ODS-Graphics/Suppress-WARNING-The-intervals-on-the-axis-labeled-x-are-not/td-p/194265&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, with the extended format you could also use PROC SGPLOT:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sgplot data=dataset;
format var1 hist_fmt.;
vbar var1;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Nov 2015 20:59:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/group-extreme-values-in-a-single-bin-in-a-histogram/m-p/233544#M8457</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2015-11-06T20:59:56Z</dc:date>
    </item>
    <item>
      <title>Re: group extreme values in a single bin in a histogram</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/group-extreme-values-in-a-single-bin-in-a-histogram/m-p/233693#M8462</link>
      <description>&lt;P&gt;You can use the solution provided&amp;nbsp;previously using VBAR. &amp;nbsp;But can we do this with the Histogram statement? &amp;nbsp;Yes, for a custom solution with&amp;nbsp;very specific data. &amp;nbsp;Here the actual values &amp;gt; 58000 are changed, and we have used the format and the axis break. Note axis break symbol on both X &amp;amp; X2 axes in the attached graph.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc format;&lt;BR /&gt;value hist_fmt 60000&amp;lt;-high = "&amp;gt;60K" &lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data cars;&lt;BR /&gt;&amp;nbsp; set sashelp.cars;&lt;BR /&gt;&amp;nbsp; msrp1=msrp;&lt;BR /&gt;&amp;nbsp; if msrp&amp;gt;58000 then msrp1=64000;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;proc sgplot data=cars;&lt;BR /&gt;&amp;nbsp; styleattrs axisbreak=bracket;&lt;BR /&gt;&amp;nbsp; histogram msrp1 / binstart=8000 binwidth=4000;&lt;BR /&gt;&amp;nbsp; format msrp1 hist_fmt.;&lt;BR /&gt;&amp;nbsp; xaxis values=(8000 to 64000 by 4000) ranges=(8000-58000 62000-66000);&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BR /&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/12057iF87FDFAA301A5AC6/image-size/large?v=1.0&amp;amp;px=600" border="0" alt="HistMax.png" title="HistMax.png" /&gt;</description>
      <pubDate>Sun, 08 Nov 2015 21:06:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/group-extreme-values-in-a-single-bin-in-a-histogram/m-p/233693#M8462</guid>
      <dc:creator>Jay54</dc:creator>
      <dc:date>2015-11-08T21:06:48Z</dc:date>
    </item>
    <item>
      <title>Re: group extreme values in a single bin in a histogram</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/group-extreme-values-in-a-single-bin-in-a-histogram/m-p/233855#M8467</link>
      <description>&lt;P&gt;Thanks &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/32733"&gt;@FreelanceReinh﻿&lt;/a&gt;&amp;nbsp;for the answer. Midpoints works well, especially that it can be added from the histogram task in enterprise miner.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;MK&lt;/P&gt;</description>
      <pubDate>Mon, 09 Nov 2015 15:52:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/group-extreme-values-in-a-single-bin-in-a-histogram/m-p/233855#M8467</guid>
      <dc:creator>majdi_ka</dc:creator>
      <dc:date>2015-11-09T15:52:59Z</dc:date>
    </item>
    <item>
      <title>Re: group extreme values in a single bin in a histogram</title>
      <link>https://communities.sas.com/t5/Graphics-Programming/group-extreme-values-in-a-single-bin-in-a-histogram/m-p/233864#M8468</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13856"&gt;@Jay54﻿&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for replying. Very interesting!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In fact I'am new to SAS Graphics, and I found it strange that a histogram task in enterprise guide is in fact a barplot, that's why I prefer Sgplot. However It would be good if activex can be activated with sgplot. I don't know if it can be done.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;MK&lt;/P&gt;</description>
      <pubDate>Mon, 09 Nov 2015 16:24:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Graphics-Programming/group-extreme-values-in-a-single-bin-in-a-histogram/m-p/233864#M8468</guid>
      <dc:creator>majdi_ka</dc:creator>
      <dc:date>2015-11-09T16:24:23Z</dc:date>
    </item>
  </channel>
</rss>

