SAS Procedures

Help using Base SAS procedures
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-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 5 replies
  • 2464 views
  • 3 likes
  • 2 in conversation