<?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: proc sgplot histogram producing only a single histogram bar in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/proc-sgplot-histogram-producing-only-a-single-histogram-bar/m-p/788313#M40071</link>
    <description>&lt;P&gt;Are there messages in the log that might indicate what the problem is?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;From now on, when code doesn't work, show us the log (all of it for this PROC, not just the ERRORs or WARNINGs)&lt;/P&gt;</description>
    <pubDate>Tue, 04 Jan 2022 17:48:31 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2022-01-04T17:48:31Z</dc:date>
    <item>
      <title>proc sgplot histogram producing only a single histogram bar</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/proc-sgplot-histogram-producing-only-a-single-histogram-bar/m-p/788312#M40070</link>
      <description>&lt;P&gt;I'm trying to create a histogram with proc sgplot but SAS will only create a single bar histogram plot.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My data is continuous, highly skewed, with&amp;nbsp;10,677 zero values. When I run tests on simulated lognormal data, proc sgplot does fine.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Perhaps something about my data is causing issues?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;proc means data=out.cohort_match_real_data_pos n mean median stddev min max;
where ever_eng_fst12_month="No";
var pre_post_cost_712_mon_ratio;
run;
/* N     Mean      Median    Std Dev        Minimum   Maximum                              */
/* ----------------------------------------------------------------------------------------*/
/* 37670 8.9096483 0.4685912 117.5225125    0         15089.56                             */
/* ----------------------------------------------------------------------------------------*/

proc sgplot data=out.cohort_match_real_data_pos;
	where ever_eng_fst12_month="No";
 	histogram pre_post_cost_712_mon_ratio / nbins=40 binwidth=.5 binstart=0;
/* 	density pre_post_cost_712_mon_ratio /type=normal;*/
	xaxis values=(0 to 20 by .5);
run;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="RobertWF1_1-1641317459427.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/67109i585926E757A7CC9C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="RobertWF1_1-1641317459427.png" alt="RobertWF1_1-1641317459427.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jan 2022 17:49:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/proc-sgplot-histogram-producing-only-a-single-histogram-bar/m-p/788312#M40070</guid>
      <dc:creator>RobertWF1</dc:creator>
      <dc:date>2022-01-04T17:49:18Z</dc:date>
    </item>
    <item>
      <title>Re: proc sgplot histogram producing only a single histogram bar</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/proc-sgplot-histogram-producing-only-a-single-histogram-bar/m-p/788313#M40071</link>
      <description>&lt;P&gt;Are there messages in the log that might indicate what the problem is?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;From now on, when code doesn't work, show us the log (all of it for this PROC, not just the ERRORs or WARNINGs)&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jan 2022 17:48:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/proc-sgplot-histogram-producing-only-a-single-histogram-bar/m-p/788313#M40071</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-01-04T17:48:31Z</dc:date>
    </item>
    <item>
      <title>Re: proc sgplot histogram producing only a single histogram bar</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/proc-sgplot-histogram-producing-only-a-single-histogram-bar/m-p/788314#M40072</link>
      <description>&lt;P&gt;Your maximum value is 15089 but your X axis only goes to 20?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/408179"&gt;@RobertWF1&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I'm trying to create a histogram with proc sgplot but SAS will only create a single bar histogram plot.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My data is continuous, highly skewed, with&amp;nbsp;10,677 zero values. When I run tests on simulated lognormal data, proc sgplot does fine.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Perhaps something about my data is causing issues?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="sas"&gt;proc means data=out.cohort_match_real_data_pos n mean median stddev min max;
where ever_eng_fst12_month="No";
var pre_post_cost_712_mon_ratio;
run;
/* N     Mean      Median    Std Dev        Minimum   Maximum                              */
/* ----------------------------------------------------------------------------------------*/
/* 37670 8.9096483 0.4685912 117.5225125    0         15089.56                             */
/* ----------------------------------------------------------------------------------------*/

proc sgplot data=out.cohort_match_real_data_pos;
	where ever_eng_fst12_month="No";
 	histogram pre_post_cost_712_mon_ratio / nbins=40 binwidth=.5 binstart=0;
/* 	density pre_post_cost_712_mon_ratio /type=normal;*/
	xaxis values=(0 to 20 by .5);
