BookmarkSubscribeRSS Feed
moni2
Calcite | Level 5
Hello. I need to use PROC CAUSALMED as a part of my analysis. 
 
My question is: how do you appropriately fit continuous variables (exposure and mediator(s) in the PROC CAUSALMED procedure? Is it important to model them as we would traditionally when setting up say a PROC GENMOD with linear regression. Or, should I 'just' insert the variables in the model 'as is' assuming the program will decide on the correct model? 
Essentially:
  1.  I have >1,000 continuous mediators I would like to evaluate. 
  2. A binary outcome (0,1) with time to event 
  3.  Categorical covariates on race/gender which I made into binary variables (0,1) and age which I am hoping to model as quadratic (age age_sq). 
  4. The exposure is continuous and it seemed the best way to model that was log-normalized cubic with restricted splines ( D_Dimer_ln_centered ddimers015 ddimers023 ddimers033). 
  5. I want to include interactions between my exposure and mediator. 
Here is my program below that I am struggling to fit: 
PROC CAUSALMED DATA=G (WHERE=(C7_INCHF20 NE .));
      CLASS r_asian r_white r_black r_natamer cur_smoke for_smoke nev_smoke g_fem g_male / DESCENDING;
      MODEL time_to_event*CHF= D_Dimer_ln_centered ddimers015 ddimers023 ddimers033 mediator1 /COXPH;
      MEDIATOR mediator1 = D_Dimer_ln_centered; *You cannot specify more than one MEDIATOR statement in an analysis.;
      COVAR r_asian r_white r_black r_natamer cur_smoke for_smoke nev_smoke g_fem g_male age age_sq;
RUN;
 
I have reviewed the documentation for the program, but it does not mention what to do with continuous variables (other than you can) and how many variables or how to specify them in the model. 
Thank you in advance for your help. 
4 REPLIES 4
SAS_Rob
SAS Employee

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.

moni2
Calcite | Level 5

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

SAS_Rob
SAS Employee

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

moni2
Calcite | Level 5

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?  

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 4 replies
  • 1278 views
  • 1 like
  • 2 in conversation