I am attempting to conduct a mediation analysis of multiple imputation dataset where the outcome variable is binary. I was able to find only limited information online for how to combine causalmed and mianalyze. The only available example (Usage Note 68444: Examples of combining PROC CAUSALMED results in PROC MIANALYZE) is for a continuous outcome. I have attempted to replicate this code, adding a class statement and converting the estimate produced to an odd ratio. I want to ensure the code I produced is correct and that there is not a better way to combine these procedures.
A few details about the data:
TITLE " MULTIPLE IMPUTATION MEDIATION ANALYSIS - depres and dadsmeancat";
proc causalmed data=mi_FCS_ACEcat all;
by _imputation_;
class Depres(descending) ACE_four(descending) fplevel(descending) education(descending) racesap famsmeancat(descending) dadsmeancat(descending);
model Depres=ACE_four dadsmeancat ACE_four*dadsmeancat;
mediator dadsmeancat=ACE_four;
covar mat_age fplevel education racesap famsmeancat;
ods output OutcomeEstimates=Outcome_Est MediatorEstimates=Med_Est PercentDecomp=pctdecomp EffectDecomp=effdecomp EffectSummary=effsum;
run;
proc mianalyze parms(classvar=level)=outcome_Est edf=2126;
Class fplevel education racesap famsmeancat ace_four dadsmeancat;
modeleffects intercept mat_age fplevel education racesap famsmeancat ace_four dadsmeancat ace_four*dadsmeancat;
title 'combined estimates for the outcome model';
run;
proc mianalyze parms(classvar=level)=Med_Est edf=2126;
Class fplevel education racesap famsmeancat ace_four;
modeleffects intercept mat_age fplevel education racesap famsmeancat ace_four;
title 'Combined estimates for the meditor model';
run;
data effsum; set effsum;
OR=exp(estimate);
run;
proc sort data=effsum;
by effect _imputation_;
run;
proc mianalyze data=effsum edf=2126;
by effect;
modeleffects OR;
stderr stderr;
title 'Summary of Causal Effects';
run;
I suspect it has to do with the test that the odds ratio=0. You should test whether it is one. Add the THETA0=1 option on the MIANALYZE statement and see if that helps.
SAS Help Center: PROC MIANALYZE Statement
Are you trying to get Odds Ratios for the Outcome Model or what? What estimates do you want specifically? Right now it looks like you are taking the estimates from the Summary of Effects table and exponentiating them. I do not think that is what you want since the OR (Total Effect), OR (CDE, NDE, NIE) are already in that table.
Thank you for your response @SAS_Rob My intention is to get the total, direct and indirect effects as odds ratios. When running my code without the (data effsum; set effsum; OR=exp(estimate); run; ) piece, I received output in which the p-values did not match the 95% CIs (example of one of the summary of effects outputs below). I may be incorrect but I looked like this inconsistency could be the result of presenting beta estimates rather than ORs and so exponentiating was my attempted solution. The only other thing I thought might be causing this inconsistency was having incorrectly specified the complete degrees of freedom in the edf statement but upon testing different numbers that did not appear to affect the issue. Do you see a reason why the p-values wouldn't match the CIs? Or is this something I should not be concerned about and just present the 95% CIs?
I suspect it has to do with the test that the odds ratio=0. You should test whether it is one. Add the THETA0=1 option on the MIANALYZE statement and see if that helps.
SAS Help Center: PROC MIANALYZE Statement
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.