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.
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;
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 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.
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 t 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.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.