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

hello,

I use Proc univariate to estimate data parameters,

I would like to export Quantiles for Gamma Distribution in a data sas,

How i can do that ?

 

%let LoiSeverite =Gamma;

 

data Grave;

input VAR1;

datalines;

150100

15000

17000

200000

300000

run;

 

proc univariate data=Grave;

histogram / midpoints=3. to 32043. by 2912.727273

&LoiSeverite

vaxis = axis1

name = 'MyHist';

axis1 label = (a=90 r=0);

/*Loi Gamma*/

qqplot Var1/height = 1 &LoiSeverite(Theta=est sigma=est Alpha=est color=red);

ppplot / &LoiSeverite(Theta=est sigma=est Alpha=est) ctext=blue;

ods output Quantiles=GoodnessOfFit;

run;

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

ODS output FitQuantiles=GammaQuantiles;

 

Or if you plan to explore other distributions:

ODS output FitQuantiles=Quantiles_&LoiSeverite;

 

View solution in original post

5 REPLIES 5
Rick_SAS
SAS Super FREQ

ODS output FitQuantiles=GammaQuantiles;

 

Or if you plan to explore other distributions:

ODS output FitQuantiles=Quantiles_&LoiSeverite;

 

Azeddine
Obsidian | Level 7

Thank you, it works for me.

i would like to extract only Percent 20, 40 and 99.5 for quantile,

How i can do that?

 

ODS output FitQuantiles=Quantiles&i. Percent= 20 40 99.5;

Rick_SAS
SAS Super FREQ

Are you asking for the empirical quantiles of the data, or the quantiles of the estimated distribution?

 

For the distribution, use the QUANTILE function for the gamma distribution at the estimated parameter values.

 

For non-standard percentiles of the data, you can use the OUTPUT statement and specify the percentiles that you want. For an example, see this article about percentiles (but ingnore the sections about confidence intervals):

 


proc univariate data=Grave;
var var1;
output out=pctl pctlpre=p 
          pctlpts=20 40 99.5; /* <== specify percentiles */
run;

proc print data=pctl; run;

 You can also output this information in a long form (more like the FitQuantiles table) 

Azeddine
Obsidian | Level 7

I'm talking about  distribution,

Instead of Fitquantiles default percentile(exemple inside the /**/ in the code), i would like to change them,

I need necessarely to use quantile function?

I can't do that by Proc univariate?

 

proc univariate data=Grave;

var VAR1;

histogram / Exponential(theta=0);

qqplot / Exponential(theta=0 Sigma=est);

ppplot / Exponential(theta=0 Sigma=est);

 

histogram / gamma(theta=0);

qqplot / gamma(theta=0 alpha=est Sigma=est);

ppplot / gamma(theta=0 alpha=est Sigma=est);

 

ODS output FitQuantiles=Quantiles&i. /*Percent= 20 40 99.5*/;

run;

 

 

Rick_SAS
SAS Super FREQ

Okay, for the fitted distribution, you can specify the quantiles in the FitQuantile table by using the PERCENT= option on the HISTOGRAM statment, like this

 

histogram / Exponential(theta=0 percents=20 40 99.5);

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 1837 views
  • 3 likes
  • 2 in conversation