/************************************************* ********** SAS code for Scout Example **** **************************************************/ /********6.3.1 Logistic Regression for 2*2 table***********/ options nocenter nodate nonumber linesize=72; data scout1; input S \$ y n; cards; scout 33 376 nonscout 64 424 ; proc logist data=scout1; class S / param=ref ref=first; model y/n = S / scale=none lackfit; run; *intercept-only model; proc logist data=scout1; class S / param=ref ref=first; model y/n = / scale=none lackfit; run; /********6.3.1 Logistic Regression for 3*2 table***********/ data scout2; input S \$ y n; cards; low 53 265 medium 34 270 high 10 265 ; proc logist data=scout2; class S / order=data param=ref ref=first; model y/n = S / scale=none; run; /********6.3.2 Logistic Regression for collapsed table (disaggregate the data by levels of B)***********/ data scout3; input S \$ B \$ y n; cards; low scout 11 54 low nonscout 42 211 medium scout 14 118 medium nonscout 20 152 high scout 8 204 high nonscout 2 61 ; proc logist data=scout3; class S / order=data param=ref ref=first; class B / order=data param=ref ref=last; model y/n = B S / scale=none; run; /********6.3.4 Logistic Regression fitting saturated model with intercept*******************/ data scout4; input S \$ B \$ delinq nondelinq ; y = delinq; n = delinq + nondelinq; cards; low scout 11 43 low nonscout 42 169 medium scout 14 104 medium nonscout 20 132 high scout 8 196 high nonscout 2 59 ; proc logist data=scout4; class B (order=data param=ref ref=last) S (order=data param=ref ref=first); model y/n = B S B*S / scale=none; run; /********6.3.4 Logistic Regression fitting saturated model without intercept*******************/ data scout5; input S \$ B \$ delinq nondelinq ; y = delinq; n = delinq + nondelinq; x1 = (S="low"); x2 = (S="low")*(B="scout"); x3 = (S="medium"); x4 = (S="medium")*(B="scout"); x5 = (S="high"); x6 = (S="high")*(B="scout"); cards; low scout 11 43 low nonscout 42 169 medium scout 14 104 medium nonscout 20 132 high scout 8 196 high nonscout 2 59 ; proc logist data=scout5; model y/n = x1 x2 x3 x4 x5 x6 / noint scale=none; run;