data Stress; infile "X:\stat504\stress.txt"; *change to your local file path; Input smoke gender age Stress count; run; /*****************************Loglinear Models***********************************/ /**********chi-square test on gender and stress*********/ proc freq; weight count; tables gender*stress / chisq; run; /*********effect of gender**********/ proc catmod; weight count; Model STRESS= GENDER / nogls pred=freq ml; run; /*******effect of gender and age*******/ proc catmod; weight count; Model STRESS= GENDER Age/ nogls pred=freq ml; run; /***********************Polytomous Logistic Regression Models********************/ /************Two responses**********/ Proc Catmod; weight count; Model stress*age =_Response_ /pred=prob; loglin stress|age; run; /************Four responses**********/ Proc Catmod; weight count; Model smoke*gender*age*stress=_Response_ /pred=prob; loglin smoke|gender|age|stress; run; /****************Polytomous Logistics Regression Models with One Response*******/ Proc catmod; weight count; Model stress= gender / nogls pred=freq pred=prob; Proc catmod; weight count; Model stress= age / nogls predict=freq predict=prob; Proc catmod; weight count; Model stress= gender age / nogls pred=freq pred=prob ; Proc catmod; weight count; Model stress= gender age smoke/ nogls pred=freq pred=prob ; run; /****************Polytomous Logistics Regression Models with Two Response*******/ Proc catmod; weight count; Model stress*smoke=gender|age|_response_ / PROB PRED; run; quit;