Programming the statistical procedures from SAS

using proc logistic as check for chi-square

Reply
Occasional Contributor
Posts: 18

using proc logistic as check for chi-square

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
SAS Employee
Posts: 240

Re: using proc logistic as check for chi-square

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;
Occasional Contributor
Posts: 18

Re: using proc logistic as check for chi-square

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.
Ask a Question
Discussion stats
  • 2 replies
  • 183 views
  • 0 likes
  • 2 in conversation