/* InferenceForTheDifferenceOfTwoProportions.sas */ /* Inference for the difference of two proportions */ /* Confidence intervals and tests for the ratio of two proportions */ /* ---------------------------------------------------------*/ /* examples from chapter 6 */ /* ---------------------------------------------------------*/ /* ---------------------------------------------------------*/ /* LeadingQuestion.sas */ /* leading question regarding gun permits example */ data permit; input group $ response $ count; label response='favor permit'; cards; leadingQ favor 403 leadingQ not 182 neutralQ favor 463 neutralQ not 152 ; proc freq data=permit order=data; tables group*response / alpha=.05 nocol nopercent riskdiff (cl=wald equal); weight count; ods select CrossTabFreqs RiskDiffCol1 PdiffTest; title 'leading question regarding gun permits example (success = favor permit)'; /* ------------------------------------------------------ */ /* HIV-VaccineTrial.sas */ /* HIV vaccine trial */ data hiv; input group $ response $ count; label response='HIV status'; cards; vaccine positive 241 vaccine negative 3357 control positive 126 control negative 1679 ; proc freq data=hiv order=data; tables group*response / alpha=.05 nocol nopercent riskdiff (cl=wald equal); weight count; ods select CrossTabFreqs RiskDiffCol1 PdiffTest; title 'HIV vaccine trial (success = positive)'; /* ------------------------------------------------------ */ /* ScotlandCoronaryStudy.sas */ /* West of Scotland coronary prevention study */ /* Initial 5 year study period */ data scotland1; input drug : $ 11. response $ count; label response='has a coronary event'; cards; pravastatin yes 174 pravastatin no 3128 placebo yes 248 placebo no 3045 ; proc freq data=scotland1 order=data; tables drug*response / alpha=.05 nocol nopercent riskdiff (cl=wald equal); weight count; ods select CrossTabFreqs RiskDiffCol1 PdiffTest; title 'West of Scotland coronary prevention study: 5 years (success=yes)'; /* ------------------------------------------------------ */ /* 5 years plus 10 year followup study */ data scotland2; input drug : $ 11. response $ count; label response='has a coronary event'; cards; pravastatin yes 390 pravastatin no 2912 placebo yes 509 placebo no 2784 ; proc freq data=scotland2 order=data; tables drug*response / alpha=.05 nocol nopercent riskdif (cl=wald equal); weight count; ods select CrossTabFreqs RiskDiffCol1 PdiffTest; title 'West of Scotland coronary prevention study: 15 years (success=yes)'; /* ------------------------------------------------------ */ run;