proc format;
value yes_no 0 = 'No'
1 ='Yes';
run;
data Acc_hist;
Input accpty drkprob prv_acc;
Format accpty drkprob prv_acc yes_no.;
datalines;
1 0 1
1 1 1
1 1 1
1 0 0
1 1 1
0 0 1
0 1 0
0 1 0
0 0 1
0 0 0
0 1 0
0 0 1
0 1 0
0 0 0
0 0 0
1 1 0
1 0 1
1 1 1
1 1 1
1 0 1
1 1 1
1 1 0
1 0 1
1 1 0
1 1 1
0 1 1
0 1 1
0 0 1
0 0 1
0 1 0
0 0 0
0 0 1
0 1 0
0 0 0
0 0 0
1 1 1
1 1 0
1 0 1
1 1 1
1 1 0
1 1 1
1 1 0
1 1 1
1 1 1
1 1 1
;
proc logistic data= Acc_hist descending;
Title 'predicting accidents using drinking prob. & accident history';
model accpty = drkprob prv_acc/
selection = forward
ctable pprob = (0 to 1 by 0.1)
lackfit
risklimits;
run;
proc freq data=Acc_hist;
Title 'odds ratio between past yr accidents and drinking prob. &
past yr accidents and its history';
tables drkprob*accpty prv_acc*accpty / chisq cmh;
run;