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
- /
- Proc Univariate - Percentiles

Options

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

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

Posted 04-28-2015 09:54 AM
(1680 views)

nHi everyone. This is my first post. First of all, it is good to be part of this Community!

I have a problem with sas coding. I want to fit a distribution (eg Normal or Lognormal) to some data and take the percentiles. I am using the following code which is fine.

My problem is that i want to extract the P99 of the fitted data at a sas data and not only at the results.

**PROC** **UNIVARIATE** DATA = WORK.TEMP1 NOPRINT ;*pctldef=5;

BY RESERVING_LOB_LOCAL;

VAR log_max_incurred;

HISTOGRAM log_max_incurred / NOPLOT LOGNORMAL ( W=**1** L=**1** COLOR=YELLOW ZETA=EST THETA=**0** SIGMA=EST);

OUTPUT OUT=FINAL2 p99=P99 ;

**RUN**;

By doing this i save at the sas data "final2" only the p99 of the actual data and not of the fitted data too.

Can you please help me?

Thank you very much in advance! Vasilis.

8 REPLIES 8

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

I think you have to use the OUTHIST= option to get that (and it may not be exactly the 99 percentile). You could always take the estimated coefficients of the Lognormal model and compute exactly where the 99 percentile is.

--

Paige Miller

Paige Miller

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

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

Vasilis wrote:

You are specifying a lognormal distribution, and the parameter estimates are calculated by PROC UNIVARIATE, so then you should program the lognormal distribution in a DATA step or otherwise, using these parameters, and find the exact 99%-lie point.

Or as Xia Keshan said, you can read these percentage points from a PPPlot

--

Paige Miller

Paige Miller

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

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

I guess I'm not really grasping the problem here.

If you run PROC UNIVARIATE, you can obtain the estimates of the lognormal coefficients. Use ODS OUTPUT PARAMETERESTIMATES=PARAMS; This will give you a SAS data set with the estimates of the Lognormal distribution. From there, you program the distribution using the Lognormal formula, in a SAS data step to determine the 99%-ile point.

As stated in the SAS documentation (click to enlarge so it is readable):

--

Paige Miller

Paige Miller

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

Welcome to the forums

If you get a table in the results window that you want as a SAS data set you need to find the name using ODS TRACE.

The table name for the quantiles if FITQUANTILES.

Using the SASHELP.CARS dataset I think this is what you want.

**ods table fitquantiles=mpg_city_quantiles;**

PROC UNIVARIATE DATA = sashelp.cars NOPRINT ;

VAR mpg_city;

HISTOGRAM mpg_city / NOPLOT LOGNORMAL ( W=1 L=1 COLOR=YELLOW ZETA=EST THETA=0 SIGMA=EST);

RUN;

proc print data=mpg_city_quantiles;

run;

A blog post on the topic:

How do I get my SAS results into a data set? | Statistics and other stuff from a geek

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

Not sure . Did you check PPPlot or QQPlot statement ?

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

Are you ready for the spotlight? We're accepting content ideas for **SAS Innovate 2025** to be held May 6-9 in Orlando, FL. The call is **open **until September 25. Read more here about **why** you should contribute and **what is in it** for you!

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.