CAUSALMED will not find the best model for you. It simply assumes that if you place the variable in the COVAR statement then you intend to use it as a covariate in the outcome and mediator model.
I understand. I am trying to specify my exposure using log-normalized and standardized restricted cubic splines. When I plug my corresponding variables with an interaction with my mediator into the model I get an error:
PROC CAUSALMED DATA=G (WHERE=(C7_INCHF20 NE .));
CLASS race_ncat smokestat sex_ncat / DESCENDING;
MODEL time_to_event*outcome(1) = D_Dimer_ln_centered ddimers015 ddimers023 ddimers033 mediator D_Dimer_ln_centered*mediator ddimers015*mediator ddimers023*mediator ddimers033*mediator / COXPH;
MEDIATOR mediator = D_Dimer_ln_centered ddimers015 ddimers023 ddimers033;
COVAR race_ncat smokestat sex_ncat V3AGE31 age_sq;
RUN;
This is the error I get:
__________
22
76
31
ERROR 22-322: Syntax error, expecting one of the following: ;, (.
ERROR 76-322: Syntax error, statement will be ignored.
32 COVAR race_ncat smokestat sex_ncat V3AGE31 age_sq;
33 RUN;
34
Could you post the entire LOG with the CAUSALMED code and ERRORs in their proper context?
You should only have the treatment and mediator variables (and possibly their interactions) on the MODEL statement, so that might be why you are getting an ERROR. Likewise with the MEDIATOR statement you should only have the treatment variable. All of the other variables would then appear in the COVAR statement. Something similar to this example would show the proper syntax (excepting the AFT option).
SAS Help Center: Causal Mediation Analysis of a Time-to-Event Outcome
Has anyone ever attempted to place covariates or an exposure in the model previously fitted as eg quadratic (so you would need to place more than 1 variable) in the model? If yes, how did you set it up? And if not, are there other options you have used to ensure you are a) correctly modeling your continuous variables and b) fitting your outcome and mediator regression models appropriately?
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.