Programming the statistical procedures from SAS

proc logistic - odds ratio for interaction terms

Accepted Solution Solved
Reply
N/A
Posts: 1
Accepted Solution

proc logistic - odds ratio for interaction terms

I am running a logistic regression and I need odds ratios and confidence limits for interaction terms using proc logistic.


I am using the contrast statement but don't know if the matrix I have specified is right.

For example, I am looking at the following interactions, 1) group*age and 2) group*sex where group, age and sex are categorical variables having values 1 and 0. The formatting of the variables is as follows:


Sex = 1 if Sex='Male' or Sex=0 if Sex='Female'
Age = 1 if the age of a particular subject is greater than the median age or 0 otherwise.
group = 1 if treatment = 'A' , group = 0 if treatment='B'

Here is the SAS code:


/* All variables below including scin_30day are categorical variables with values 1 and 0 EXCEPT

for the variable BASE which is continuous*/

/*I need to add interaction terms group*age, group*sex, group*BMIn, group*VIsn to the model and see if they are significant

and at the same time need Odds ratios and CL values in the output dataset*/

/*Do I specify the interactions in the contrast statement, if yes, how do I write the contrast statements for the

interactions above??*/

PROC LOGISTIC DATA = final_dataset descending;

   class group agen Male racen DIABn CR2n logn stsn

  ECMRGn EFN Frailn scoren MMSEn BMIn VISn;

  MODEL scin_30day = group BASE agen Male racen DIABn CR2n logn stsn

  ECMRGn EFN Frailn scoren MMSEn BMIn VISn/rsquare lackfit;

  ods output ParameterEstimates=dPara1 OddsRatios=dOdds1;

RUN;


Accepted Solutions
Solution
‎07-03-2017 09:54 AM
Super Contributor
Posts: 543

Re: proc logistic - odds ratio for interaction terms

Hi.

This link is very helpful.

24447 - Examples of writing CONTRAST and ESTIMATE statements

if you scan through it (go to Example 3) you will see how to set up your code to get the CI and OR.

Also, you may search this forum for "interaction term in logistic regression" and find helpful answers.

Anca.

View solution in original post


All Replies
Solution
‎07-03-2017 09:54 AM
Super Contributor
Posts: 543

Re: proc logistic - odds ratio for interaction terms

Hi.

This link is very helpful.

24447 - Examples of writing CONTRAST and ESTIMATE statements

if you scan through it (go to Example 3) you will see how to set up your code to get the CI and OR.

Also, you may search this forum for "interaction term in logistic regression" and find helpful answers.

Anca.

Super User
Posts: 18,495

Re: proc logistic - odds ratio for interaction terms

Not sure you need a contract statement, but what you do need is to add /param=ref to the end of your class statement.

Add your interaction terms to the model statement.

Add the oddsratio statement for the odds ratio you're interested in (assuming at least 9.2+ I think).

You may have to change your ods table names to get different tables.

See here for further reference on getting estimates for odds ratios:

24455 - Estimating an odds ratio for a variable involved in an interaction

PROC LOGISTIC DATA = final_dataset descending;

   class group agen Male racen DIABn CR2n logn stsn

  ECMRGn EFN Frailn scoren MMSEn BMIn VISn/param=ref;

  MODEL scin_30day = group BASE agen Male racen DIABn CR2n logn stsn

  ECMRGn EFN Frailn scoren MMSEn BMIn VISn group*age group*sex add other interaction terms here/rsquare lackfit;

oddsratio agen;

oddsratio male;

oddsratio  group/at=(age=0);

  ods output ParameterEstimates=dPara1 OddsRatios=dOdds1;

RUN;

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 4357 views
  • 6 likes
  • 3 in conversation