BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Obsidian | Level 7

Hello all,


I am trying to use Proc Univariate to create some histograms, using the "endpoints" functionality to create my bins; however for some reason it seems to be extending the endpoints beyond the largest amount in my data...


So my in my data I have a variable ("percent_dif", which I am using to create the histograms) which is bound by 0 and 100; even though it is known to be bound by 0 and 100, I check for this by even running the following check on the data:


data acct_data_test;
    set acct_data;
    if percent_dif < 0 or percent_dif > 100 or missing(percent_dif);


And it returns an empty dataset. I also added a where clause to proc univariate:

proc univariate data=acct_data;
    where percent_dif < 100;
    var percent_dif;
    histogram percent_dif / endpoints=(0 to 100 by 5) 
    barlabel=percent outhist=BinCount;

However when I run the code, I get the following warning: "WARNING: The ENDPOINTS= list was extended to accommodate the data.". And then it shows a histogram bar with values above 100:


univariate histogram


Note the 0.048 above 100 and below 105...I'm at a loss for how this could be happening..Does anyone have any ideas?



Accepted Solutions
Super User

It will increase itself after that Do Loop.


 histogram percent_dif / endpoints=(0 to 95 by 5) 


View solution in original post

Super User

It will increase itself after that Do Loop.


 histogram percent_dif / endpoints=(0 to 95 by 5) 


Obsidian | Level 7

That works! Awesome haha, thank you for the simple solution. I am still curious though, do we know why it was increasing past 100, if nothing was actually greater than 100?


But thank you again.


Super User

It has nothing to do with the original value in your dataset.

It is just a SAS Syntax . After that loop it will plus 5 by itself .

Lapis Lazuli | Level 10

The effect you describe is due to the logic of "binning". The final cell is from 95 to less than 100, the next is from 100 to less than 105. So, it looks like 0.048% of your data have values of 100.


To include 100 in the upper bin, use RTINCLUDE. See



SAS 9.4 (TS1M6) X64_10PRO WIN 10.0.17763 Workstation


For an explanation of histogram binning and how to set bins in PROC UNIVARIATE, see the article "Choosing bins for histograms in SAS."  You can use the MIDPOINTS= option or the ENDPOINTS= option.



Time is running out to save with the early bird rate. Register by Friday, March 1 for just $695 - $100 off the standard rate.


Check out the agenda and get ready for a jam-packed event featuring workshops, super demos, breakout sessions, roundtables, inspiring keynotes and incredible networking events. 


Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 4 in conversation