turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- Analytics
- /
- Stat Procs
- /
- using proc logistic as check for chi-square

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

05-17-2011 09:42 AM

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

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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

05-17-2011 02:24 PM

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;

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;

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

05-18-2011 10:17 AM

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.