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;
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.
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.
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;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.