/*-------- |fitting logitstic regression to smoking data and loglinear model -------------*/ options ls=90 nocenter nodate; /**********************************************************/ /* fitting to 2x2 table */ data smoke; input s $ y n ; cards; smoke 816 4019 nosmoke 188 1356 ; proc logistic data=smoke descending; class s (ref=first) / param=ref; model y/n = s /scale=none; output out=predict pred=prob; title 'Logistic regression for 2x2 table'; run; proc print data=predict; run; /*without intercept*/ proc logistic data=smoke descending; class s (ref=first)/param=ref; model y/n= /scale=none; title 'Logistic regression without intercept'; run; proc genmod data=smoke; class s; model y/n = /link=logit dist=binomial; title 'Logistic regression with PROC GENMOD'; run; /******************************************************/ /* log-linear model of indepedence 2x2 table */ data smoke; input s $ y $ count; datalines; smoke yes 816 smoke no 3203 nosmoke yes 188 nosmoke no 1168 ; proc genmod data=smoke order=data; class s y; model count = s y /link=log dist=poisson lrci type3 obstats; title 'Loglinear model of indepedence'; run;