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

Hi, i would like to use a quantile function to estimate the quantile of a normal distribution that have a certain mean and a certain st. dev.

I can't find the function. 

data output_dataset;
set input_dataset;
length esito $50.;
p=quantile('NORMAL', .975);
input mean dev_st;
run;

I was using this code but this is not correct. 

1 ACCEPTED SOLUTION

Accepted Solutions
FreelanceReinh
Jade | Level 19

Hi @ari2495,

 

If the input dataset contains means and standard deviations, you can compute (and don't need to "estimate") the 97.5% quantiles (and similarly any other quantiles) of the corresponding normal distributions using the QUANTILE or PROBIT function as shown in the example below:

/* Create sample data for demonstration */

data have;
input mean dev_st;
cards;
0 1
0 5
100 10
-42 1.23
;

/* Compute the 97.5% quantiles of the normal distributions with the above parameters */

data want;
set have;
q=quantile('normal',0.975,mean,dev_st); /* = dev_st*probit(0.975)+mean */
run;

proc print data=want;
run;

View solution in original post

6 REPLIES 6
HumbleMe
Fluorite | Level 6
Try this:
proc univariate data=have;
output out=want pctlpts=97.5 pctlpre=p;
run;
ari2495
Obsidian | Level 7
okay and where do I specify mean and st dev?
FreelanceReinh
Jade | Level 19

Hi @ari2495,

 

If the input dataset contains means and standard deviations, you can compute (and don't need to "estimate") the 97.5% quantiles (and similarly any other quantiles) of the corresponding normal distributions using the QUANTILE or PROBIT function as shown in the example below:

/* Create sample data for demonstration */

data have;
input mean dev_st;
cards;
0 1
0 5
100 10
-42 1.23
;

/* Compute the 97.5% quantiles of the normal distributions with the above parameters */

data want;
set have;
q=quantile('normal',0.975,mean,dev_st); /* = dev_st*probit(0.975)+mean */
run;

proc print data=want;
run;
ari2495
Obsidian | Level 7
this is valid also if i need to perform a double side test? or in this case i need to compute even the low quantile?
Rick_SAS
SAS Super FREQ

@ari2495 wrote:
this is valid also if i need to perform a double side test? or in this case i need to compute even the low quantile?

If you are looking for the critical values for the significance level alpha, you can use alpha and 1-alpha to get both the upper and lower quantiles. For example:

 

alpha = 0.05;   /* significance level */
qU=quantile('normal',1-alpha/2,mean,dev_st); /* upper critical value */
qL=quantile('normal',alpha/2,mean,dev_st); /* lower critical value */

 A test statistic in the interval [qL, qU] will not reject the two-sided null hypothesis. A test statistic that is less than qL or greater than qU will reject H0.

FreelanceReinh
Jade | Level 19

Quantiles of normal distributions can be calculated as shown without any reference to a statistical test. The normal quantiles that are typically used in statistical tests are those of the standard normal distribution N(0, 1), so you could simply use the PROBIT function. But many statistical tests are available through SAS procedures. In these cases you don't need to compute quantiles at all because SAS has already done this and provides you with ready-to-use p-values. Often in such cases the normal distribution is only an approximation of the exact distribution of a test statistic and the procedure might rather use that exact distribution (e.g., the distribution in PROC TTEST).

 

From a mean and a standard deviation alone (as in dataset HAVE), no statistical test can be computed anyway.

 

If you need help with a statistical test, please start a new thread in the Statistical Procedures subforum, clearly state the null and alternative hypotheses or your research question and provide sample data (in the form of a data step), if any, together with a description of how they were collected and what else can be assumed.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 6 replies
  • 1215 views
  • 5 likes
  • 4 in conversation