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

I want to calculate the cumulative bivariate normal distribution of two standard normal variables.  Is  there a SAS PROC or SAS FUNCTION that does this?  When rho=0, this is easy but rho =^ 0, it's more involved.  For example, suppose x1=-2.05 and x2=-1.64. -2.05 is associated 0.02 with and -1.64 is associated with 0.05.  When rho=0, you just multiply 0.02*0.05 to get 0.001 but when rho N=^ 0 it's a little messy.  Trying to avoid writing the code if SAS has a PROC of FUNCTION that does this for me.  No IML please.

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

Yes, use the PROBBNRM function, which is in Base SAS. I describe the function and how to use it in the article "Visualize the bivariate normal cumulative distribution."

data CDF2D;
input rho x1 x2;
cdf = probbnrm(x1,x2,rho);
datalines;
0    -2.05 -1.64
0.5  -2.05 -1.64
-0.5 -2.05 -1.64
;

proc print data=CDF2D; run;

View solution in original post

6 REPLIES 6
PaigeMiller
Diamond | Level 26

No IML? Trying to avoid writing the code? There is the PROBBNRM function in SAS, but that's not a cumulative distribution. And from that point on, I think you either need to write your own code, or use IML.

 

Update: this answer is incorrect; see comment from @FreelanceReinh below

--
Paige Miller
FreelanceReinh
Jade | Level 19

@PaigeMiller wrote:

There is the PROBBNRM function in SAS, but that's not a cumulative distribution.


Hi @PaigeMiller, I think it is cumulative and hence ideal for PaulN's task.

(Thanks to Rick_SAS for mentioning the function recently enough so that I remembered it.)

PaigeMiller
Diamond | Level 26

@FreelanceReinh thanks for the correction!!!

--
Paige Miller
Rick_SAS
SAS Super FREQ

Yes, use the PROBBNRM function, which is in Base SAS. I describe the function and how to use it in the article "Visualize the bivariate normal cumulative distribution."

data CDF2D;
input rho x1 x2;
cdf = probbnrm(x1,x2,rho);
datalines;
0    -2.05 -1.64
0.5  -2.05 -1.64
-0.5 -2.05 -1.64
;

proc print data=CDF2D; run;
PaulN
Obsidian | Level 7

Thank you for the help.  It's appreciated.  

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 2122 views
  • 5 likes
  • 5 in conversation