Handout05 Stat3900/4950 The first program has two new lines of code at the top that clears the log and the output files and renumbers the output starting at page 1 after you each run of you SAS program. The program is from page 80 in the Cody&Smith book and is useful for running a Chi-Square test if the counts are given. You should find a Chi-Square test problem in you introductory statistics book and work out the details of the problem and then check your work by running this program. The next program is for computing the odds ratio for a case-control study and the last one is for computing the relative risk for a cohort study. odds = [p1/(1-p1)]/[p2/(1-p2)] rr = p1/p2 With all three programs note that the weight subcommand of proc freq is used since the summary table has already been computed and the results are used as the datalines. ------------------------------------------------------------------------------ DM 'LOG;CLEAR;OUT;CLEAR'; OPTIONS PAGENO = 1 LINESIZE = 74 PAGESIZE = 64; data chisq; n+1; do row = 1 to 2; do col = 1 to 2; input count @; output; end; end; datalines; 10 20 30 40 ; proc freq data=chisq; tables row*col / chisq; weight count; run; ------------------------------------------------------------------------------ * Program to compute the Odds Ratio and the 95% CI; data odds; input outcome $ exposure $ count; datalines; case 1-Yes 50 case 2-No 100 control 1-Yes 20 control 2-No 130 ; proc freq data=odds; title 'Program to compute an Odds Ratio'; tables exposure*outcome / chisq cmh; weight count; run; ------------------------------------------------------------------------------ data rr; length group $ 9; input group $ outcome $ count; datalines; 1-placebo mi 20 1-placebo no-mi 80 2-asprin mi 15 2-asprin no-mi 135 ; proc freq data=rr; title 'Program to compute a relative risk'; tables group*outcome / CHM; weight count; run; ------------------------------------------------------------------------------