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
- /
- Interaction terms in proc logistic; output does no...

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

03-23-2012 06:41 PM

Hi,

i am trying to use the interaction terms (gender*income) in proc logistic, and the program looks like below,

**proc** **logistic** data =library.nismicathcabg4 descending ;

class gender (ref= first) dm dmcx htn_c aids alcohol ANEMDEF arth race1(ref=first) income (ref=first) hosp_location h_contrl(ref=first) hosp_teach bldloss chf chrnlung coag depress drug hypothy liver lymph lytes mets neuro obese para perivasc psych pulmcirc renlfail tumor

ulcer valve wghtloss cararrhythmia /param=ref;

model died= age female dm dmcx htn_c aids alcohol ANEMDEF arth race1 zipinc_qrtl hosp_location h_contrl hosp_teach TOTAL_DISC bldloss chf chrnlung coag depress drug hypothy liver lymph lytes mets neuro obese para perivasc psych pulmcirc renlfail tumor ulcer valve wghtloss cararrhythmia gender*income;

weight discwt;

title 'Logi Reg interaction in-hosp mortality vs gender in overall patients using "where" option with RACE ';

**run**;

**quit**;

But the output doesnot give me the odds ratio and CI levels,

It shows only the significance level.

I am wondering what i should do to get the Odds ratio and CI.

Thanks,

Ashwini

Interaction terms Odds ratio using proc glimmix

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

03-23-2012 07:34 PM

Check the docs, I think it has an example

From the docs:

"If you need to compute odds ratios for an effect involved in interactions or nestings, or using some other parameterization, then you should specify an ODDSRATIO statement for that effect."

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

03-27-2012 06:41 PM

Thanks Reeza, but I have been looking up online about using the ODDSratio statement but havenot found anything so far.

Not sure where exactly to include the ODDS ratio statement in the model.

Any idea?

Thanks a lot!

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

03-28-2012 04:20 AM

Hello,

I was working on a project like this last week. The same problem happened to me! If my memory serves me correct, you should have a data step above the proc logistic step in which you define the interaction terms. So I think if you did something like this, it would work:

Data= library.interaction; set library.nismicathcabg4;

gender_income=gender*income; run;

Proc logistic data=library.interaction;

Class gender income [and other variables] gender_income;

Model died = gender income [and other variables] gender_income;run;

This is the exact code I used for mine, and it gave me odds ratios (below). Hope this helps!

DATA CTS.interaction; set CTS.smokedrop;

gender_parentsmokes= gender*parentsmokes;

gender_sport= gender*sport;

gender_white= gender*ethnic_white;

gender_age=gender*age;

age_parentsmokes= AGE*PARENTSMOKES;

age_white= AGE*ETHNIC_WHITE;

age_sport= AGE*SPORT;

run;

/*VANI GOT AGE*BFGF AGE*RACE RD*BFGF*/

proc logistic data=CTS.interaction desc;

class PARENTSMOKES(DESCENDING) GENDER(DESCENDING) SPORT(DESCENDING) ethnic_white(DESCENDING)

gender_parentsmokes(DESCENDING) gender_sport(DESCENDING) gender_white(DESCENDING);

model CIGMONTHS = ETHNIC AGE PARENTSMOKES GENDER SPORT SMOKE ethnic_white

gender_parentsmokes gender_sport gender_white gender_age

age_parentsmokes age_white age_sport /lackfit;

run;

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

03-29-2012 05:54 PM

thanks for your reply with the above example.

It does work but I am not sure how to read the results. The gender variable has 2 (0= male 1= female) levels and the income has 4 level,(coded 1 to 4 for income strata) so basically both are categorical varibales.

The 3 Odds ratio show as gender_income= 1 vs 4, 2 vs 4 and 3 vs 4. it is not showing the cateogry coded as "0" in the new gender*income variable. The new gender _icnome variable has 45 categories, (0,1,2,3,4)

Any ideas?

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

03-28-2012 05:22 PM

It's a 'statement' not an option in the model.

If you check the docs you'll see it has its own line and you set how you want it to look.

In general you can't get odds ratio for the variables in an interaction term anyways unless you consider the levels of the other variable.

so for your model

add the lines for your variables that are in the interaction terms:

*Other model statements go before;

oddsratio gender;

oddsration income;

run;

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

03-28-2012 09:12 PM

This usage note is very helpful regarding odds ratios for interactions. Starting in SAS 9.2, several nice features have been added to LOGISTIC.

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

03-29-2012 08:35 PM

I used following SAS procedure. to get the OR for interaction term,.

I have never used the proc glimmix before. I am attaching the output in the original post.

WIll appreciate if some one could let me know if it is the correct output and how to interprete it.

**proc** **glimmix** data =library.nismicathcabg4 ; ***/ridging=absolute not needed*/;**

class female dm dmcx htn_c aids alcohol ANEMDEF arth race1 ZIPINC_QRTL hosp_location h_contrl hosp_teach

bldloss chf chrnlung coag depress drug hypothy liver lymph lytes mets neuro obese para perivasc psych pulmcirc renlfail tumor

ulcer valve wghtloss cararrhythmia ;

model died= age female dm dmcx htn_c aids alcohol ANEMDEF arth race1 zipinc_qrtl hosp_location h_contrl hosp_teach TOTAL_DISC

bldloss chf chrnlung coag depress drug hypothy liver lymph lytes mets neuro obese para perivasc psych pulmcirc renlfail tumor

ulcer valve wghtloss cararrhythmia female*ZIPINC_QRTL/dist=binary;