run;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="RobertWF1_1-1641317459427.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/67109i585926E757A7CC9C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="RobertWF1_1-1641317459427.png" alt="RobertWF1_1-1641317459427.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Run the code without any options and add them back in one by one to see where the issue is.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sgplot data=out.cohort_match_real_data_pos;
	where ever_eng_fst12_month="No";
 	histogram pre_post_cost_712_mon_ratio ;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 04 Jan 2022 17:52:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/proc-sgplot-histogram-producing-only-a-single-histogram-bar/m-p/788314#M40072</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2022-01-04T17:52:13Z</dc:date>
    </item>
    <item>
      <title>Re: proc sgplot histogram producing only a single histogram bar</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/proc-sgplot-histogram-producing-only-a-single-histogram-bar/m-p/788315#M40073</link>
      <description>Here's the log - no errors:&lt;BR /&gt;&lt;BR /&gt;23         GOPTIONS ACCESSIBLE;&lt;BR /&gt;24         proc sgplot data=out.cohort_match_real_data_pos;&lt;BR /&gt;25         	where ever_eng_fst12_month="No";&lt;BR /&gt;26          	histogram pre_post_cost_712_mon_ratio / nbins=40 binwidth=.5 binstart=0;&lt;BR /&gt;27         /* 	density pre_post_cost_712_mon_ratio /type=normal;*/&lt;BR /&gt;28         	xaxis values=(0 to 20 by .5);&lt;BR /&gt;29         run;&lt;BR /&gt;&lt;BR /&gt;NOTE: PROCEDURE SGPLOT used (Total process time):&lt;BR /&gt;      real time           7.51 seconds&lt;BR /&gt;      cpu time            5.06 seconds&lt;BR /&gt;      &lt;BR /&gt;NOTE: The specified BINWIDTH= value will be ignored in order to accommodate the data.&lt;BR /&gt;NOTE: Some of the tick values have been thinned.&lt;BR /&gt;NOTE: Listing image output written to D:\SASWORK\rfeyerharm\_TD3252_VMSAS01_\Prc2\SGPlot38.png.&lt;BR /&gt;NOTE: Some of the tick values have been thinned.&lt;BR /&gt;NOTE: There were 41355 observations read from the data set OUT.COHORT_MATCH_REAL_DATA_POS.&lt;BR /&gt;      WHERE ever_eng_fst12_month='No';</description>
      <pubDate>Tue, 04 Jan 2022 17:55:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/proc-sgplot-histogram-producing-only-a-single-histogram-bar/m-p/788315#M40073</guid>
      <dc:creator>RobertWF1</dc:creator>
      <dc:date>2022-01-04T17:55:41Z</dc:date>
    </item>
    <item>
      <title>Re: proc sgplot histogram producing only a single histogram bar</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/proc-sgplot-histogram-producing-only-a-single-histogram-bar/m-p/788316#M40074</link>
      <description>&lt;P&gt;It doesn't have to be ERROR message, the answer is right here if you would just read the log: (&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/Maxims-of-Maximally-Efficient-SAS-Programmers/ta-p/352068" target="_self"&gt;Maxim 2&lt;/A&gt;, Read the Log)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;NOTE: The specified BINWIDTH= value will be ignored in order to accommodate the data.&lt;/PRE&gt;
&lt;P&gt;So SAS chooses its own binwidth, which apparently is very wide. If you only want data between 0 and 20 to appear in the histogram, eliminate any values &amp;gt;20&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jan 2022 18:00:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/proc-sgplot-histogram-producing-only-a-single-histogram-bar/m-p/788316#M40074</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-01-04T18:00:25Z</dc:date>
    </item>
    <item>
      <title>Re: proc sgplot histogram producing only a single histogram bar</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/proc-sgplot-histogram-producing-only-a-single-histogram-bar/m-p/788318#M40075</link>
      <description>&lt;P&gt;If I run sgplot with no options, I get the following default plot (same with proc univariate histogram).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It's lumping most of my observations into one category.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="RobertWF1_0-1641319285570.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/67110i9BD2672C9B088ADE/image-size/medium?v=v2&amp;amp;px=400" role="button" title="RobertWF1_0-1641319285570.png" alt="RobertWF1_0-1641319285570.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jan 2022 18:03:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/proc-sgplot-histogram-producing-only-a-single-histogram-bar/m-p/788318#M40075</guid>
      <dc:creator>RobertWF1</dc:creator>
      <dc:date>2022-01-04T18:03:37Z</dc:date>
    </item>
    <item>
      <title>Re: proc sgplot histogram producing only a single histogram bar</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/proc-sgplot-histogram-producing-only-a-single-histogram-bar/m-p/788321#M40076</link>
      <description>Yes, because a large proportion are zeroes as indicated. &lt;BR /&gt;Why not exclude those to see the distribution of the remainder?&lt;BR /&gt;&lt;BR /&gt;where ever_eng_fst12_month="No" and pre_post_cost_712_mon_ratio &amp;gt; 0 ;</description>
      <pubDate>Tue, 04 Jan 2022 18:09:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/proc-sgplot-histogram-producing-only-a-single-histogram-bar/m-p/788321#M40076</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2022-01-04T18:09:43Z</dc:date>
    </item>
    <item>
      <title>Re: proc sgplot histogram producing only a single histogram bar</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/proc-sgplot-histogram-producing-only-a-single-histogram-bar/m-p/788322#M40077</link>
      <description>&lt;P&gt;That worked!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sgplot data=out.cohort_match_real_data_pos;
where ever_eng_fst12_month="No" and pre_post_cost_712_mon_ratio &amp;lt;= 20;
histogram pre_post_cost_712_mon_ratio / nbins=40 binwidth=.5 binstart=0;
/* density pre_post_cost_712_mon_ratio /type=normal;*/
xaxis values=(0 to 20 by .5);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="RobertWF1_0-1641319720005.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/67111i7D95F8F622E5DA1B/image-size/medium?v=v2&amp;amp;px=400" role="button" title="RobertWF1_0-1641319720005.png" alt="RobertWF1_0-1641319720005.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 04 Jan 2022 18:11:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/proc-sgplot-histogram-producing-only-a-single-histogram-bar/m-p/788322#M40077</guid>
      <dc:creator>RobertWF1</dc:creator>
      <dc:date>2022-01-04T18:11:01Z</dc:date>
    </item>
    <item>
      <title>Re: proc sgplot histogram producing only a single histogram bar</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/proc-sgplot-histogram-producing-only-a-single-histogram-bar/m-p/788479#M40085</link>
      <description>&lt;P&gt;Follow up question:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there a way to change my x-axis in proc sgplot without changing the percentages for each bin? I understand SAS is recalculating the %'s when I subset the population, which it's supposed to do.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But if I want to "zoom in" on a portion of the x-axis without renormalizing the %'s, is there a handy option in sgplot? Or better to manually calculate the bins and %'s, say with proc freq &amp;amp; output a bin_freq dataset, and then run sgplot on bin_freq.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 05 Jan 2022 15:20:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/proc-sgplot-histogram-producing-only-a-single-histogram-bar/m-p/788479#M40085</guid>
      <dc:creator>RobertWF1</dc:creator>
      <dc:date>2022-01-05T15:20:49Z</dc:date>
    </item>
  </channel>
</rss>

