Hello,
I am working on a question about finding the probability of upper end of normal distribution. The mean=8 in, SD=2 in. Trying to find the probability of variable that will be over >12 in.
Used
Z=P(X>12)
Z= 1- P(X<12-8/2)
Z= 1-p(X<2)
Z=1-0.07725
Z=0.02275
Now I am trying to write code into SAS:
data 2a;
A1= 1-probnorm(2);
C= 1 - cdf('NORMAL',2);
run;
proc print data=2a;
run;
I know its wrong and need any suggestions?
Hello @Joliek44,
@Joliek44 wrote:
data 2a;
A1= 1-probnorm(2);
C= 1 - cdf('NORMAL',2);
run;
Remember that, as a rule, names in SAS, in particular dataset names, must start with a letter or an underscore. The formulas using the standardized argument (12-8)/2=2 are correct.
But you don't need to compute the standardized argument yourself (see documentation of the CDF function for the normal distribution). Just specify all three numeric arguments of the CDF function:
data _null_;
p=1-cdf('normal',12,8,2);
put p=;
run;
(This writes the result to the log without creating a dataset.)
Hello,
Okay, I am totally new to SAS. So still getting the hang of things.
How about this:
data A2;
A1= 1-probnorm(2);
D= 1 - cdf('NORMAL'12,8,2);
Put D=;
run;
With a comma inserted between 'NORMAL' and 12 this is going to work. It will produce two identical results in variables A1 and D in dataset A2 and in addition write the result to the log.
Got!!! Thanks for your help. Finally.
It sounds like your question is answered, but I just want to comment on the title of this topic. You asked how to compute a percentile, but the quantity that you are computing is a probability, not a percentile. A percentile is the inverse problem. The percentile is also called the quantile.
Given a probability, such as 0.02, the quantile is the value z0 such that P(Z < z0) = 0.02. You can compute it as
/* lower tail */
z0 = quantile("normal", 0.02, 8, 2); /* z0 = 3.89 */
Sometimes you might be interested in the upper tail instead:
/* upper tail */
z1 = quantile("normal", 1-0.02, 8, 2); /* z1 = 12.11 */
Thank you for the information. Will keep that in mind. Great explanation.
Monica
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.
Ready to level-up your skills? Choose your own adventure.