/* Example code for finding Poisson probabilities in SAS */ OPTIONS pagesize=50 linesize=64; /* (setting the page margins) */ /* The command POISSON computes _cumulative_ poisson probabilities */ /* To get the cumulative probability, the syntax is: poisson(lambda, x) */ /* where lambda and x are values that you fill in */ /* Suppose our random variable X is Poission with lambda = 12.33. */ /* Let's answer the following questions */ /* 1. What is the probability of 15 or fewer occurrences? P(X <= 15) */ /* 2. What is the probability of EXACTLY 6 successes? P(X = 6) */ /* 3. What is the probability of more than 13 successes? P(X > 13) */ /* 4. What is the probability of 13 or more successes? P(X >= 13) */ /* 5. What is the probability of 8, 9, or 10 successes? P(8 <= X <= 10) */ /* This SAS program will give us the answers to all these questions in an instant */ /* I will label the answers to the 5 questions as prob1, prob2, ... , prob5. */ data poiss; prob1 = poisson(12.33, 15); prob2 = poisson(12.33, 6) - poisson(12.33, 5); prob3 = 1 - poisson(12.33, 13); prob4 = 1 - poisson(12.33, 12); prob5 = poisson(12.33, 10) - poisson(12.33, 7); run; proc print data=poiss; title 'Poisson Probabilities'; run; /* After we input this program into the program editor and run the code */ /* Then the results print in the Output window */ /* The difference is: SAS can do these for any lambda, whereas the table only */ /* gives probabilities for certain lambda choices. */