BookmarkSubscribeRSS Feed
RyanD
Fluorite | Level 6
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.

Here's my code for chi-square and proc logistic:

proc freq data=statsSetup;
tables refGroup*RiskFactor/ chisq relrisk nocol nopercent;
run;

proc logistic data=statsSetup;
class RiskFactor (ref='1') /param=ref;
model refGroup = RiskFactor /RISKLIMITS CTABLE ;
run;
* I'm trying to model the probability of the non-reference group (refGroup=0);


Any help is appreciated.

Thanks,
Ryan
2 REPLIES 2
StatDave
SAS Super FREQ
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.

data FatComp;
input Exposure Response Count;
datalines;
0 0 6
0 1 2
1 0 4
1 1 11
;
proc freq data=FatComp;
weight count;
tables Exposure*Response / relrisk;
run;
proc logistic data=FatComp;
freq count;
class exposure(ref="1")/param=ref;
model response(event="0")=exposure;
run;
RyanD
Fluorite | Level 6
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.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 1368 views
  • 0 likes
  • 2 in conversation