I ran some chi-square tests for a binary dependent variable and other binary independent variables. Now I'd like to build a model using all of the independent variables in proc logistic; however, I've been trying to run proc logistic on the dependent variable and one of the independent variables to see if the odds ratio corresponds to the odds ratio I got using the chi-square test. After reading about proc logistic and trying several different code iterations, I haven't been able to get the same odds ratio. Although I've been programming in SAS for years, my stats experience is limited and I feel like I'm missing something.
proc logistic data=statsSetup;
class RiskFactor (ref='1') /param=ref;
model refGroup = RiskFactor /RISKLIMITS CTABLE ;
* I'm trying to model the probability of the non-reference group (refGroup=0);
Here is an example. You may be getting the reciprocal of the odds ratio. To get the right value you typically need to use the EVENT= option in the MODEL statement and the PARAM=REF and REF= options in the CLASS statement to control exactly which response level you are modeling and the predictor level that is in the numerator of the odds ratio. Note that by default, FREQ gives you the odds of the left column value and uses the odds in the first row as the numerator odds. The LOGISTIC options below replicate that.
Thanks Dave. Using your input, I ran my code with the event option '0' and changed the ref option in the class statement to '2' and it worked (my independent variables are 1 for risk factor present and 2 for not present). I appreciate your help.