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
- /
- Proc Logistic categorical variable

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
- Permalink
- Email to a Friend
- Report Inappropriate Content

08-03-2016 09:08 PM

Hello,

I'm running Proc Logistic for a continuous variable that I have categorized as quartiles. I seem to get two different answers for the odds ratio estimate of Quartile 4 vs Quartile 1 depending on how I code the variable. The first (standard) program is:

proc logistic data=have;

class var_quartile (ref="1") /param=ref;

model outcome (event="1")= var_quartile;

run;

In a second program, I re-coded the predictor as a binary indicator:

data new;

set have;

if var_quartile=4 then var_new=1;

else if var_quartile=1 then var_new=0;

else var_new=.;

run;

proc logistic data=new;

class var_new (ref="0") /param=ref;

model outcome (event="1")= var_new;

run;

Could someone please tell me why SAS gives me two different answers for the same comparion? Thanks.

Accepted Solutions

Solution

08-09-2016
02:02 PM

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

Posted in reply to TJ87

08-03-2016 10:55 PM

TJ87 wrote:

Hi Reeza,

but I'd like to be able to use a binary variable for the comparison of interest.

The OddsRatio doesn't give you the correct comparison?

```
proc logistic data=have;
class var_quartile (ref="1") /param=ref;
model outcome (event="1")= var_quartile;
oddsratio var_quartile;
run;
```

All Replies

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

Posted in reply to TJ87

08-03-2016 09:16 PM

What happens if you run your model as:

```
proc logistic data=have;
where var_quartile in (1, 4);
class var_quartile (ref="1") /param=ref;
model outcome (event="1")= var_quartile;
run;
```

My guess - a rusty one - is the second model totally excludes the var_new with missing and that's affecting the variance estimates.

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

Posted in reply to Reeza

08-03-2016 09:24 PM

Hi Reeza,

That syntax gives me the same wrong answer as if I had used the indicator variable. I've used dummy variables (Quartile2, Quartile3, Quartile4) to calculate the correct answer, but I'd like to be able to use a binary variable for the comparison of interest. Thanks.

Solution

08-09-2016
02:02 PM

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

Posted in reply to TJ87

08-03-2016 10:55 PM

TJ87 wrote:

Hi Reeza,

but I'd like to be able to use a binary variable for the comparison of interest.

The OddsRatio doesn't give you the correct comparison?

```
proc logistic data=have;
class var_quartile (ref="1") /param=ref;
model outcome (event="1")= var_quartile;
oddsratio var_quartile;
run;
```