BookmarkSubscribeRSS Feed
Joliek44
Calcite | Level 5

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? 

6 REPLIES 6
FreelanceReinh
Jade | Level 19

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.)

Joliek44
Calcite | Level 5

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;

FreelanceReinh
Jade | Level 19

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.

Joliek44
Calcite | Level 5

Got!!! Thanks for your help. Finally. 


Rick_SAS
SAS Super FREQ

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 */

Joliek44
Calcite | Level 5

Thank you for the information. Will keep that in mind. Great explanation. 

 

Monica 

sas-innovate-wordmark-2025-midnight.png

Register Today!

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.


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
  • 6 replies
  • 1246 views
  • 5 likes
  • 3 in conversation