Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Home
- /
- Programming
- /
- SAS Procedures
- /
- Odd Behavior From Proc Univariate

Options

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

🔒 This topic is **solved** and **locked**.
Need further help from the community? Please
sign in and ask a **new** question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Posted 02-25-2016 07:11 PM
(2130 views)

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); run;

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; run;

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:

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?

1 ACCEPTED SOLUTION

Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

It will increase itself after that Do Loop.

histogram percent_dif / endpoints=(0 to95by 5)

5 REPLIES 5

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

It will increase itself after that Do Loop.

histogram percent_dif / endpoints=(0 to95by 5)

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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.

-Ryan

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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 .

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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 http://support.sas.com/documentation/cdl/en/procstat/63104/HTML/default/viewer.htm#procstat_univaria...

Norman.

Norman.

SAS 9.4 (TS1M6) X64_10PRO WIN 10.0.17763 Workstation

SAS 9.4 (TS1M6) X64_10PRO WIN 10.0.17763 Workstation

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

**If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. **

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.