BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
ChrisK
Calcite | Level 5

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;

1 ACCEPTED SOLUTION

Accepted Solutions
AncaTilea
Pyrite | Level 9

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

2 REPLIES 2
AncaTilea
Pyrite | Level 9

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.

Reeza
Super User

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;

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 13511 views
  • 7 likes
  • 3 in conversation