/* Example code for finding (standard) normal probabilities in SAS */ OPTIONS pagesize=50 linesize=64; /* (setting the page margins) */ /* The command PROBNORM computes normal probabilities */ /* It computes the probability that a standard normal r.v. is less than (or equal to) */ /* a certain value. So SAS gives us P(Z < value), whereas Table IV in the book gives */ /* us P(0 < Z < value) */ /* Suppose our random variable Z is standard normal */ /* Let's answer the following questions which were given in class */ /* 1. What is the probability Z is between 0 and 1.24? */ /* 2. What is the probability Z is greater than 1.24? */ /* 3. What is the probability Z is less than 1.24? */ /* 4. What is the probability Z is between -0.54 and 0? */ /* 5. What is the probability Z is less than -0.54? */ /* 6. What is the probability Z is between -1.75 and -0.79? */ /* 7. What is the probability Z is between -0.79 and 1.16? */ /* This SAS program will give us the answers to all these questions in an instant */ /* I will label the answers to the 7 questions as normp1, normp2, ... , normp7. */ /* What if X is normal with mean 266 and standard deviation 16 (like the pregnancy */ /* example in class)? If you're clever, you can let SAS standardize for you, */ /* as the eighth example here will show: */ /* 8. What is the probability X is between 260 and 280? */ data norm; normp1 = probnorm(1.24) - probnorm(0); normp2 = 1 - probnorm(1.24); normp3 = probnorm(1.24); normp4 = probnorm(0) - probnorm(-0.54); normp5 = probnorm(-0.54); normp6 = probnorm(-0.79) - probnorm(-1.75); normp7 = probnorm(1.16) - probnorm(-0.79); normp8 = probnorm((280-266)/16) - probnorm((260-266)/16); run; proc print data=norm; title 'Normal Probabilities'; run; /* After we input this program into the program editor and do "Run"->"Submit" */ /* Then the results print in the Output window */ /* Compare to the results we got in class using the tables */ /* The difference is: SAS can do these for any values of Z */