lsmeans female*ZIPINC_QRTL/ slicediff=female oddsratio cl;

weight discwt;

title 'Logi Reg interaction in-hosp mortality vs gender in overall patients using "where" option with RACE ';

**run**;

**quit**;

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

03-29-2012 08:44 PM

what option do i use in proc glimmix to model the probabilty that Died=1?

in proc logistic i used 'desceding ' option.. it doesnot work in proc glimmix.

The GLIMMIX procedure is modeling the probability that DIED='0: Did not die in hospital'. |
---|

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

03-29-2012 08:40 PM

thanks Reea, but I wonder when you mention docs, what are you exactly referring to?

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

03-29-2012 09:44 PM

I get the impression that you did not follow the links within the site I told you about. Example 3 gives you many details on using LOGISTIC for odds ratios with interactions. You don't need GLIMMIX.

http://support.sas.com/kb/24/447.html#ex3

The other docs would be the User's Guide for LOGISTIC that describes the ODDSRATIO statement.

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

03-31-2012 11:57 PM

Thanks for the above link. I read all of it and only a small part made sense to me, may be because I dont have a good mathematical background. Bases on that documentation;I came up with these code for my data anayses, using contrast stament and oddsratio stament in prc logistic.

I would like to make sure, if it looks correct.

I want to see the interaction between gender (variable **female**) and underwent any cardiac procedure (variable **annyproc1**) and looking at the outcome= inhospital mortality/(variable **died**)

**Proc** **logistic** data=library.nismicathcabg4 descending ;

Class female (ref= first) dm dmcx htn_c aids alcohol ANEMDEF arth race1(ref=first) ZIPINC_QRTL(ref=first) hosp_location h_contrl(ref=first) hosp_teach bldloss chf chrnlung coag depress drug hypothy liver lymph lytes mets neuro obese para perivasc psych pulmcirc renlfail tumor anyproc1 ulcer valve wghtloss cararrhythmia /param=ref;

Model died = age dm dmcx htn_c aids alcohol ANEMDEF arth race1 zipinc_qrtl hosp_location h_contrl hosp_teach TOTAL_DISC bldloss chf chrnlung coag depress drug hypothy liver lymph lytes mets neuro obese para perivasc psych pulmcirc renlfail tumor ulcer valve wghtloss cararrhythmia anyproc1 female (anyproc1 )/expb ;

contrast 'female 1 vs 0 in anyproc1'

female (anyproc1 ) **1** **0** -**1** **000**/estimate=both;

weight discwt;

title 'Logi Reg interaction between anyproc vs gender in overall patients using "where" option with RACE ';

**run**;

**Proc** **logistic** data=library.nismicathcabg4 descending ;

Class female (ref= first) dm dmcx htn_c aids alcohol ANEMDEF arth race1(ref=first) ZIPINC_QRTL(ref=first) hosp_location h_contrl(ref=first) hosp_teach bldloss chf chrnlung coag depress drug hypothy liver lymph lytes mets neuro obese para perivasc psych pulmcirc renlfail tumor anyproc1 ulcer valve wghtloss cararrhythmia /param=ref;

Model died = age female dm dmcx htn_c aids alcohol ANEMDEF arth race1 zipinc_qrtl hosp_location h_contrl hosp_teach TOTAL_DISC bldloss chf chrnlung coag depress drug hypothy liver lymph lytes mets neuro obese para perivasc psych pulmcirc renlfail anyproc1 tumor ulcer valve wghtloss cararrhythmia ;

oddsratio female / at(anyproc='1');

weight discwt;

title 'Logi Reg interaction between anyproc vs gender in overall patients using "where" option with RACE ';

**run**;

from the contrast statement:

I could find on this link what do **1** **0** -**1** **000**/ mean from following statement,

contrast 'female 1 vs 0 in anyproc1'

female (anyproc1 ) **1** **0** -**1** **000**/estimate=both;

Appreciate your resposne,

Thanks,

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

03-31-2012 11:59 PM

Also after running the modelw ith oddsratio statement, I didn't find the "p value/ the significance level", in the output, It does show the ods ratio but not the p value/ .

Where should i look for the p value?

I am attaching the output to the original post.

Thanks

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

04-01-2012 09:58 PM

You do not get a p value with the ODDSRATIO statement. If the confidence interval does not include 1, then the effect is significant.You can get the p value from the contrast or estimate statement. If you set up the contrast statement correctly, then the odds ratio output should be the same as the contrast output (for the row corresponding to type=EXP).

The numbers in the contrast statement are the coefficients that multiple the estimated effects to give the desired contrast. Since you don't recognize these, you must be new to the use of contrast and estimate statements. You would have to do quite a bit of reading in the logistic, or genmod, or glm procedures to get comfortable with these. I don't know how many levels there are for anyproc1, and the specific order of the one you are interested in.

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

04-02-2012 03:16 PM

Thank for confirming that the Odds ratio is the value corresponding to type=EXP.

Yes, that is right, i never worked with interactions before, will try to spend some time understanding those numbers.

the interaction variables i am using are all binary coded as 0 and 1.

Variable female coded as (0= male , 1= female)

Variable anyproc1 coded as (0= no, 1= yes)

Variable noproc1 coded as (0= no, 1= yes)

I want to check the interactions between women*anyproc1=1(women who underwent any procedure) , women*noproc1=1, and men*noproc1=1 as compared to men*anyproc=1.

How should I go about this?

How do i inlcude all 3 interactions terms in the model and compare them with the ref (men*anyproc=1)?

Appreciate any help.

Thanks,