the causalmed procedure

90
SAS/STAT ® User’s Guide The CAUSALMED Procedure 2020.1.2* * This document might apply to additional versions of the software. Open this document in SAS Help Center and click on the version in the banner to see all available versions. SAS ® Documentation January 20, 2021

Upload: others

Post on 29-Apr-2022

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: The CAUSALMED Procedure

SAS/STAT®

User’s GuideThe CAUSALMEDProcedure2020.1.2*

* This document might apply to additional versions of the software. Open this document in SAS Help Center and clickon the version in the banner to see all available versions.

SAS® DocumentationJanuary 20, 2021

Page 2: The CAUSALMED Procedure

This document is an individual chapter from SAS/STAT® User’s Guide.

The correct bibliographic citation for this manual is as follows: SAS Institute Inc. 2021. SAS/STAT® User’s Guide. Cary, NC: SASInstitute Inc.

SAS/STAT® User’s Guide

Copyright © 2021, SAS Institute Inc., Cary, NC, USA

All Rights Reserved. Produced in the United States of America.

For a hard-copy book: No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or byany means, electronic, mechanical, photocopying, or otherwise, without the prior written permission of the publisher, SAS InstituteInc.

For a web download or e-book: Your use of this publication shall be governed by the terms established by the vendor at the timeyou acquire this publication.

The scanning, uploading, and distribution of this book via the Internet or any other means without the permission of the publisher isillegal and punishable by law. Please purchase only authorized electronic editions and do not participate in or encourage electronicpiracy of copyrighted materials. Your support of others’ rights is appreciated.

U.S. Government License Rights; Restricted Rights: The Software and its documentation is commercial computer softwaredeveloped at private expense and is provided with RESTRICTED RIGHTS to the United States Government. Use, duplication, ordisclosure of the Software by the United States Government is subject to the license terms of this Agreement pursuant to, asapplicable, FAR 12.212, DFAR 227.7202-1(a), DFAR 227.7202-3(a), and DFAR 227.7202-4, and, to the extent required under U.S.federal law, the minimum restricted rights as set out in FAR 52.227-19 (DEC 2007). If FAR 52.227-19 is applicable, this provisionserves as notice under clause (c) thereof and no other notice is required to be affixed to the Software or documentation. TheGovernment’s rights in Software and documentation shall be only those set forth in this Agreement.

SAS Institute Inc., SAS Campus Drive, Cary, NC 27513-2414

January 2021

SAS® and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in theUSA and other countries. ® indicates USA registration.

Other brand and product names are trademarks of their respective companies.

SAS software may be provided with certain third-party software, including but not limited to open-source software, which islicensed under its applicable third-party software license agreement. For license information about third-party software distributedwith SAS software, refer to http://support.sas.com/thirdpartylicenses.

Page 3: The CAUSALMED Procedure

Chapter 38

The CAUSALMED Procedure

ContentsOverview: CAUSALMED Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2362

Features of the CAUSALMED Procedure . . . . . . . . . . . . . . . . . . . . . . . . 2364Getting Started: CAUSALMED Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . 2366Syntax: CAUSALMED Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2371

PROC CAUSALMED Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2371BOOTSTRAP Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2378BY Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2381CLASS Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2381COVAR Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2383EVALUATE Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2383FREQ Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2387MEDIATOR Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2387MODEL Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2391STD Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2395WEIGHT Statement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2396

Details: CAUSALMED Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2397Causal Mediation Effects: Theory, Definitions, and Effect Decompositions . . . . . . 2397Causal Mediation Effects: Assumptions, Identification, and Estimation . . . . . . . . 2404Evaluating Causal Mediation Effects . . . . . . . . . . . . . . . . . . . . . . . . . . 2408Bootstrap Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2414ODS Table Names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2415

Examples: CAUSALMED Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2417Example 38.1: Mediation Analysis with Interaction Effects and Four-Way Decomposition 2417Example 38.2: Evaluating Controlled Direct Effects and Conditional Mediation Effects 2420Example 38.3: Smoking Effect on Infant Mortality . . . . . . . . . . . . . . . . . . . 2425Example 38.4: Mediation Analysis by Linear Structural Equation Modeling . . . . . . 2432Example 38.5: Causal Mediation Analysis of a Time-to-Event Outcome . . . . . . . . 2435

References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2442

Page 4: The CAUSALMED Procedure

2362 F Chapter 38: The CAUSALMED Procedure

Overview: CAUSALMED ProcedureThe CAUSALMED procedure estimates causal mediation effects from observational data. In causal mediationanalysis, there are four main types of variables:

� an outcome variable Y

� a treatment variable T that is hypothesized to potentially have direct and indirect causal effects on theoutcome variable Y (in epidemiology, a treatment variable is also known as an exposure, sometimesdenoted by A or E)

� a mediator variable M that is hypothesized to be causally affected by the treatment variable T and thatitself has an effect on the outcome variable Y

� a set of pretreatment or background covariates that might confound the observed relationships amongY, T, and M

The relationships among the first three types of variables represent the primary causal mediation effectsof interest. The set of covariates represent background or pretreatment characteristics that confound theobserved relationships among Y, T, and M. To focus on describing the causal mediation and related effects ofinterest, the roles of covariates are omitted for the present discussion and will be described later.

Figure 38.1 represents the first three main variables in a causal diagram (see Pearl 2009 for a general theoryof causal diagrams).

Figure 38.1 Mediation Model

In the terminology of causal diagrams, there are two causal pathways of effects from the treatment variable T:

� A direct pathway: T ! Y

� A mediated or indirect pathway: T ! M! Y

For example, the analyses in “Getting Started: CAUSALMED Procedure” on page 2366 and Example 38.1examine whether parental encouragement (T) affects children’s cognitive development (Y) and whetherthe effect of parental encouragement is mediated by children’s learning motivation (M). The analysis inExample 38.3 examines the effect of smoking (T) on infant mortality (Y) and its mediation effect throughlowering birth weights (M). The analysis in Example 38.5 investigates the effect of red dye in food (T) on thesurvival time (Y) of mice and its mediation effect through the development of reticuloendothelial tumors (M).

Page 5: The CAUSALMED Procedure

Overview: CAUSALMED Procedure F 2363

The mediated or indirect pathway, T ! M! Y, provides an explanation of how the cause T leads to theoutcome Y—that is, through a mechanism by which T first affects a mediator M and then affects Y (see,for example, VanderWeele 2015). In structural equation modeling (see, for example, Bollen 1989), thispathway simply represents an indirect effect of T on Y. Whereas the former interpretation emphasizes therole of the mediator in the mechanism, the latter interpretation emphasizes the root cause in treatment T.Correspondingly, there are two ways to interpret the direct pathway, T ! Y: as the causal effect of T on Ythat is not through the mechanism involving M, or as the direct causal effect of T on Y. As an analysis tool,the CAUSALMED procedure does not distinguish these alternative interpretations.

In traditional structural equation modeling, the diagram representation in Figure 38.1 is often expressed in theform of a linear model that excludes the interaction effect between T and M on Y, which is usually assumedto be continuous. As a result, the definitions and computation of mediation effects do not apply to situationsin which interaction effects or nonlinear models are present.

However, under the counterfactual framework for causal mediation analysis (Robins and Greenland 1992;Pearl 2001), the same diagram representation in Figure 38.1 excludes neither the interaction nor nonlinearmodels. Basing on this counterfactual framework, the CAUSALMED procedure models the followingvariables in causal mediation analysis:

� outcome variable Y: binary, continuous (including time-to-event responses), or count

� treatment variable T: binary or continuous

� mediator variable M: binary or continuous

� covariates: categorical or continuous

Instead of linear models, PROC CAUSALMED supports a limited set of generalized linear models andsurvival models for describing the relationships among the Y, T, and M variables. For survival models,right-censored outcomes, which are indicated by a censoring variable, can also be modeled.

In practice, one of the biggest issues is the presence of confounding covariates in observational data.Confounding covariates are those pretreatment or background characteristics that are associated with the Y, T,and M variables before the treatment and mediation take place. They complicate the observed relationshipsamong Y, T, and M by introducing extraneous associations that are not due to the direct and indirect pathwaysin the causal diagram for mediation analysis.

Therefore, for observational studies, statistical analysis that is based solely on specifying the causal diagramin Figure 38.1 does not lead to causal interpretation of the mediation and related effects. Various approacheshave been proposed for dealing with confounding, including the weighting approach of Hong (2015) andthe Monte Carlo simulation approach of Imai et al. (2010). The CAUSALMED procedure implements theregression approach of VanderWeele (2014). The procedure conducts causal mediation analysis that involvesa single outcome variable, a single treatment variable, a single mediator variable, and multiple covariates.You can analyze multiple outcomes by running the procedure separately for each outcome.

The regression approach relies on correct specification of covariate effects in the outcome and mediatormodels for covariate effect adjustment. The CAUSALMED procedure enables you to specify these covariateeffects in a causal mediation analysis.

Using the CAUSALMED procedure to establish causal interpretations of mediation and related effectsrequires an understanding of the terminology, concepts, and assumptions of causal mediation analysis. These

Page 6: The CAUSALMED Procedure

2364 F Chapter 38: The CAUSALMED Procedure

technical aspects are explained in the sections “Causal Mediation Effects: Theory, Definitions, and EffectDecompositions” on page 2397 and “Causal Mediation Effects: Assumptions, Identification, and Estimation”on page 2404.

Features of the CAUSALMED ProcedureThe CAUSALMED procedure provides the following statements for specifying the regression models in acausal mediation analysis:

� The MODEL statement enables you to specify a generalized linear model or a survival model for theoutcome variable.

� The MEDIATOR statement enables you to specify a generalized linear model for the mediator variable.

� The COVAR statement enables you to specify the covariate effects.

The CAUSALMED procedure fits generalized linear models that have binary, negative binomial, Poisson,or normal distributions for the outcome and that have binary or normal distributions for the mediator. Fortime-to-event outcomes, PROC CAUSALMED fits Cox proportional hazards or accelerated failure timemodels. For accelerated failure time models, you can specify an exponential, gamma, logistic, normal, orWeibull distribution. You can include interaction effects between the treatment and mediator variables andamong the covariates.

If you specify covariate effects in the COVAR statement, the procedure incorporates them when it fits theoutcome and mediator models. The model estimates are then used to compute various causal mediationeffects.

By default, PROC CAUSALMED computes the following main causal mediation effects:

� total effect (TE)

� controlled direct effect (CDE)

� natural direct effect (NDE)

� natural indirect effect (NIE)

For continuous outcomes and time-to-event outcomes that are fitted by the accelerated failure time modelwithout the log transformation, these effects are computed as mean differences on the original scale. For othertime-to-event outcomes, these effects are computed on the hazard ratio scale for the proportional hazardsmodel, and on the mean ratio scale for the accelerated failure time model when the log transformation isapplied to the outcome variable. For binary outcomes, these effects are computed on the odds ratio scale. Fordefinitions of these and other effects, see the sections “Estimands on Difference Scale” on page 2402 and“Estimands on Ratio Scale” on page 2403, and the references therein.

In the literature of causal mediation analysis, more detailed decompositions of mediation effects (that is, thethree-way or four-way decompositions that are described later) have been developed. These decompositionsdistinguish various mediation and interaction effects. You can request these detailed decompositions byoptions.

Page 7: The CAUSALMED Procedure

Features of the CAUSALMED Procedure F 2365

In addition to computing the default estimated effects, PROC CAUSALMED also computes the followingpercentage measures relative to the total effect automatically:

� percentage mediated

� percentage due to interaction

� percentage eliminated

PROC CAUSALMED can compute various two-way, three-way, and four-way decompositions of the totaleffect and their percentages based on formulas of VanderWeele (2014). These decompositions provide moredetailed analyses of the mediation and interaction effects.

PROC CAUSALMED computes a four-way decomposition that includes the following effects:

� controlled direct effect (CDE): the component that is due neither to interaction nor mediation

� reference interaction (IRF or INTref): the component that is due to interaction but not mediation

� mediated interaction (IMD or INTmed): the component that is due to both interaction and mediation

� pure indirect effect (PIE): the component that is due to mediation but not interaction

PROC CAUSALMED computes the following three-way decompositions:

� NDE + PIE + IMD: natural direct effect, pure indirect effect, and mediated interaction

� CDE + PIE + PAI: controlled direct effect, pure indirect effect, and portion attributed to interaction

PROC CAUSALMED computes the following two-way decompositions:

� NDE + NIE: natural direct effect and natural indirect effect

� CDE + PE: controlled direct effect and portion eliminated

� TDE + PIE: total direct effect and pure indirect effect

For more information about estimation of various causal mediation effects and total effect decompositions,see the section “Causal Mediation Effects: Theory, Definitions, and Effect Decompositions” on page 2397.

Because causal mediation effects are generally defined conditionally on values of covariates, it is importantthat you interpret mediation effects at suitable levels of the covariates. You can specify the levels in theEVALUATE statement. If you do not specify the covariate levels, PROC CAUSALMED sets them at somedefault “averaged” levels, which are the same as in the default method that was implemented by Valeri andVanderWeele (2013).

Likewise, you can specify the treatment, control, and mediator levels in the EVALUATE statement to evaluatecausal mediation effects that are dependent on the levels of these variables. For example, the controlled directeffect is always evaluated at a controlled level of the mediator variable. For more information about how to

Page 8: The CAUSALMED Procedure

2366 F Chapter 38: The CAUSALMED Procedure

use the EVALUATE statement, see the section “Evaluating Causal Mediation Effects” on page 2408. For anillustration, see Example 38.2.

PROC CAUSALMED supports the computation of standard errors and confidence intervals for the effects bythe following methods:

� analytic methods that are based on the asymptotic theory for maximum likelihood estimates

� bootstrap methods that are based on resampling

The default is the analytic method. You can request the bootstrap methods by specifying the BOOTSTRAPstatement.

For ratio-type effects, PROC CAUSALMED produces two types of analytic confidence intervals. One isbased on the original (nontransformed) scale, and the other is based on the back-transformation from the logscale. For more information, see the CIRATIO= option.

For more information about the maximum likelihood analytic approach, see the section “Causal Mediation Ef-fects: Assumptions, Identification, and Estimation” on page 2404. For more information about bootstrapping,see the BOOTSTRAP statement and the section “Bootstrap Methods” on page 2414.

Getting Started: CAUSALMED ProcedureThis section illustrates basic features of the CAUSALMED procedure for estimating total, direct, and indirecteffects and their corresponding percentages.

The example presented in this section is patterned after the theoretical educational models that are discussedby Marjoribanks (1974). However, the data in this example are simulated, and neither the analysis nor theinterpretation of procedure output mirrors that of Marjoribanks (1974).

A study is conducted to understand whether an encouraging environment provided by parents has an effecton the cognitive development of children. A key question is whether the effect of parental encouragement isdue in part to its enhancement of children’s motivation to learn. Two pathways of parental encouragementeffect are possible:

� a direct pathway, which can be denoted as Encourage! CogPerform

� a mediated or indirect pathway, which can be denoted as Encourage! Motivation! CogPerform

In these pathways, the variable Encourage represents parental encouragement, the variable Motivationrepresents the learning motivation of the children, and the variable CogPerform represents the cognitiveperformance of the children. In the terminology of mediation analysis, Encourage is a treatment or anexposure, Motivation is a mediator, and CogPerform is an outcome.

A simulated sample of 300 observations is saved in a data set named Cognitive. Each observation has sixvariable values, as shown in Figure 38.2.

Page 9: The CAUSALMED Procedure

Getting Started: CAUSALMED Procedure F 2367

Figure 38.2 First 10 Observations of the Input Data Set

Obs SubjectID FamSize SocStatus Encourage Motivation CogPerform

1 1 7 31 36 40 103

2 2 3 27 36 40 103

3 3 0 25 35 40 99

4 4 6 29 36 40 103

5 5 4 22 33 37 79

6 6 2 23 34 38 87

7 7 0 29 37 41 112

8 8 4 23 34 38 87

9 9 3 20 32 36 71

10 10 3 28 36 40 103

The variables are defined as follows:

� CogPerform: the child’s score on a cognitive test (outcome)

� Encourage: the sum score of the ratings of three items about parents’ encouraging behavior in aquestionnaire (treatment)

� FamSize: the size of the child’s family

� Motivation: the sum score of the child’s levels of motivation as evaluated by the child, the teacher, andthe primary caretaker (mediator)

� SocStatus: the child’s social status, which is an aggregate measure of household income, parents’occupations, and parents’ educational levels

� StudentID: the child’s identifier

Variables FamSize and SocStatus are background or pretreatment characteristics that you would like tocontrol for when observing various causal effects—either total, direct, or mediated.

First, consider an analysis in which the pretreatment characteristics are omitted. The following statementsinvoke PROC CAUSALMED to estimate various effects without controlling for background confoundingvariables:

proc causalmed data=Cognitive all;model CogPerform = Encourage Motivation;mediator Motivation = Encourage;

run;

The ALL option in the PROC CAUSALMED statement displays all available output. The MODEL state-ment specifies the outcome model for CogPerform, which is affected by Encourage and Motivation. TheMEDIATOR statement specifies the mediator model for Motivation, which is affected only by Encourage.

The output produced by PROC CAUSALMED is displayed in Figure 38.3 through Figure 38.6.

Figure 38.3 echoes the modeling information and displays the number of observations read and used in theanalysis; it also identifies the outcome, treatment, and mediator variables. By default, PROC CAUSALMEDassumes normal distributions and identity links for the response variables in the outcome and mediatormodels because they are continuous.

Page 10: The CAUSALMED Procedure

2368 F Chapter 38: The CAUSALMED Procedure

Figure 38.3 Model Information

Model Information

Data Set WORK.COGNITIVE

Outcome Variable CogPerform

Treatment Variable Encourage

Mediator Variable Motivation

Outcome Modeling Generalized Linear Model

Outcome Distribution Normal

Outcome Link Function Identity

Mediator Modeling Generalized Linear Model

Mediator Distribution Normal

Mediator Link Function Identity

Number of Observations Read 300

Number of Observations Used 300

Figure 38.4 presents the estimated effects. All effect estimates and percentage estimates are significant. Thetotal effect estimate is 8.04, which is decomposed into the natural direct effect (NDE=4.28) and naturalindirect effect (NIE=3.76). The estimated controlled direct effect (CDE) is 4.28, which is evaluated at themean value of the mediator variable Motivation by default. In the current model, CDE is the same as NDE. The‘Percentage Mediated’ is 46.74%. This means that slightly less than half of the parental encouragement effecton children’s cognitive development can be attributed to the enhancement of children’s learning motivation.

Figure 38.4 Summary of Total, Direct, and Mediated Effects

Summary of Effects

EstimateStandard

ErrorWald 95%

Confidence Limits Z Pr > |Z|

Total Effect 8.0423 0.03200 7.9796 8.1050 251.30 <.0001

Controlled Direct Effect (CDE) 4.2835 0.1062 4.0754 4.4917 40.33 <.0001

Natural Direct Effect (NDE) 4.2835 0.1062 4.0754 4.4917 40.33 <.0001

Natural Indirect Effect (NIE) 3.7588 0.1091 3.5449 3.9727 34.44 <.0001

Percentage Mediated 46.7377 1.3254 44.1400 49.3353 35.26 <.0001

Percentage Due to Interaction 0 . . . . .

Percentage Eliminated 46.7377 1.3254 44.1400 49.3353 35.26 <.0001

The tables in Figure 38.5 and Figure 38.6 are useful for confirming the direction of the effects. Figure 38.5shows the estimates of the outcome model for CogPerform.

Figure 38.5 Estimates of the Outcome Model

Outcome Model Estimates

Parameter EstimateStandard

ErrorWald 95%

Confidence LimitsWald

Chi-Square Pr > ChiSq

Intercept -201.21 0.6426 -202.47 -199.95 98053.6157 <.0001

Encourage 4.2835 0.1062 4.0754 4.4917 1626.7935 <.0001

Motivation 3.7576 0.1052 3.5514 3.9639 1274.6903 <.0001

Scale 0.4605 0.01880 0.4251 0.4989

Page 11: The CAUSALMED Procedure

Getting Started: CAUSALMED Procedure F 2369

Figure 38.6 shows the estimates of the mediator model for Motivation. The estimates of the direct effects fromEncourage and Motivation are both positive and significant, thus confirming the positive effect of parentalencouragement on children’s learning motivation.

Figure 38.6 Estimates of the Mediator Model

Mediator Model Estimates

Parameter EstimateStandard

ErrorWald 95%

Confidence LimitsWald

Chi-Square Pr > ChiSq

Intercept 4.0428 0.2641 3.5251 4.5605 234.2732 <.0001

Encourage 1.0003 0.007663 0.9853 1.0153 17040.9178 <.0001

Scale 0.2526 0.01031 0.2332 0.2737

Although the preceding analysis is interpretable, it does not take full advantage of the causal analytic tech-niques that are available in the CAUSALMED procedure. In order to draw valid causal interpretations fromobservational data, you must statistically control for all important confounding background characteristics.

Assume that FamSize and SocStatus are the only important confounding background characteristics thatneed to be controlled for. You can specify these variables as covariates in the COVAR statement and usePROC CAUSALMED as follows to fit an appropriate causal mediation model:

proc causalmed data=Cognitive;model CogPerform = Encourage Motivation;mediator Motivation = Encourage;covar FamSize SocStatus;

run;

When the confounding covariates FamSize and SocStatus are included, the procedure adjusts the estimatesof the causal effects, leading to a new set of results which are summarized in Figure 38.7.

Figure 38.7 Summary of Causal Effects

Summary of Effects

EstimateStandard

ErrorWald 95%

Confidence Limits Z Pr > |Z|

Total Effect 6.8435 0.1525 6.5446 7.1424 44.88 <.0001

Controlled Direct Effect (CDE) 4.2962 0.1098 4.0811 4.5114 39.14 <.0001

Natural Direct Effect (NDE) 4.2962 0.1098 4.0811 4.5114 39.14 <.0001

Natural Indirect Effect (NIE) 2.5473 0.1563 2.2410 2.8536 16.30 <.0001

Percentage Mediated 37.2219 1.7523 33.7874 40.6564 21.24 <.0001

Percentage Due to Interaction 0 . . . . .

Percentage Eliminated 37.2219 1.7523 33.7874 40.6564 21.24 <.0001

The total effect of Encourage on CogPerform is now 6.84, which is about 1 point lower than the totaleffect that is obtained without including the confounding covariates in the analysis (see Figure 38.4). Thisdiscrepancy suggests that parts of the observed association between Encourage and CogPerform are indeeddue to their associations with the confounding background covariates. Failure to adjust for the confoundingcovariates led to inflated estimates of the total causal effect in Figure 38.4.

The natural direct effect (NDE) in the current analysis is 4.30, which is not much different from that of thepreceding analysis. However, the natural indirect effect (NIE) is now 2.55, which is more than 1 point lower

Page 12: The CAUSALMED Procedure

2370 F Chapter 38: The CAUSALMED Procedure

than the NIE in Figure 38.4. Finally, the ‘Percentage Mediated’ is now only 37%, which is almost 10% lowerthan the ‘Percentage Mediated’ (47%) that Figure 38.4 shows.

These results demonstrate that you must carefully consider the set of confounding covariates when conductinga causal mediation analysis. First and foremost, the no unmeasured confounding assumption must bereasonably satisfied. That is, to enable causal interpretations of the effect estimates, the baseline covariates forwhich adjustment is made must suffice to control for treatment-outcome, mediator-outcome, and treatment-mediator confounding. Second, causal analysis from observational data might involve many other assumptionsthat require serious attention. For instance, in the current example you could consider the following questions:

1. Why should the analysis assume that the variables Encourage and Motivation do not have an interactioneffect on CogPerform? Is there any justification for this assumption?

2. If there is an interaction effect between the treatment and the mediator, what is the amount of thiseffect?

3. What justifies treating Encourage as the cause and CogPerform as the effect?

4. Is the causal sequence among the variables Encourage, Motivation, and CogPerform properly capturedin the data?

You can address Questions 1 and 2 by fitting a more general model that includes the interaction term todetermine whether the interaction effect is ignorable. PROC CAUSALMED supports outcome models thathave interaction effects, as illustrated in Example 38.1, which presents a continuation of the current analysis.

Question 3 does not have a definite statistical answer. Substantive knowledge or existing evidence of therelationships is required to support these justifications.

An answer to Question 4 must also be justified by using substantive knowledge about the system of interest.In many systems there are temporal conditions that the data must satisfy so that the effects of the treatmenton the outcome, the treatment on the mediator, and the mediator on the outcome can be observed.

Some researchers use longitudinal studies to establish the causal sequence. For instance, you can collectdata in stages to ensure a proper temporal ordering of the causal, mediation, and outcome events. In thisexample, you could collect data for CogPerform several months after collecting data for Motivation, whichwere collected several years after you obtained the information about Encourage and any pretreatmentconfounders.

If you collect all the data at the same time point, you would need to justify that the parental encouragementpattern has long been established and that its effect on children’s learning motivation has been stabilizedwell before the children took the cognitive performance test. In addition, you would also need to justifythat the background or pretreatment characteristics had been stabilized well before the measurements of thetreatment, mediator, and the outcome. Substantive knowledge is required to support these justifications.

The role of CAUSALMED procedure is to estimate causal mediation effects given that all related assumptionsare satisfied. The procedure can only serve as a tool to refute the presence of causal effects (when estimatesare close to zero) given the model. The procedure cannot be used to establish causal interpretations of effectsif the necessary methodological and statistical assumptions are not satisfied. For more information aboutassumptions of causal mediation analysis, see the sections “Causal Mediation Effects: Theory, Definitions,and Effect Decompositions” on page 2397 and “Causal Mediation Effects: Assumptions, Identification, andEstimation” on page 2404.

Page 13: The CAUSALMED Procedure

Syntax: CAUSALMED Procedure F 2371

Syntax: CAUSALMED ProcedureThe following statements are available in the CAUSALMED procedure:

PROC CAUSALMED < options > ;CLASS variables < (options) > . . . < variable< (options) > > < / global-options > ;MODEL outcome=effects < / model-options > ;MEDIATOR mediator=treatment ;COVAR effects ;BOOTSTRAP < options > ;BY variables ;EVALUATE 'label ' assignment < assignment . . . > < / options > ;FREQ variable ;STD variable=value < variable=value . . . > ;WEIGHT variable ;

Together with the PROC CAUSALMED statement, the MODEL and MEDIATOR statements are essential tocausal mediation analysis. The MODEL statement provides the model for the outcome variable; you use thisstatement to specify the effects of the treatment, the mediator, and possibly their interactions on the outcomevariable. The MEDIATOR statement provides the model for the mediator variable; you use this statement tospecify the effect of the treatment on the mediator variable.

In addition to the MODEL and MEDIATOR statements, you use the COVAR statement to specify the effectsof confounding covariates. Because the assumption of no unmeasured confounding covariates is critical tothe validity of causal mediation analysis for observational data, it is important that you specify all importantcovariate effects in this statement.

The CLASS statement, if provided, must precede the MODEL, MEDIATOR, and COVAR statements. TheCLASS statement names the classification variables to be used in the analysis.

The following sections describe the PROC CAUSALMED statement and then describe the other statementsin alphabetical order.

PROC CAUSALMED StatementPROC CAUSALMED < options > ;

The PROC CAUSALMED statement invokes the CAUSALMED procedure. Table 38.1 summarizes theoptions available in the PROC CAUSALMED statement.

Table 38.1 Options Available in the PROC CAUSALMEDStatement

Option Description

Data Set and Variable OptionsDATA= Specifies the input SAS data setDESCENDING Reverses the order of levels of binary outcome and

mediator variables

Page 14: The CAUSALMED Procedure

2372 F Chapter 38: The CAUSALMED Procedure

Table 38.1 continued

Option Description

NAMELENGTH= Specifies the length of effect namesORDER= Specifies the ordering method for the levels of the

classification variableRORDER= Specifies the ordering method for the levels of the

outcome variable

Estimation and AnalysisALPHA= Specifies the level for confidence intervalsCASECONTROL Requests an analysis for a case-control studyCIRATIO= Specifies the scale for confidence interval construction of

ratio-type effectsDECOMP Requests various decompositions of the total effectVARDEF= Specifies the divisor to use in calculating variances or

standard deviations

Displayed OutputNOPRINT Suppresses display of all outputPALL Displays all outputPMEDMOD Displays mediator model parameter estimatesPOUTCOMEMOD Displays outcome model parameter estimatesPSHORT Displays only the basic modeling information and effects

summaryPSUMMARY Displays only the effects summary

Technical DetailsNLOPTIONS Specifies the optimization options for model fittingSINGULAR= Specifies the singularity criterionTHREADS= Specifies the number of threads to use

You can specify the following options:

ALPHA=pspecifies the level 1 – p for constructing confidence intervals. By default, p = 0.05, which correspondsto 1 – p = 95% confidence intervals. If p is greater than 1, it is interpreted as a percentage and dividedby 100. When multiple confidence intervals are constructed, this level is applied to each interval oneat a time. This will not control the coverage probability of the intervals simultaneously. To controlfamilywise coverage probability, you might consider supplying a value of p that is precomputed basedon a method such as Bonferroni adjustment.

CASECONTROLrequests an analysis for a case-control study. When you specify this option, PROC CAUSALMEDfits a mediator model by using only observations for subjects in the control group (VanderWeele andVansteelandt 2010).

In case-control studies, a group of subjects is identified with a target outcome condition (for example,a disease). This group is called the case group. A second group, known as the control group, is formed

Page 15: The CAUSALMED Procedure

PROC CAUSALMED Statement F 2373

by identifying subjects who are known to be absent of the target outcome, but whose backgroundcharacteristics are the same as those of the case group. The values of the hypothesized exposure ortreatment variable of the case and control groups are then compared to see whether the outcome can beattributed to the exposure or treatment variable.

CIRATIO=ALL | LOG | NONTRANS

CIRATIO=(ALL | LOG | NONTRANS)computes the confidence intervals (CIs) for ratio-type causal mediation effects on the log scale, original(nontransformed) scale, or both. These ratio-type effects include the odds ratio, mean ratio, and hazardratio effects, which are all nonnegative and have null (no-effect) values at 1. The z-value and thep-value for testing null hypothesis of no effect are also affected by the choice of these scales. Bydefault, CIRATIO=ALL.

By using the parentheses, you can specify more than one keyword for the CIRATIO= option. Otherwise,you can specify only one of the following keywords for the scale:

ALL computes the CIs, z-values, and p-values of the ratio-type effects that are based onthe log scale and the original effect scale, separately.

LOG computes the Wald-type CIs of ratio-type effects on the log scale and then back-transforms to the confidence limits on the original effect scale by exponentiation.Hence, the constructed CIs for effects are generally asymmetrical around thecorresponding point estimates. The z-value and p-value for testing the null effecthypothesis of no effect on the log scale are also computed.

NONTRANS computes the Wald-type CIs of ratio-type effects on the original scale. Hence, theconstructed CIs for effects are always symmetrical around the corresponding pointestimates. The z-value and p-value for testing the null effect hypothesis of no effecton the original (nontransformed) scale are also computed.

The computations of confidence intervals, z-values, and p-values of estimates for the difference-typeeffects, excess ratios, or percentages are always based on the original (nontransformed) scale andwould not be affected by this option.

DATA=SAS-data-setspecifies an input data set that contains the raw data. If the DATA= option is omitted, the most recentlycreated SAS data set is used.

DECOMP< =i >requests various decompositions of the total effect. By default, several two- and three-way decomposi-tions and a four-way decomposition are computed. When you specify 2, 3, or 4 for i , decompositionsup to an i-way decomposition are computed.

For continuous outcomes, the decomposition of the total effect is on the original continuous scale. Forbinary responses, the decomposition of the total effect is on the excess relative risk scale (VanderWeele2014). In addition, PROC CAUSALMED displays the corresponding decompositions as percentages.

The four-way decomposition is described in the section “Causal Mediation Effects: Theory, Definitions,and Effect Decompositions” on page 2397. It contains the following four components:

� CDE (controlled direct effect): the component effect that is not due to interaction or mediation

Page 16: The CAUSALMED Procedure

2374 F Chapter 38: The CAUSALMED Procedure

� IRF (reference interaction): the component effect that is due to interaction but not mediation (IRFis denoted as INTref in VanderWeele (2014))

� IMD (mediated interaction): the component effect that is due to both interaction and mediation(IMD is denoted as INTmed in VanderWeele (2014))

� PIE (pure indirect effect): the component effect that is due to mediation but not interaction

PROC CAUSALMED computes the following three-way decompositions:

� NDE + PIE + IMD: natural direct effect, pure indirect effect, and mediated interaction

� CDE + PIE + PAI: controlled direct effect, pure indirect effect, and portion attributed to interaction

PROC CAUSALMED computes the following two-way decompositions:

� NDE + NIE: natural direct effect and natural indirect effect

� CDE + PE: controlled direct effect and portion eliminated

� TDE + PIE: total direct effect and pure indirect effect

For more information about the logic and interpretations of these decompositions, see VanderWeele(2014) and VanderWeele (2015).

DESCENDING

DESCEND

DESCsorts the levels of the binary outcome and the binary mediator variables in reverse of the specifiedorder.

NAMELENGTH=nspecifies the maximum length of effect names in tables to be n characters, where n is a value between20 and 128. By default, NAMELEN=20.

NLOPTIONS(nlo-options)specifies options for the nonlinear optimization methods that are used for fitting the specified models.You can specify one or more of the following nlo-options separated by spaces:

ABSCONV=r

ABSTOL=rspecifies an absolute function convergence criterion by which minimization stops whenf . .k// � r , where is the vector of parameters in the optimization and f .�/ is the ob-jective function. The default value of r is the negative square root of the largest double-precisionvalue.

ABSFCONV=r

ABSFTOL=rspecifies an absolute function difference convergence criterion. Termination requires a smallchange of the function value in successive iterations,

jf . .k�1// � f . .k//j � r

where denotes the vector of parameters that participate in the optimization and f .�/ is theobjective function. By default, ABSFCONV=0.

Page 17: The CAUSALMED Procedure

PROC CAUSALMED Statement F 2375

ABSGCONV=r

ABSGTOL=rspecifies an absolute gradient convergence criterion. Termination requires the maximum absolutegradient element to be small,

maxjjgj .

.k//j � r

where denotes the vector of parameters that participate in the optimization and gj .�/ is the gra-dient of the objective function with respect to the jth parameter. By default, ABSGCONV=1E–7.

FCONV=r

FTOL=rspecifies a relative function convergence criterion. Termination requires a small relative changeof the function value in successive iterations,

jf . .k// � f . .k�1//j

jf . .k�1//j� r

where denotes the vector of parameters that participate in the optimization and f .�/ is theobjective function. By default, FCONV=10�FDIGITS, where by default FDIGITS is � log10f�g,where � is the machine precision.

GCONV=r

GTOL=rspecifies a relative gradient convergence criterion. For all values of the TECHNIQUE= suboptionexcept CONGRA, termination requires the normalized predicted function reduction to be small,

g. .k//0ŒH.k/��1g. .k//jf . .k//j

� r

where denotes the vector of parameters that participate in the optimization, f .�/ is the objectivefunction, and g.�/ is the gradient. When TECHNIQUE=CONGRA (for which a reliable Hessianestimate H is not available), the following criterion is used:

k g. .k// k22 k g. .k// k2k g. .k// � g. .k�1// k2 jf . .k//j

� r

By default, GCONV=1E–8.

MAXFUNC=n

MAXFU=nspecifies the maximum number of function calls in the optimization process. The default valuesdepend on the value of the TECHNIQUE= suboption as follows:

� TRUREG, NRRIDG, and NEWRAP: 125� QUANEW and DBLDOG: 500� CONGRA: 1,000

The optimization can terminate only after completing a full iteration. Therefore, the number offunction calls that are actually performed can exceed n.

Page 18: The CAUSALMED Procedure

2376 F Chapter 38: The CAUSALMED Procedure

MAXITER=n

MAXIT=nspecifies the maximum number of iterations in the optimization process. The default valuesdepend on the value of the TECHNIQUE= suboption as follows:

� TRUREG, NRRIDG, and NEWRAP: 50� QUANEW and DBLDOG: 200� CONGRA: 400

These default values also apply when n is specified as a missing value.

MAXTIME=rspecifies an upper limit of r seconds of CPU time for the optimization process. Because the timeis checked only at the end of each iteration, the actual run time might be longer than r . By default,CPU time is not limited.

TECHNIQUE=CONGRA | DBLDOG | NEWRAP | NRRIDG | QUANEW | TRUREGspecifies the optimization technique to obtain maximum likelihood estimates. You can specifythe following values:

CONGRA performs a conjugate-gradient optimization.

DBLDOG performs a version of double-dogleg optimization.

NEWRAP performs a Newton-Raphson optimization that combines a line-search algo-rithm with ridging.

NRRIDG performs a Newton-Raphson optimization with ridging.

QUANEW performs a dual quasi-Newton optimization.

TRUREG performs a trust-region optimization.

By default, TECHNIQUE=NRRIDG.

For more information about these optimization methods, see the section “Choosing an Optimiza-tion Algorithm” on page 532 in Chapter 20, “Shared Concepts and Topics.”

NOPRINTsuppresses all displayed output. For more information about the options for controlling output display,see the section “ODS Table Names” on page 2415.

ORDER=DATA | FORMATTED | FREQ | INTERNALspecifies the sort order for the levels of CLASS variables. This ordering determines which parametersin the model correspond to each level in the data.

You can specify the following values:

DATA sorts the levels in their order of appearance in the input data set.

FORMATTED sorts the levels by external formatted values, except for numeric variables that haveno explicit format, which are sorted by their unformatted (internal) values. The sortorder is machine-dependent.

Page 19: The CAUSALMED Procedure

PROC CAUSALMED Statement F 2377

FREQ sorts the levels by descending frequency count. Levels that have more observationscome earlier in the order.

INTERNAL sorts the levels by an unformatted value. The sort order is machine-dependent.

By default, ORDER=FORMATTED. For more information about sort order, see the chapter on theSORT procedure in the Base SAS Procedures Guide and the discussion of BY-group processing in SASProgrammers Guide: Essentials.

PALL

ALLdisplays all output tables. For more information about the options for controlling output display, seethe section “ODS Table Names” on page 2415.

PMEDMODdisplays parameter estimates for the mediator model. For more information about the options forcontrolling output display, see the section “ODS Table Names” on page 2415.

POUTCOMEMODdisplays parameter estimates for the outcome model. For more information about the options forcontrolling output display, see the section “ODS Table Names” on page 2415.

PSHORTdisplays only the basic modeling information and the summary of effects. When you specify thisoption, you can also display the effect decomposition table by specifying the DECOMP option. Formore information about the options for controlling output display, see the section “ODS Table Names”on page 2415.

PSUMMARYdisplays only a summary of effects. When you specify this option, you can also display the effectdecomposition table by specifying the DECOMP option. For more information about the options forcontrolling output display, see the section “ODS Table Names” on page 2415.

RORDER=DATA | FORMATTED | FREQ | INTERNAL

RESPORDER=DATA | FORMATTED | FREQ | INTERNALspecifies the sort order for the levels of the outcome variable. In order for this option to apply, eitherthe outcome variable must be specified in the CLASS statement or the DIST=BIN option must bespecified in the MODEL statement. The following table shows how PROC CAUSALMED interpretsvalues of the RORDER= option.

Value of RORDER= Levels Sorted By

DATA Order of appearance in the input data set.FORMATTED External formatted value, except for numeric

variables that have no explicit format, whichare sorted by their unformatted (internal) value.The sort order is machine-dependent.

FREQ Descending frequency count. Levels that have themost observations come first in the order.

INTERNAL Unformatted value. The sort order is machine-dependent.

Page 20: The CAUSALMED Procedure

2378 F Chapter 38: The CAUSALMED Procedure

By default, RORDER=FORMATTED. The DESCENDING option in the PROC CAUSALMEDstatement causes the response variable to be sorted in reverse of the order displayed in the previoustable. For more information about sort order, see the chapter on the SORT procedure in the Base SASProcedures Guide.

SINGULAR=tolerancespecifies the tolerance for testing the singularity of a matrix, where tolerance must be between 0 and 1.The default tolerance is 1E7 times the machine precision.

THREADS=n

NTHREADS=nspecifies the number of threads (n) for analytic computations and overrides the SAS system op-tion THREADS | NOTHREADS. If you do not specify the THREADS= option or if you specifyTHREADS=0, the number of threads is determined from the number of CPUs in the host on which theanalytic computations execute.

VARDEF=DF | N | WDF | WEIGHT | WGTspecifies the divisor to use in calculating the variance and standard deviation. By default, VARDEF=DF.With n denoting the total number of observations and wi denoting the weight for observation i, thevalues and associated divisors are displayed in the following table.

Value Description Divisor

DF Degrees of freedom n � 1

N Number of observations n

WDF Sum of weights DFPi wi � 1

WEIGHT | WGT Sum of weightsPi wi

You can use the WEIGHT statement to specify the variable that contains weights. If the WEIGHTstatement is not used, each wi has a value of 1.

BOOTSTRAP StatementBOOTSTRAP < options > ;

The BOOTSTRAP statement requests bootstrap estimates of standard errors and bootstrap confidenceintervals for various effects and percentages of total effects.

Table 38.2 summarizes the options available in the BOOTSTRAP statement.

Page 21: The CAUSALMED Procedure

BOOTSTRAP Statement F 2379

Table 38.2 Summary of Options in BOOTSTRAP Statement

Option Description

BOOTCI Produces bootstrap confidence intervals for effects and percentagesIGNORECC Ignores the case-control design and performs a regular bootstrap samplingMINSAMP= Specifies the minimum number of converged bootstrap samples required

for bootstrap estimationNBOOT= Specifies the number of bootstrap sample data sets (replicates)NOSKIP Includes bootstrap samples that have inconsistent class levelsSEED= Specifies the seed that initializes the random number stream

You can specify the following options:

BOOTCI < (BC | NORMAL | PERC | ALL) >

CI < (BC | NORMAL | PERC | ALL) >computes bootstrap-based confidence intervals for the effects and percentages of effects, and displaysthem in the “Summary of Effects” table. This table includes a column that indicates the numberof bootstrap samples used to compute the confidence intervals; this column is not displayed but isavailable if you save the table as an output data set by using the ODS OUTPUT statement. You canalso display this column by modifying the corresponding template.

You can specify one or more of the following types of bootstrap confidence intervals separated byspaces:

ALL produces all three confidence intervals, which are described in the following types.

BC produces bias-corrected confidence intervals. You must specify a value of 1,000or more for the NBOOT= option, but the confidence intervals are not computed iffewer than 900 bootstrap replicates produce bootstrap estimates.

NORMAL produces confidence intervals that are based on the assumption that bootstrapestimates follow a normal distribution. You must specify a value of 50 or more forthe value NBOOT= option, but the corresponding standard errors and confidenceintervals are not computed if fewer than 30 bootstrap replicates produce bootstrapestimates.

PERC produces percentile-based confidence intervals. You must specify a value of 1,000or more for the NBOOT= option, but the confidence intervals are not computed iffewer than 900 bootstrap replicates produce bootstrap estimates.

The ALPHA= option in the PROC CAUSALMED statement sets the confidence level for constructingbootstrap intervals. For more information about how bootstrap-based confidence intervals are computed,see the section “Bootstrap Methods” on page 2414. By default, PROC CAUSALMED produces bias-corrected confidence intervals (BOOTCI(BC)) based on 1,000 bootstrap samples.

Page 22: The CAUSALMED Procedure

2380 F Chapter 38: The CAUSALMED Procedure

IGNORECCignores the case-control design and performs a regular bootstrap sampling that draws observationsfrom the entire sample with replacement. When you specify a case-control design by using theCASECONTROL option and omit the IGNORECC option, the default bootstrapping draws samplesseparately from the case and control groups. As a result, the bootstrap samples maintain the samenumbers of case and control observations as those of the original sample. However, when you specifythe IGNORECC option, it overrides the default bootstrap sampling method for case-control studies,and the numbers of case and control observations generally vary from (bootstrap) sample to sample.

If you do not specify the CASECONTROL option, the procedure performs regular bootstrappingautomatically and the IGNORECC option is irrelevant.

MINSAMP=nspecifies the minimum number of converged bootstrap samples that is required for conducting anybootstrap estimation, where n is between 30 and 10,000. By default, n=30.

NBOOT=n

NSAMPLE=n

NSAMPLES=nspecifies the number of bootstrap sample data sets (replicates), where n is between 50 and 10,000. Bydefault, n=1000.

NOSKIPincludes in the bootstrap estimation bootstrap samples that have inconsistent class levels in either themediator or outcome model. By default, for any classification variable in a bootstrap sample data setthat does not contain all levels that have been used in fitting either the mediator or outcome model forthe original input data set, PROC CAUSALMED treats the corresponding bootstrap sample estimatesas nonconvergent and skips the estimation of the mediation effects. This option overrides the defaultand continues the estimation of the mediation effects for bootstrap samples that have inconsistent classlevels.

SEED=nprovides the seed that initializes the random number stream for generating the bootstrap sample datasets (replicates). If you do not specify this option or if you specify a value for n that is less than orequal to 0, the seed is generated from reading the time of day from the computer’s clock. The largestpossible value for the seed is 231 � 1.

You can use the SYSRANDOM and SYSRANEND macro variables after a PROC CAUSALMEDstep to query the initial and final seed values. However, using the final seed value as the starting seedfor a subsequent analysis does not continue the random number stream where the previous analysisended. The SYSRANEND macro variable provides a mechanism to pass on seed values to ensure thatthe sequence of random numbers is the same every time you run an entire program. To reproduce therandom number stream that was used to generate bootstrap estimates, you must specify the same valuefor the SEED= option and the same value for the THREADS= option in the PROC CAUSALMEDstatement.

Page 23: The CAUSALMED Procedure

BY Statement F 2381

BY StatementBY variables ;

You can specify a BY statement in PROC CAUSALMED to obtain separate analyses of observations ingroups that are defined by the BY variables. When a BY statement appears, the procedure expects the inputdata set to be sorted in order of the BY variables. If you specify more than one BY statement, only the lastone specified is used.

If your input data set is not sorted in ascending order, use one of the following alternatives:

� Sort the data by using the SORT procedure with a similar BY statement.

� Specify the NOTSORTED or DESCENDING option in the BY statement in the CAUSALMEDprocedure. The NOTSORTED option does not mean that the data are unsorted but rather that thedata are arranged in groups (according to values of the BY variables) and that these groups are notnecessarily in alphabetical or increasing numeric order.

� Create an index on the BY variables by using the DATASETS procedure (in Base SAS software).

For more information about BY-group processing, see the discussion in SAS Language Reference: Concepts.For more information about the DATASETS procedure, see the discussion in the Base SAS Procedures Guide.

CLASS StatementCLASS variable < (options) > . . . < variable < (options) > > < / global-options > ;

The CLASS statement names one or more classification variables to be used as explanatory variables in theanalysis.

The CLASS statement must precede the COVAR, MEDIATOR, and MODEL statements. Most options canbe specified either as individual variable options or as global-options. You can specify options for eachvariable by enclosing the options in parentheses after the variable name. You can also specify global-optionsfor the CLASS statement by placing them after a slash (/). Global-options are applied to all the variablesspecified in the CLASS statement. However, individual CLASS variable options override the global-options.Unless otherwise indicated, you can specify the following values for either an option or a global-option:

CPREFIX=nuses at most the first n characters of a CLASS variable name in creating names for the correspondingdesign variables. The default is 32 � min.32;max.2; f //, where f is the formatted length of theCLASS variable.

DESCENDING

DESCreverses the sort order of the CLASS variables. If both the DESCENDING and ORDER= optionsare specified, PROC CAUSALMED orders the categories according to the ORDER= option and thenreverses that order.

Page 24: The CAUSALMED Procedure

2382 F Chapter 38: The CAUSALMED Procedure

LPREFIX=nuses at most the first n characters of a CLASS variable name in creating labels for the correspondingdesign variables. The default is 256 �min.256;max.2; f //, where f is the formatted length of theCLASS variable.

MISSINGtreats missing values (blanks for character variables and ., ._, .A, . . . , .Z for numeric variables) as validvalues for the CLASS variables.

ORDER=DATA | FORMATTED | FREQ | INTERNALspecifies the sort order for the levels of CLASS variables. This ordering determines which parametersin the model correspond to each level in the data.

You can specify the following values:

DATA sorts the levels in their order of appearance in the input data set.

FORMATTED sorts the levels by external formatted values, except for numeric variables that haveno explicit format, which are sorted by their unformatted (internal) values. The sortorder is machine-dependent.

FREQ sorts the levels by descending frequency count. Levels that have more observationscome earlier in the order.

INTERNAL sorts the levels by an unformatted value. The sort order is machine-dependent.

By default, ORDER=FORMATTED. For more information about sort order, see the chapter on theSORT procedure in the Base SAS Procedures Guide and the discussion of BY-group processing in SASProgrammers Guide: Essentials.

REF='level ' | FIRST | LASTspecifies a level of the CLASS variable to be put at the end of the list of levels. This level thuscorresponds to the reference level in the usual interpretation of the linear estimates that have a singularparameterization.

You can specify the following values:

'level ' specifies the level of the variable to use as the reference level. Specify the formatted valueof the variable if a format is assigned. You cannot specify 'level ' as a global-option.

FIRST designates the first ordered level as the reference level.

LAST designates the last ordered level as the reference level.

By default, REF=LAST.

TRUNCATE< =n >specifies the length (n) of variable values to use in determining the CLASS variable levels. The defaultis to use the full formatted length of the CLASS variable. If you specify this option without the lengthn, the first 16 characters of the formatted values are used. The TRUNCATE option is available only asa global-option.

Page 25: The CAUSALMED Procedure

COVAR Statement F 2383

COVAR StatementCOVAR effects ;

The COVAR statement specifies the effects of covariates in a causal mediation analysis. These covariatesrepresent important confounders in the causal model. You do not need to distinguish confounders for thetreatment-outcome, treatment-mediator, or mediator-outcome relationships. You simply enter all confoundingcovariate effects in this statement. PROC CAUSALMED appends these effects into the design matrices of theoutcome and mediator models that you specify in the MODEL and MEDIATOR statements, respectively. Thecausal mediation and other related effects are thus estimated with adjustment for confounding by includingcovariate effects in outcome and mediator modeling.

The simplest form of effects is a list of confounding covariates. For example, the following statementspecifies that C1, C2, and C3 are confounding covariates in the causal model:

covar C1 C2 C3;

You can also include interaction terms in the specification. For example, the following statement adds theinteraction of C1 and C2 as a confounding effect to the preceding specification:

covar C1 C2 C3 C1*C2;

Alternatively, you can use the following equivalent specification:

covar C1|C2 C3;

If a confounding covariate represents nominal (classification) data, you must also include the covariate in theCLASS statement. For more information about specifying effects, see the section “Specification of Effects”on page 4127 in Chapter 53, “The GLM Procedure.”

EVALUATE StatementEVALUATE 'label ' assignment < assignment . . . > < / options > ;

You use the EVALUATE statement to specify variable levels or values for evaluating various effects. In theassignments, you can specify one or more of the following variable levels:

� the control and treatment levels for computing all effects

� the mediator level for computing the controlled direct effect

� the covariate levels for evaluating various conditional causal effects

Each assignment is of the form

var-key=value-key

where var-key specifies a variable and value-key is either its numerical value, its character value, or a keyword(such as MEAN) that generates a value from the variable.

Page 26: The CAUSALMED Procedure

2384 F Chapter 38: The CAUSALMED Procedure

Because of interaction effects and nonlinear models, computation of causal mediation effects usually dependon the values or levels of the treatment, control, mediator, or covariate levels. PROC CAUSALMED assignsvalues or levels to these variables automatically when it performs a default mediation effect analysis. Bysetting these default variable levels, you obtain “overall” measures of causal mediation and related effects.For more information about how PROC CAUSALMED sets the default values of levels, see the section“Evaluating Causal Mediation Effects” on page 2408.

However, to address your particular research questions more directly, you can provide EVALUATE statementswith specific variable levels to evaluate mediation and related effects. Specifying covariate levels, thetreatment level (of the treatment variable), or the control level (of the treatment variable) changes theestimates of all mediation effects and decompositions. Specifying the controlled level of the mediatorvariable does not change the estimates of the total effect (TE), the natural direct effect (NDE), or the naturalindirect effect (NIE). But it does change the estimates of the controlled direct effect (CDE) and the referenceinteraction (IRF).

You can provide as many EVALUATE statements as you want. Each statement specifies an assignmentscheme that defines the mediation effects and produces a summary of effects, decompositions of effects (ifrequested), and percentage decompositions of effects (if requested).

To distinguish the results that are produced by different EVALUATE statements, you can specify a distinctlabel in each EVALUATE statement. A maximum of 256 characters is allowed for each label . This label isdisplayed in the output tables.

For example, suppose that C1 and C2 are continuous covariates in the mediation model and you want toevaluate the mediation effects at C1=5 and C2=10. You can request that by providing the following statement:

evaluate 'Set C1=5 C2=10' C1=5 C2=10;

In this statement, the quoted string, 'Set C1=5 C2=10', labels the set of assignments for evaluating themediation effects and is followed by the assignments, C1=5 and C2=10.

If you want to evaluate the mediation effects conditioned on a different set of covariate values, you can addanother EVALUATE statement. For example,

evaluate 'Scheme 1 -- C1=5 C2=10' C1=5 C2=10;evaluate 'Scheme 2 -- C1=10 C2=5' C1=10 C2=5;

Meaningful labels for the EVALUATE statements are highly recommended in practice.

If you use '_Default' as the label , PROC CAUSALMED overrides the default variable levels for evaluatingmediation effects. For example, the following statement generates only one set of mediation effect outputtables, which replace the default tables:

evaluate '_Default' C1=5 C2=10; /* Overrides the default assignment scheme */

In addition to the use of fixed value assignments (such as C1=5 in the preceding examples), PROCCAUSALMED provides several ways to specify the var-key and the value-key in an assignment .

You can use the following var-keys in an assignment:

Page 27: The CAUSALMED Procedure

EVALUATE Statement F 2385

_CONTROL | _A0 | _T0

varname(CONTROL)specifies the control level of the treatment variable, where varname represents the actual treatmentvariable name.

covariate-namespecifies a covariate by using its actual variable name for covariate-name.

_MEDIATOR | _MSTAR

varnamespecifies the controlled level of the mediator variable, where varname represents the actual mediatorvariable name.

_TREATMENT | _A1 | _T1

varname(TREATMENT)specifies the treatment level of the treatment variable, where varname represents the actual treatmentvariable name.

In all the preceding examples, actual variable names have served as var-keys and numerical values haveserved as value-keys. The following statements show examples of assignments that specify keywords forvar-keys:

evaluate 'Scheme 3' _treatment=max _control=mean _mediator=last C1=mode;evaluate 'Scheme 4' _A1=0 _A0=1 _mstar=10 C1='Boys';evaluate 'Scheme 5' _A1=.5 _A0=-.5 _mediator=0 C1=2;

You can use the following value-keys in an assignment:

'level 'assigns the level of the corresponding classification variable that is specified in the var-key , where levelrepresents an actual character level of the variable.

FIRSTassigns the first level of the corresponding classification variable that is specified in the var-key .

LASTassigns the last level of the corresponding classification variable that is specified in the var-key .

MAXassigns the maximum variable value (denoted as max) of the corresponding numerical variable that isspecified in the var-key . If you assign this value-key to both the treatment and control levels of thetreatment variable, then the treatment level is max+0.5 and the control level is max–0.5. If you assignthis value-key to the treatment level but not the control level, then the treatment level is max and thecontrol level is max–1. If you assign this value-key to the control level but not the treatment level, thenthe control level is max and the treatment level is max+1.

Page 28: The CAUSALMED Procedure

2386 F Chapter 38: The CAUSALMED Procedure

MEANassigns the mean variable value (denoted as mean) of the corresponding numerical variable that isspecified in the var-key . If you assign this value-key to both the treatment and control levels of thetreatment variable, then the treatment level is mean+0.5 and the control level is mean–0.5. If youassign this value-key to the treatment level but not the control level, then the treatment level is meanand the control level is mean–1. If you assign this value-key to the control level but not the treatmentlevel, then the control level is mean and the treatment level is mean+1.

MINassigns the minimum variable value (denoted as min) of the corresponding numerical variable that isspecified in the var-key . If you assign this value-key to both the treatment and control levels of thetreatment variable, then the treatment level is min+0.5 and the control level is min–0.5. If you assignthis value-key to the treatment level but not the control level, then the treatment level is min and thecontrol level is min–1. If you assign this value-key to the control level but not the treatment level, thenthe control level is min and the treatment level is min+1.

MODEassigns the modal level of the corresponding CLASS variable that is specified in the var-key . Inmultimodal situations, the modal classes are averaged in a particular way. For more information aboutthe averaging process of modal classes, see the section “Evaluating Causal Mediation Effects” onpage 2408.

value< (SD) >assigns the numerical value in the assignment , where value represents a fixed number. If you usethe SD option, the measurement scale of the numerical value refers to the measurement scale of thestandardized variable. Hence, with the SD option the actual assigned value is

mC value � s

where m and s are the sample mean and standard deviation, respectively, of the corresponding variablethat is specified in the var-key of the assignment .

The following statements show examples of assignments that use different types of keywords for value-keys:

evaluate 'Evaluation 6' _treatment=.5(SD) _control=-0.5(SD) _mediator=minC1=mode;

evaluate 'Evaluation 7' _A1=first _A0=last _mediator=mean C1='Boys';

After specifying the assignments in an EVALUATE statement, you can use one or more of the followingoptions to control the displays of mediation effects and decompositions that are generated by the EVALUATEstatement:

CLABEL='clabel '

CLABEL=clabelspecifies a short content-label for the mediation effects that are generated by the EVALUATE statement.The clabel is used to label the corresponding set of tables in the output. Only the first 20 characters ofclabel is used. If you do not specify this option, the first 20 characters of the label , which you specifyin the beginning of the EVALUATE statement, is used as clabel .

Page 29: The CAUSALMED Procedure

FREQ Statement F 2387

DECOMP< =i >specifies the type of decompositions requested, where i is between 2 and 4, representing two-, three-,or four-way decompositions, respectively. If you specify the DECOMP= options in the PROCCAUSALMED statement and in an EVALUATE statement, the DECOMP option in the EVALUATEstatement is used for evaluating the requested effects.

NODECOMPsuppresses the display of all decomposition results for the specified evaluation scheme of mediationeffects. Only the summary table of effects is shown. This option also overrides the DECOMP= optionin the same EVALUATE statement.

For more information about how variable levels are related to the interpretation of causal mediation effects,see the section “Evaluating Causal Mediation Effects” on page 2408. For illustrations of the use of theEVALUATE statement, see Example 38.2 and Example 38.3.

FREQ StatementFREQ variable ;

If a variable in the data set represents the frequency of occurrence for the other values in the observation,include the variable’s name in a FREQ statement. The procedure then treats the data set as if each observationappears n times, where n is the value of the FREQ variable for the observation. The total number ofobservations is considered to be equal to the sum of the FREQ variable values when the procedure determinesdegrees of freedom for significance probabilities.

If the value of the FREQ variable is missing or is less than 1, the observation is not used in the analysis. Ifthe value is not an integer, the value is truncated to an integer.

MEDIATOR StatementMEDIATOR mediator< (med-options) >=treatment< (treat-options) > ;

The MEDIATOR statement is required for specifying the mediator model. You provide mediator (the nameof the mediator variable) to the left of the equal sign and treatment (the name of the treatment variable) tothe right. You cannot specify more than one MEDIATOR statement in an analysis.

For example, the following statement specifies M as the mediator variable and T as the treatment variable inthe analysis:

mediator M = T;

Together, the COVAR, MEDIATOR, and MODEL statements specify the relationships of all variables in themediation analysis. The mediator and treatment variables that you specify in the MEDIATOR statement mustbe consistent with those that you specify in the MODEL statement. If there are covariates in the analysis, donot specify them or their effects in the MEDIATOR statement even though covariate effects on the mediatorvariable are being modeled. Instead, use the COVAR statement to specify covariate effects.

Mediator and treatment variables can be either binary or continuous. You can specify that a mediator ortreatment variable is a binary variable by listing it in the CLASS statement. Otherwise, it is assumed to becontinuous.

Page 30: The CAUSALMED Procedure

2388 F Chapter 38: The CAUSALMED Procedure

PROC CAUSALMED assumes a normal distribution and the identity link function for a continuous mediator,and a Bernoulli distribution (binomial distribution of a single trial) and the logit link function for a binarymediator.

For binary mediators, it is important to indicate which level or category represents the events being modeledand which level or category represents the controlled mediator level. You can use the following med-optionsto specify the attributes of the binary levels:

DESCENDING

DESCreverses the sort order of a binary mediator variable. If both the DESCENDING and ORDER= optionsare specified, PROC CAUSALMED orders the mediator categories according to the ORDER= optionand then reverses that order.

EVENT='level ' | FIRST | LASTspecifies the event category or level for the binary mediator. The same event level is also assumedfor the mediator variable in the outcome model that you specify in the MODEL statement. PROCCAUSALMED models the probability of the event level of the mediator.

The category that is not specified in the EVENT= option is then automatically treated as the referencelevel (see the REF= option). This reference level is the controlled mediator value for computingcontrolled direct effects and reference interactions. You cannot specify both the EVENT= and REF=options for the mediator variable.

You can specify one of the following keywords for the EVENT= option:

'level ' specifies the level in quotation marks to be used as the event. Specify the formatted valueof the variable if a format is assigned.

FIRST designates the first ordered level as the event.

LAST designates the last ordered level as the event.

By default, EVENT=FIRST.

Consider a situation where the mediator variable M takes the values 1 and 0 for event and nonevent,respectively, and T is the treatment variable. To specify the value 1 as the event category of the mediatorvariable, use the following MEDIATOR statement:

mediator M(event='1') = T;

ORDER=DATA | FORMATTED | FREQ | INTERNALspecifies the sort order for the levels of the mediator variable. The following table displays the availableORDER= options.

Page 31: The CAUSALMED Procedure

MEDIATOR Statement F 2389

ORDER= Levels Sorted By

DATA Order of appearance in the input data set.FORMATTED External formatted value, except for numeric

variables that have no explicit format, which aresorted by their unformatted (internal) value. Thesort order is machine-dependent.

FREQ Descending frequency count. Levels that have themost observations come first in the order.

INTERNAL Unformatted value. The sort order ismachine-dependent.

By default, ORDER=FORMATTED.

For more information about sort order, see the chapter on the SORT procedure in the Base SASProcedures Guide and the discussion of BY-group processing in SAS Language Reference: Concepts.

REFERENCE='level ' | FIRST | LAST

REF='level ' | FIRST | LASTspecifies the reference level for the binary mediator variable. This reference level is also the controlledmediator value for computing controlled direct effects. The same reference level is also assumed forthe mediator variable in the outcome model that you specify in the MODEL statement.

The category that is not specified in the REF= option is then automatically treated as the event level(see the EVENT= option). You cannot specify both the EVENT= and REF= options for the mediatorvariable.

You can specify one of the following keywords for the REFERENCE= option:

'level ' specifies the level in quotation marks to be used as the reference level. Specify theformatted value of the variable if a format is assigned.

FIRST designates the first ordered level as the reference level.

LAST designates the last ordered level as the reference level.

By default, REF=LAST.

For binary treatment variables, it is important to indicate which level or category represents the treatment orcontrol level. You can use the following treat-options to specify the attributes of the binary treatment levels:

CONTROL='level ' | FIRST | LAST

REF='level ' | FIRST | LASTspecifies the control level for the binary treatment variable. The same control level is also assumed forthe treatment variable in the outcome model that you specify in the MODEL statement.

The category that is not specified in the CONTROL= option is then automatically treated as thetreatment level of the treatment variable (see the TREAT= option). You cannot specify both theCONTROL= and TREAT= options.

You can specify one of the following keywords for the CONTROL= option:

Page 32: The CAUSALMED Procedure

2390 F Chapter 38: The CAUSALMED Procedure

'level ' specifies the level in quotation marks to be used as the control level. Specify the formattedvalue of the variable if a format is assigned.

FIRST designates the first ordered level as the control level.

LAST designates the last ordered level as the control level.

By default, CONTROL=LAST.

DESCENDING

DESCreverses the sort order of a binary treatment variable. If both the DESCENDING and ORDER= optionsare specified, PROC CAUSALMED orders the treatment categories according to the ORDER= optionand then reverses that order.

ORDER=DATA | FORMATTED | FREQ | INTERNALspecifies the sort order for the levels of the treatment variable. The following table displays theavailable ORDER= options.

ORDER= Levels Sorted By

DATA Order of appearance in the input data set.FORMATTED External formatted value, except for numeric

variables that have no explicit format, which aresorted by their unformatted (internal) value. Thesort order is machine-dependent.

FREQ Descending frequency count. Levels that have themost observations come first in the order.

INTERNAL Unformatted value. The sort order ismachine-dependent.

By default, ORDER=FORMATTED.

For more information about sort order, see the chapter on the SORT procedure in the Base SASProcedures Guide and the discussion of BY-group processing in SAS Language Reference: Concepts.

TREAT='level ' | FIRST | LASTspecifies the treatment level of the treatment variable. The same treatment level is also assumed for thetreatment variable in the outcome model that you specify in the MODEL statement.

The category that is not specified in the TREAT= option is then automatically treated as the controllevel (see the CONTROL= option). You cannot specify both the CONTROL= and TREAT= optionsfor the treatment variable.

You can specify one of the following keywords for the TREAT= option:

'level ' specifies the level in quotation marks to be used as the treatment level. Specify theformatted value of the variable if a format is assigned.

FIRST designates the first ordered level as the treatment level.

LAST designates the last ordered level as the treatment level.

By default, TREAT=FIRST.

Page 33: The CAUSALMED Procedure

MODEL Statement F 2391

Consider a situation where the treatment variable T takes the values 1 and 0 for treatment and control,respectively, and M is the mediator variable. To specify the value 1 as the treatment level of thetreatment variable, use the following MEDIATOR statement:

mediator M = T(treat='1');

MODEL StatementMODEL outcome < *censor(list) > < (outcome-options) > =effects < / model-options > ;

The MODEL statement is required for specifying the outcome model. You provide the outcome (the nameof the outcome variable) to the left of the equal sign and effects (the treatment and mediator effects) to theright. If your outcome variable is a time-to-event response, you can specify the right-censoring variable incensor . The values in the list for the censoring variable indicate right-censored responses. Optionally, youcan specify outcome attributes in outcome-options and modeling attributes in model-options.

Together, the COVAR, MEDIATOR, and MODEL statements specify the relationships of all variables in themediation analysis. The treatment and mediator variables that you specify in the MODEL statement mustbe consistent with those that are you specify in the MEDIATOR statement. If there are covariates in theanalysis, do not specify them or their effects in the MODEL statement even though the covariate effects onthe outcome variable are being modeled. Instead, use the COVAR statement to specify the covariate effects.

Outcome variables can be binary, continuous, count, or time-to-event (or failure/survival time) variables.PROC CAUSALMED does not support outcome variables that are nominal or ordinal and have more thantwo levels.

Suppose that the outcome variable is Y, the treatment variable is T, and the mediator variable is M. The threepossibilities for the syntax of effects are as follows:

model Y = T M;model Y = T M T*M;model Y = T | M;

The first statement specifies the effects of T and M but no interaction effect between the two. The second andthird statements are equivalent. Both specify the effects of T, M, and their interaction. The order of T and Mis not important.

If outcome variable Y is a count response, you can specify either a Poisson (DIST=POISSON) or negativebinomial (DIST=NB) distribution in the model-options. For example:

model Y = T | M / dist=poisson;

If outcome variable Y is a time-to-event response, you can specify either an accelerated failure time model(Kalbfleisch and Prentice 1980) by using the AFT option or a Cox proportional hazards model (Cox 1972) byusing the COXPH option. For example:

model Y = T | M / AFT;

If outcome variable Y is a time-to-event response and Q is a variable that indicates right-censoring of theresponse by values 1 or 2, you can use the following statement to specify such a right-censored outcomeresponse:

Page 34: The CAUSALMED Procedure

2392 F Chapter 38: The CAUSALMED Procedure

model Y*Q(1 2) = T | M / AFT;

If outcome variable Y is a binary variable, you can list it in the CLASS statement. Alternatively, you canspecify DIST=BIN in model-options. For example, specifying

class Y;model Y = T | M;

is equivalent to specifying

model Y = T | M / dist=bin;

Both specifications model Y as a binary response with a Bernoulli distribution (that is, a binomial distributionwith a single trial).

For binary outcomes, it is important to indicate which level or category represents the events being modeled.You can use the following outcome-options to specify the attributes of the binary levels:

DESCENDING

DESCreverses the sort order of a binary outcome variable. If both the DESCENDING and ORDER= optionsare specified, PROC CAUSALMED orders the outcome categories according to the ORDER= optionand then reverses that order.

EVENT='level ' | FIRST | LASTspecifies the event category or level for the binary outcome. PROC CAUSALMED models theprobability of the event of the outcome. The category that is not specified in the EVENT= option isthen automatically treated as the reference level (see the REF= option). You cannot specify both theEVENT= and REF= options for the outcome variable.

You can specify one of the following keywords for the EVENT= option:

'level ' specifies the level in quotation marks to be used as the event. Specify the formatted valueof the variable if a format is assigned.

FIRST designates the first ordered level as the event.

LAST designates the last ordered level as the event.

By default, EVENT=FIRST.

One of the most common sets of outcome levels is {‘No’,‘Yes’}, where ‘Yes’ represents the eventwhose probability is modeled. To specify this event level for the outcome variable Y, use the followingMODEL statement:

model Y(event='Yes') = T | M;

Page 35: The CAUSALMED Procedure

MODEL Statement F 2393

ORDER=DATA | FORMATTED | FREQ | INTERNALspecifies the sort order for the levels of the outcome variable. The following table displays the availableORDER= options.

ORDER= Levels Sorted By

DATA Order of appearance in the input data set.FORMATTED External formatted value, except for numeric

variables that have no explicit format, which aresorted by their unformatted (internal) value. Thesort order is machine-dependent.

FREQ Descending frequency count. Levels that have themost observations come first in the order.

INTERNAL Unformatted value. The sort order ismachine-dependent.

By default, ORDER=FORMATTED.

For more information about sort order, see the chapter on the SORT procedure in the Base SASProcedures Guide and the discussion of BY-group processing in SAS Language Reference: Concepts.

REFERENCE='level ' | FIRST | LAST

REF='level ' | FIRST | LASTspecifies the reference level for the binary outcome variable.

You can specify one of the following keywords for the REF= option:

'level ' specifies the level in quotation marks to be used as the reference level. Specify theformatted value of the variable if a format is assigned.

FIRST designates the first ordered level as the reference level.

LAST designates the last ordered level as the reference level.

By default, REF=LAST.

PROC CAUSALMED supports two main classes of outcome models: generalized linear models and failuretime (survival) models. You can specify the related modeling attributes by providing the following model-options after the slash (/):

AFTfits an accelerated failure time model to time-to-event outcomes.

COXPHfits a Cox proportional hazards model to time-to-event outcomes.

DIST=keyword

DISTRIBUTION=keywordspecifies the built-in probability distribution to use in the model.

For generalized linear models, the valid keywords for this option are described in Table 38.3. Ifyou specify these distributions and you omit the LINK= option, a default link function is chosen asdisplayed in Table 38.3.

Page 36: The CAUSALMED Procedure

2394 F Chapter 38: The CAUSALMED Procedure

Table 38.3 Distributions and Default Link Functions

DIST= Distribution Default Link Function

BIN | B Binary LogitNEGBIN | NB Negative binomial LogNORMAL | NOR | N Normal IdentityPOISSON | POI | P Poisson Log

If you specify neither the DIST= option nor the LINK= option for a generalized linear model, then theCAUSALMED procedure defaults to the binary distribution with logit link if the outcome variable islisted in the CLASS statement. If the outcome variable is not listed in the CLASS statement, then theCAUSALMED procedure defaults to the normal distribution with the identity link function.

For the Poisson and negative binomial distributions, responses must be nonnegative, but they can takenoninteger values. Observations whose response values are outside of the distribution’s support are notused to estimate the mediation effects.

If you specify an accelerated failure time model by using the AFT option in the model-options, youcan specify the following keywords for the distribution of the time-to-event response:

EXP | EXPONENTIAL specifies an exponential distribution, which is treated as a restricted Weibulldistribution.

GAMMA specifies a generalized gamma distribution (Lawless 2003, p. 240). The standard two-parameter gamma distribution is not available in PROC CAUSALMED.

LOGISTIC specifies a logistic distribution.

NORMAL specifies a normal distribution.

WEIBULL specifies a Weibull distribution. If the NOLOG option is also specified, PROCCAUSALMED fits a type 1 extreme-value distribution to the raw, untransformed data.

By default, DIST=WEIBULL for accelerated failure time models.

LINK=keywordspecifies the link function in the model. You can specify the keywords shown in Table 38.4.

Table 38.4 Built-In Link Functions of the CAUSALMEDProcedure

LinkLINK= Link Function g.�/ D

IDENTITY | ID Identity �

LOG Log log.�/LOGIT Logit log.�=.1 � �//

By default, the link function is chosen as shown in Table 38.3. This option does not apply to acceleratedfailure time and Cox proportional hazards models.

Page 37: The CAUSALMED Procedure

STD Statement F 2395

NOLOGrequests that no log transformation of the time-to-event outcome response be performed to fit theaccelerated failure time model. This option is irrelevant if you do not specify the accelerated failuretime model with the AFT option.

By default, PROC CAUSALMED transforms the time-to-event outcome response with the naturallogarithm before fitting the accelerated failure time model if you specify DIST=EXP, GAMMA, orWEIBULL. The NOLOG option thus suppresses the log transformation for these three distributions.For DIST=NORMAL or LOGISTIC, log transformation is not applied whether you specify the NOLOGoption or not.

If log transformation is applied to an accelerated failure time model, the causal mediation effects areexpressed as ratios of the relevant expected event (failure) times. If log transformation is not applied toan accelerated failure time model, the causal mediation effects are expressed as differences betweenthe relevant expected event (failure) times.

STD StatementSTD variable=value < variable=value . . . > ;

You can use this statement to specify the standard deviations of the treatment variable, mediator variable, andcovariates. The values for standard deviations must be nonnegative.

For example, the following statement specifies the standard deviations of the variables x1 and x2:

std x1=2.3 x2=4.1;

The STD statement is not required. When the standard deviations of variables are used in evaluating specificcausal mediation effects, PROC CAUSALMED can compute the standard deviations from the input rawdata automatically. When you specify the STD statement, it overwrites those computed values of standarddeviations. Respecifying standard deviations of variables can affect the evaluation of causal mediation effectsonly when both of the following conditions are true:

1. The treatment variable, mediator variable, or covariate that you specify in the STD statement is acontinuous variable.

2. The standard deviation of the specified treatment variable, mediator variable, or covariate serves as thescale of the respective variable level that is used to evaluate causal mediation effects.

In other words, specifying the STD statement is effective only when you use the SD keyword to define thelevel of a continuous treatment variable, mediator variable, or covariate for computing specific sets of causalmediation effects that are defined in the EVALUATE statement.

A practical situation in which you might want to use the STD statement is when you input sampling weightsby using the WEIGHT statement. PROC CAUSALMED computes the weighted standard deviation by aformula that is consistent with the formula used in PROC MEANS. However, this formula might not beappropriate in every instance. In such cases, you can compute your own standard deviations by using theappropriate formulas and input them into the procedure by using the STD statement.

For more information about the default weighted standard deviation formula that the CAUSALMED procedureuses, see the WEIGHT statement.

Page 38: The CAUSALMED Procedure

2396 F Chapter 38: The CAUSALMED Procedure

WEIGHT StatementWEIGHT variable ;

If you want to use relative weights for each observation in the input data set, then specify a variable thatcontains weights in a WEIGHT statement. This is often done when the variance that is associated witheach observation is different and the values of the weight variable are proportional to the reciprocals of thevariances.

If an observation has a negative or missing weight, it is excluded from the analysis. Otherwise, observationsthat have nonnegative weights are included in the analysis. The weights affect the computations in two ways.One way is in the computation of means and standard deviations of continuous variables. The other way is inthe fitting of generalized linear models for the mediator and outcome variables.

The computation of weighted means and standard deviations by PROC CAUSALMED is consistent withthat of PROC MEANS when nonpositive weights are excluded (that is, by using the EXCLNPWGT optionin PROC MEANS). For nonnegative weight values wi , the formulas for computing the weighted mean andstandard deviation are

Nxw D

nXiD1

wixi=

nXiD1

wi

O�w D

vuut nXiD1

wi .xi � Nxw/2=d

where xi is a variable value, n is the total number of observations, and d is the variance divisor that is definedby the VARDEF= option. By default, VARDEF=DF, so d is n � 1.

The weights are also used in fitting generalized linear models. For more information about how the weightsare used in model fitting, see the WEIGHT statement in Chapter 51, “The GENMOD Procedure.”

Page 39: The CAUSALMED Procedure

Causal Mediation Effects: Theory, Definitions, and Effect Decompositions F 2397

Details: CAUSALMED Procedure

Causal Mediation Effects: Theory, Definitions, and Effect DecompositionsThis section describes the theoretical foundations of the CAUSALMED procedure. It defines the causal medi-ation and related effects that the procedure estimates, and it describes various types of effect decompositions.The section “Causal Mediation Effects: Assumptions, Identification, and Estimation” on page 2404 continuesthe discussion by laying out the assumptions for identifying and estimating causal mediation effects.

In any causal mediation analysis, there are four main types of variables of interest:

� an outcome variable Y

� a treatment variable T that is hypothesized to have direct and indirect causal effects on the outcomevariable Y (in epidemiology, a treatment variable is also known as an exposure, denoted as A)

� a mediator variable M that is hypothesized to be causally affected by the treatment variable T and thatitself has a direct effect on the outcome variable Y

� a set of pretreatment or background covariates that confound the observed relationships among Y, T,and M

Figure 38.8 represents the first three variables in a causal diagram. A causal diagram depicts the causalrelationships of variables in an intuitive way. For a general theory of causal diagrams, see Pearl (2009). Therole of the background covariates C is discussed after the causal diagram is interpreted.

Figure 38.8 A Causal Mediation Model

Figure 38.8 shows two causal pathways that represent the effect of T on Y:

� A direct pathway: T ! Y

� A mediated or indirect pathway: T ! M! Y

The first causal pathway generates the direct effect of T on Y, and the second pathway generates the indirecteffect of T on Y.

Suppose that Y, T, and M are all continuous variables. If you ignore the causal pathways and regress Y on Tby using a linear model of the form

Y D 0 C 1T C e

Page 40: The CAUSALMED Procedure

2398 F Chapter 38: The CAUSALMED Procedure

where e is an error term that has an expected value of 0 and 0 is an intercept, then 1 is referred to as thetotal effect of T on Y. This total effect is the overall effect of T on Y without referring to a particular pathway.

When you hypothesize a causal diagram such as Figure 38.8, the relationships among Y, T, and M aredescribed by two linear equations,

M D ˇ0 C ˇ1T C �

Y D �0 C �1T C �2M C ı

where � and ı are error terms that have expected values of 0, and the parameters of these two equations are asfollows:

� ˇ0 is the intercept of the equation for predicting M.

� �0 is the intercept of the equation for predicting Y.

� ˇ1 is the effect of the T ! M path.

� �1 is the effect of the T ! Y path.

� �2 is the effect of the M! Y path.

Substituting the equation for predicting M into that for predicting Y, you have

Y D .�0 C �2ˇ0/C .�1 C �2ˇ1/T C .�2� C ı/

Comparing this equation with the regression equation that predicts Y by T ignoring the causal pathways, youhave the equality

1 D �1 C ˇ1�2

where the two terms on the right side of the equation represent additive components of the total effect 1,assuming that the causal diagram and the corresponding linear equations are true.

Because the first component �1 represents the direct effect of the T ! Y path, the second component �2ˇ1thus represents the effect of T on Y that is not direct, or simply the indirect effect of T on Y. You can alsointerpret this indirect effect (ˇ1�2) intuitively—it is the product of the two path effects along the indirectpathway T ! M! Y.

Therefore, conceptually, the total effect decomposition can be written as follows:

total effect D direct effectC indirect effect

The direct and indirect effect components are also well defined by the parameters in linear models forcontinuous Y, T, and M. For an illustration, see Example 38.4.

However, the illustration of the total effect decomposition has been quite ad hoc in nature. It is based oncomparing linear models for continuous variables without prior definitions of direct and indirect effects. Con-sequently, for nonlinear models or linear models that have interaction effects between T and M, the precedingstrategy would not work. One reason is that there could be more than two terms in the decomposition sothat the direct-indirect decomposition is ambiguous. Another reason is that the terms become much morecomplicated in nonlinear models, and how to obtain those direct-indirect components would not be clear.

Page 41: The CAUSALMED Procedure

Causal Mediation Effects: Theory, Definitions, and Effect Decompositions F 2399

In contrast, the counterfactual framework addresses this issue by offering clear definitions of direct andindirect effects that are applicable to linear and nonlinear models with or without interaction effects. Thenext section describes this framework.

Another limitation of the illustration that is based solely on the diagram in Figure 38.8 is that it does not dealadequately with pretreatment characteristics or covariates C in observational studies. Typically, covariates Cfunctions like common causes among Y, T, and M in a causal diagram. In observational studies, the observedassociations or relationships among Y, T, and M are attributed to two parts. One part is the actual causal effectsamong them (that is, the effects that are due to the previously mentioned direct and indirect causal pathways).The other part is their induced associations by C. This part of induced association is often called confoundingassociations or effects. To obtain unbiased estimates of causal mediation and related effects in observationalstudies, statistical methods must be able to “remove” the confounding associations. More specifically, thecovariates C must suffice to control for confounding of the treatment-outcome, mediator-outcome, andtreatment-mediator relationship.

Before a discussion of such statistical methods, a more fundamental issue needs to be addressed: Underwhat conditions can causal mediation effects be identified? Only after the identification conditions aresatisfied can you then attempt to obtain unbiased estimation of causal mediation and related effects. Theidentification issue is addressed in the section “Identification of Causal Mediation Effects” on page 2405 afterthe counterfactual framework is described in the next section. Regression adjustment methods that are basedon the identification conditions are then presented in the section “Regression Methods for Causal MediationAnalysis” on page 2406.

Counterfactual Framework for Defining Causal Mediation Effects

Mediation analysis has a relatively long history in the field of psychology. Almost all recent developmentsin the area of causal mediation analysis trace back to the psychological tradition of mediation analysis, astypified by Baron and Kenny (1986). The preceding section illustrates such a traditional approach.

However, as discussed in the preceding section, a problem of the traditional approach is that it lacks a generalframework that offers clear definitions of causal mediation and related effects. As a result, the traditionalapproach cannot deal with interaction effects effectively and it cannot treat binary outcomes and binarymediators in a unified framework.

The counterfactual framework (Robins and Greenland 1992; Pearl 2001) offers a solution to this problem.Within this framework, direct and indirect effects are well defined in terms of counterfactual outcomes.Using these definitions, VanderWeele and Vansteelandt (2009) and VanderWeele and Vansteelandt (2010)derived analytic results for computing causal mediation effects under a wide class of parametric models forvarious types of treatment and outcome variables. Valeri and VanderWeele (2013) extended these resultsto binary mediators and count outcomes. VanderWeele (2011) and Valeri and VanderWeele (2015) derivedanalytic results for analyzing time-to-event (survival) data. This line of development provides the theoreticalfoundations of the CAUSALMED procedure.

A counterfactual outcome is the outcome that you would observe under a hypothetical intervention thatyou can set the treatment T to particular level t. Counterfactual outcomes, which are also called potentialoutcomes by some researchers, are therefore defined for scenarios that might be contrary to the factualoutcomes. In the counterfactual framework for causal mediation analysis, interventions on the mediator levelare also used in various hypothetical scenarios for defining mediation effects.

The following notation is used for counterfactual outcomes that depend on interventions:

Page 42: The CAUSALMED Procedure

2400 F Chapter 38: The CAUSALMED Procedure

� Yt is the counterfactual outcome of Y for a subject when an intervention sets the treatment level toT = t.

� Mt is the counterfactual outcome of M for a subject when an intervention sets the treatment level toT = t.

� Ytm is the counterfactual outcome of Y for a subject when an intervention sets the treatment level toT = t and M = m.

This notation places no restriction on variable types. The variables Y, T, and M can be continuous or binary.

Suppose for the moment that the treatment is binary so that t is either 0 or 1, denoting the control (notreatment) and treatment conditions, respectively. The total effect (TE) for a subject is defined as thedifference between the counterfactual outcomes at the treatment and control levels:

TE D Y1M1� Y0M0

In this equation, the first subscript in the counterfactual outcomes denotes the intervention of the treatment(either at 1 or 0), and the second subscript denotes the mediator value that would follow from the interventionof the treatment (either M1 or M0).

The controlled direct effect (CDE) for a subject is defined as the difference between the counterfactualoutcomes at the two treatment levels when an intervention sets the mediator to a particular level M = m. Thatis,

CDE.m/ D Y1m � Y0m

The natural direct effect (NDE) for a subject is defined as the difference between the counterfactual outcomesat the two treatment levels when an intervention sets the mediator value to M = M0, which is the natural levelof the mediator when there is no treatment. That is,

NDE D Y1M0� Y0M0

The natural indirect effect (NIE) for a subject is defined as the difference between the counterfactual outcomesat the two mediator levels at M1 and M0 when an intervention sets the treatment to T = 1. That is,

NIE D Y1M1� Y1M0

All the preceding definitions assume that the treatment variable T is binary. If the treatment variable iscontinuous, then the treatment levels must be defined according to the treatment and control levels of interest.

For example, if t1 and t0 are the treatment and control levels on a continuous scale and they represent thelevels of substantive interest, they should replace the 1 and 0 values, respectively, for the treatment andcontrol levels in the definitions. However, this more general notation is not used here because it would makethe presentation unnecessarily complicated.

These definitions have two important properties. First, they lead to the following conventional two-waydecomposition of the total effect (TE):

TE D NDEC NIE

Second, these definitions are independent of the models for the outcome or mediator. Hence, these definitionsand the total effect decomposition are applicable to linear or nonlinear models, with or without an interactioneffect between T and M.

Page 43: The CAUSALMED Procedure

Causal Mediation Effects: Theory, Definitions, and Effect Decompositions F 2401

The percentage of total effect that is mediated (PM) is computed as

NIE=TE � 100%

VanderWeele (2014) took a step further and introduces the following four-way decomposition of the totaleffect:

TE D CDEC IRFC IMDC PIE

The component effects in this equation are called the controlled direct effect, the reference interaction, themediated interaction, and the pure indirect effect, respectively. In VanderWeele (2014), IRF is denotedas INTref and IMD is denoted as INTmed. These four component effects are also defined in terms ofcounterfactual outcomes. For definitions, see VanderWeele (2014).

The significance of these components in causal mediation analysis is that they characterize interaction andmediation effects as follows:

� CDE (controlled direct effect) is the component effect that is not due to interaction or mediation.

� IRF (reference interaction) is the component effect that is due to interaction but not mediation.

� IMD (mediated interaction) is the component effect that is due to both interaction and mediation.

� PIE (pure indirect effect) is the component effect that is due to mediation but not interaction.

Dividing each of these component effects by the total effect yields the corresponding proportion contributionsof these components. However, these contributions are not interpretable when the components effects havemixed signs.

Some important relationships between the two-way decomposition and the four-way decomposition areexpressed by the following equations:

NDE D CDEC IRF

NIE D PIEC IMD

The first equation expresses the natural direct effect (NDE) as the composite component of the controlleddirect effect and reference interaction. The second equation expresses the mediation effect or natural indirecteffect (NIE) as the composite component of the pure indirect effect and mediated interaction.

Another useful composite component of the four-way decomposition is the “portion attributed to interaction,”which is defined as

PAI D IRFC IMD

As its name suggests, this is the portion of the total effect that is due to the interaction between T and M. Thepercentage of total effect that is due to the interaction is therefore computed as

PAI=TE � 100%

VanderWeele (2014) discusses various two-way and three-way decompositions and their relationships with thefour-way decomposition. He also offers interesting interpretations and applications of these decompositions.For any causal mediation analysis, you can use the DECOMP option in the CAUSALMED procedure toobtain several two-way decompositions, several three-way decompositions, and the four-way decomposition.For more information about the decompositions, see the DECOMP option.

Page 44: The CAUSALMED Procedure

2402 F Chapter 38: The CAUSALMED Procedure

Causal Mediation Estimands

The section “Counterfactual Framework for Defining Causal Mediation Effects” on page 2399 defines causalmediation and related effects as differences between various counterfactual outcomes for an individual. Thepresentation is useful for explaining basic concepts. In practice, however, individual causal mediation effectsare seldom the target estimands (or population parameters) of interest. This section provides details about thecausal mediation estimands. The section “Estimands on Difference Scale” on page 2402 describes estimandson difference scales, and the section “Estimands on Ratio Scale” on page 2403 describes estimands on ratioscales.

Estimands on Difference ScaleThis section provides details about causal estimands on difference scales. In general, for the regressionapproach, the total effect estimand can be expressed as the population mean difference between the followingtwo population counterfactual outcomes:

E Œ.Y1M1� Y0M0

/ j C � D E ŒY1M1j C � � E ŒY0M0

j C �

where E Œ�� is an expectation operation and E Œ� j C � denotes an expectation conditional on the values ofcovariates C. Let �c D E ŒC � be the population mean of C. In all default estimation, PROC CAUSALMEDuses �c in place of C to define the causal mediation estimands. That is, the overall total effect estimand onthe difference scale is denoted as

TEpop D E Œ.Y1M1� Y0M0

/ j �c�

It is important to note that this overall total effect is generally not the same as the marginal total effect, whichis defined as

E ŒE Œ.Y1M1� Y0M0

/ j C �� D E ŒY1M1� � E ŒY0M0

However, if the outcome regression model for Y is linear in C, the expectation operator can “pass through”the formula so that the marginal and overall total effects are equivalent.

In summary, for causal mediation effects that are defined on the difference scale, PROC CAUSALMED hasthe following main default causal estimands:

TEpop D E ŒY1M1j �c� � E ŒY0M0

j �c�

CDEpop.m/ D E ŒY1m j �c� � E ŒY0m j �c�NDEpop D E ŒY1M0

j �c� � E ŒY0M0j �c�

NIEpop D E ŒY1M1j �c� � E ŒY1M0

j �c�

The total effect decomposition into direct and indirect effects would still have the same additive form as thatof the individual total effect decomposition (see the section “Counterfactual Framework for Defining CausalMediation Effects” on page 2399). That is,

TEpop D NDEpop C NIEpopPercentage Mediated D NIEpop=TEpop � 100%

Similarly, all formulas for other decompositions that are described in the section “Counterfactual Frameworkfor Defining Causal Mediation Effects” on page 2399 for individual causal mediation effects apply to thecausal estimands that are expressed on the difference scale in this section.

Page 45: The CAUSALMED Procedure

Causal Mediation Effects: Theory, Definitions, and Effect Decompositions F 2403

PROC CAUSALMED estimates mean difference causal mediation effects when Y is a continuous outcomethat is fitted by a linear model, or when Y is a time-to-event outcome that is fitted by an accelerated failuretime model that does not use the log transformation (see the NOLOG option for more information).

In addition to these default mean difference causal mediation estimands, you can estimate similar meandifference effects conditional on particular covariate values for C. For more information about specifyingthese covariate values and evaluating conditional causal mediation effects, see the EVALUATE statement andthe section “Evaluating Causal Mediation Effects” on page 2408.

Estimands on Ratio ScaleFor Y being fitted by nonlinear outcome models, causal mediation estimands are defined on the ratio scale.This section describes a variety of ratio scale estimands.

For binary outcomes that are fitted by the generalized linear model with a logit link, PROC CAUSALMEDhas the following main odds ratio estimands:

TEpop DE ŒY1M1

j �c�=.1 � E ŒY1M1j �c�/

E ŒY0M0j �c�=.1 � E ŒY0M0

j �c�/

CDEpop.m/ DE ŒY1m j �c�=.1 � E ŒY1m j �c�/E ŒY0m j �c�=.1 � E ŒY0m j �c�/

NDEpop DE ŒY1M0

j �c�=.1 � E ŒY1M0j �c�/

E ŒY0M0j �c�=.1 � E ŒY0M0

j �c�/

NIEpop DE ŒY1M1

j �c�=.1 � E ŒY1M1j �c�/

E ŒY1M0j �c�=.1 � E ŒY1M0

j �c�/

where E Œ�� is an expectation operation. With the rare outcome assumption (for example, see Valeri andVanderWeele 2013), these odds ratio effect are approximated by their corresponding risk ratio effects.Although these formulas are different from those for defining mean difference mediation effects (see thesection “Estimands on Difference Scale” on page 2402), both sets of formulas involve the same set ofcomparisons among counterfactual outcomes conditional on the population mean of C.

For binary outcomes that are fitted by the generalized linear model with the log link, count outcomes that arefitted by the generalized linear model with a Poisson or negative binomial distribution, and time-to-eventoutcomes that are fitted by the accelerated failure time models, PROC CAUSALMED has the following mainrisk or mean ratio estimands:

TEpop DE ŒY1M1

j �c�

E ŒY0M0j �c�

CDEpop.m/ DE ŒY1m j �c�E ŒY0m j �c�

NDEpop DE ŒY1M0

j �c�

E ŒY0M0j �c�

NIEpop DE ŒY1M1

j �c�

E ŒY1M0j �c�

Finally, for time-to-event outcomes that are fitted by the Cox proportional hazards model, PROC

Page 46: The CAUSALMED Procedure

2404 F Chapter 38: The CAUSALMED Procedure

CAUSALMED has the following main hazard ratio estimands:

TEpop D�Y1M1

.y j �c/

�Y0M0.y j �c/

CDEpop.m/ D�Y1m

.y j �c/

�Y0m.y j �c/

NDEpop D�Y1M0

.y j �c/

�Y0M0.y j �c/

NIEpop D�Y1M1

.y j �c/

�Y1M0.y j �c/

where �Y .y j C/ denotes the hazard conditional on covariates C at time y.

Again, although mean ratio and hazard ratio effects use different formulas from those for defining meandifference mediation effects (see the section “Estimands on Difference Scale” on page 2402), both sets offormulas involve the same set of comparisons among counterfactual outcomes conditional on the populationmean of C.

Common to all these ratio scale estimands, the total effect decomposition into direct and indirect effects isnot additive, but multiplicative. That is,

TEpop D NDEpop � NIEpop

The formulas for computing the corresponding percentage mediated, percentage due to interaction, andvarious decompositions of mean ratio effects are based on the components of the excess of total effect ratio(that is, TEpop � 1) rather than those of the total effect ratio itself (that is, TEpop). Formulas for differentcases are quite complicated and therefore are not shown here (but see, for example, VanderWeele 2014).

In addition to these default odds/risk/mean ratio causal mediation estimands, you can estimate similarodds/risk/mean ratio effects conditional on particular covariate values for C. For more information aboutspecifying these covariate values and evaluating conditional causal mediation effects, see the EVALUATEstatement and the section “Evaluating Causal Mediation Effects” on page 2408.

Causal Mediation Effects: Assumptions, Identification, and EstimationThis section continues the discussion of the theoretical foundations of the CAUSALMED procedure. Thesection “Causal Mediation Effects: Theory, Definitions, and Effect Decompositions” on page 2397 definesthe causal mediation effects and various total effect decompositions that the procedure estimates. This sectiondescribes the assumptions that underlie the identification and estimation of causal mediation effects. It alsodiscusses the implications of these assumptions for valid applications of the procedure.

Page 47: The CAUSALMED Procedure

Causal Mediation Effects: Assumptions, Identification, and Estimation F 2405

Identification of Causal Mediation Effects

This section lays out the identification conditions of causal mediation effects and their implications forapplying statistical methods that aim to obtain unbiased estimation of the effects.

First, it is useful to distinguish the following three types of confounding covariates:

� C1 represents a generic covariate that confounds the relationship between T and Y. This is a treatment-outcome confounder.

� C2 represents a generic covariate that confounds the relationship between M and Y. This is a mediator-outcome confounder.

� C3 represents a generic covariate that confounds the relationship between T and M. This is a treatment-mediator confounder.

As in preceding sections, let C denote all of the covariates C1, C2, and C3. Thus, controlling for C inregression analysis means that all types of confounding covariates are being controlled for.

According to Valeri and VanderWeele (2013), the following four assumptions are required for the identificationof causal mediation effects:

� no unmeasured treatment-outcome confounders given C

� no unmeasured mediator-outcome confounders given (C, T)

� no unmeasured treatment-mediator confounders given C

� no mediator-outcome confounder is affected by T (directly or indirectly) given C

The identification of the controlled direct effect (CDE) assumes the first two conditions, and the identificationof the natural direct effect (NDE) and the natural indirect effect (NIE) assumes all four conditions. Thesefour assumptions are collectively called the “no unmeasured confounding assumption.” Formal statementsfor these identification conditions can be found in the appendix of Valeri and VanderWeele (2013) andVanderWeele (2015).

Essentially, in order to obtain unbiased estimation of causal mediation and related effects, the regressionadjustment method that is discussed in the next section assumes that the identification conditions are satisfied.

In practice, the implication is that in order to have valid causal interpretations of the mediation effects,you must be able to measure all relevant confounding covariates C and include them in a causal mediationanalysis. For example, the first identification condition states that there are no unmeasured treatment-outcomeconfounders given C. Practically, a simple interpretation of this condition is that if there are treatment-outcomeconfounders C1 in the observational study, your set of C must have measured and included these confoundersin the analysis in order to obtain unbiased estimation of causal effects. Similarly, other identificationconditions require C2 or C3, if present, to be measured and included in the analysis.

Page 48: The CAUSALMED Procedure

2406 F Chapter 38: The CAUSALMED Procedure

Regression Methods for Causal Mediation Analysis

The CAUSALMED procedure implements regression methods for estimating causal mediation effects thatassume the identification conditions of the preceding section along with correct specification of the followingtwo models:

� the outcome model for Y given T, M, and C

� the mediator model for M given T and C

For a class of generalized linear models, VanderWeele and Vansteelandt (2009), VanderWeele and Vanstee-landt (2010), VanderWeele (2011), and Valeri and VanderWeele (2013) derived analytic formulas for comput-ing various causal mediation effects for different variable types, including combinations of the followingcases:

� outcome variable Y, which can be binary, continuous (including time-to-event outcome), or count

� treatment variable T, which can be binary or continuous

� mediator variable M, which can be binary or continuous

� covariates C, which can be categorical or continuous

PROC CAUSALMED implements these analytic formulas.

In addition to the causal effect identification assumptions that are described in the section “Identification ofCausal Mediation Effects” on page 2405, the validity of the formulas assumes that the outcomes are rareevents (VanderWeele 2011, 2014) in the following two cases:

� when the outcome Y is binary

� when the outcome Y is a time-to-event variable and is modeled by the proportional hazards model

For the first case, if Y is not rare, then the formulas are still valid if Y is modeled by using the log link.

Let � represent the vector that collects all parameters in the outcome and mediator models. Under thecorrect specification of regression models and the identification assumptions, the causal effects in a mediationanalysis are functions of � conditional on the covariate values. That is, a causal effect, which is denoted byef, can be expressed as a function of � given C = c,

gef .� j C D c/;

where c represents some fixed values for covariates C. By default, the causal estimands that PROCCAUSALMED targets are of the form gef .� j �c/, where �c is the expected value of C. Therefore,in general gef .� j �c/ is interpreted as a conditional effect or as an “overall” effect, but not as a marginaleffect. It would also be a marginal effect only when gef .� j C/ is linear in C.

The default estimand, gef .� j �c/, is consistent with the treatment of the SAS macros that are implementedby Valeri and VanderWeele (2013) and Valeri and VanderWeele (2015). For more information about thedefinitions of various causal mediation effects, see the sections “Estimands on Difference Scale” on page 2402and “Estimands on Ratio Scale” on page 2403.

Page 49: The CAUSALMED Procedure

Causal Mediation Effects: Assumptions, Identification, and Estimation F 2407

For categorical covariates, �c is defined by the expectations of the dummy-coded 0 or 1 value for categoricallevels. However, this does not mean that PROC CAUSALMED requires you to dummy-code the categoricalcovariates for analysis. The dummy coding is done internally in the procedure.

In addition to gef .� j �c/, PROC CAUSALMED also supports the estimation of gef .� j C D c0/, where c0represents specific fixed covariate levels that you want to use for evaluating the causal mediation effects—forexample, the causal mediation effects for a particular interest group that is defined by some fixed values of c0.For more information about specifying these covariate values and evaluating conditional causal mediationeffects, see the EVALUATE statement and the section “Evaluating Causal Mediation Effects” on page 2408.

Maximum Likelihood Estimation

For random samples, PROC CAUSALMED estimates causal mediation effects by the maximum likelihoodmethod. The maximum likelihood estimate O� of � is first estimated for the outcome and mediator models.Then the maximum likelihood estimates of various causal mediation effects are computed as

gef . O� j C D c0/;

where ef is the index for effects and C = c0 is the average of the covariate values that are computed from thesample. For categorical covariates, this definition of c0 assumes that the levels are dummy-coded as 0 and 1,which is done internally by PROC CAUSALMED. Therefore, gef . O� j C D c0/ estimates gef .� j �c/ in thedefault output of PROC CAUSALMED.

Given the estimated covariance matrix for O� , the delta method is used to estimate the standard errors for thecausal effects gef . O� j C D c0/. In the computation of these estimates, the covariate values c0 are treated asfixed values. For more information about the delta method for computing standard errors in this context, seeVanderWeele and Vansteelandt (2009) or VanderWeele (2015).

Alternatively, you can use bootstrap techniques to compute standard error estimates and confidence intervals.For more information about the bootstrap method, see the BOOTSTRAP statement and the section “BootstrapMethods” on page 2414.

As explained in the preceding sections, the evaluation of causal mediation effects depends on the levelsof covariates. In addition to the overall causal mediation effects that are evaluated at C = c0, you canprovide particular covariate levels, say C = c1, that are particularly meaningful to your research by using theEVALUATE statement. The maximum likelihood estimate is then gef . O� j C D c1/ and the standard error iscomputed similarly by the delta method. For more information about evaluating causal mediation effects, seethe section “Evaluating Causal Mediation Effects” on page 2408. For an illustration, see Example 38.2.

Estimation of Various Total Effect Decompositions

Formulas for estimating the components of the four-way decomposition of the total effect (VanderWeele2014) follow essentially the same logic that is described in the preceding sections.

For time-to-event outcomes, the components of the four-way decomposition are computed on the mean timeratio scale when the outcome is modeled by the accelerated failure time model, and they are computed on thehazard ratio scale when the outcome is modeled by the Cox proportional hazards model.

For other continuous outcomes, the components of the four-way decomposition are computed on the originalscales. For binary outcomes, the components of the four-way decomposition are computed on the odds ratioscale and the excess relative risk scale. These formulas are quite involved and are not presented here. Formore information, see VanderWeele (2014).

Page 50: The CAUSALMED Procedure

2408 F Chapter 38: The CAUSALMED Procedure

In addition to the four-way decomposition, PROC CAUSALMED estimates the component effects of severalother two-way and three-way decompositions by using the same analytic technique as that of the four-waydecomposition. You can use the DECOMP= option in the EVALUATE or PROC CAUSALMED statement torequest these decompositions.

To compute standard error estimates for these component effects and their percentage contribution, PROCCAUSALMED uses the delta method with analytic derivatives. Bootstrap methods are also available forcomputing standard errors and confidence intervals. For more information about bootstrap estimation, see theBOOTSTRAP statement and the section “Bootstrap Methods” on page 2414.

Evaluating Causal Mediation EffectsIn general, the CAUSALMED procedure computes causal mediation effects and decompositions that areconditioned on specific levels of covariates. In addition, some of the causal mediation effects are definedat specific levels (numerical or categorical) of treatment, control, and mediator variables. Therefore, it isimportant to understand how to set these variable levels for evaluating causal mediation effects that meetyour research goals.

This section explains the roles of treatment, control, mediator, and covariate levels in defining and computingcausal mediation effects. It shows how you can use the options in the EVALUATE statement to specify theselevels, and it describes the default levels that the CAUSALMED procedure uses.

Suppose that T represents a treatment variable that has a causal effect on an outcome variable Y. Furthermore,suppose that M represents a mediator variable, which is affected by T and has a causal effect on Y, and that Crepresents a generic covariate that confounds the causal treatment and mediation effects.

The roles of the treatment, control, mediator, and covariate levels in defining causal mediation effects are asfollows:

� The level t1 of the treatment variable T is the level that you designate as the treatment condition forall the effects and decompositions that are computed. For example, if the variable T represents thedosage level of a drug, t1 D 10 mg is the dosage level that defines the treatment condition. For a binarytreatment variable, researchers usually define t1 as 1 to represent the presence of the treatment.

� The level t0 of the treatment variable T is the level that you designate as the reference or controlcondition for all the effects and decompositions that are computed. For example, if the variable Trepresents the dosage level of a drug, t0 D 5 mg is the dosage level that defines the control condition.For a binary treatment variable, researchers usually define t0 as 0 to represent the absence of treatment.

� The levelm� of the mediator variable M is the level that you designate to compute the controlled directeffect. For binary mediator variables, researchers usually define m� as 0 so that they can evaluate thecontrolled direct effect by holding the mediator value at the “absence” level.

� The levels c of the covariates are the conditional covariate values in the formulas for computing causalmediation effects.

In general, specifying covariate levels c, the treatment level t1 (of the treatment variable), or the control levelt0 (of the treatment variable) changes the estimates of all mediation effects and decompositions. Specifyingthe controlled level m� of the mediator variable does not change the estimates of the total effect (TE), the

Page 51: The CAUSALMED Procedure

Evaluating Causal Mediation Effects F 2409

natural direct effect (NDE), or the natural indirect effect (NIE). But it does change the estimates of thecontrolled direct effect (CDE) and the reference interaction (IRF).

Default Settings of Treatment and Control Levels

For binary treatment variables, PROC CAUSALMED uses the first level of the variable as the defaulttreatment level and the second (last) level of the variable as the default control level. In other words, the firstlevel of a binary treatment variable takes the role of t1 and the second level takes the role of t0.

For continuous or ordinal treatment variables, researchers habitually set levels of t1 and t0 in such a waythat their difference is 1. Such a habitual setting serves well for linear models, including linear regressionanalysis and linear structural equation modeling. The associated regression coefficient (or effect) is definedas the change in the outcome Y for a unit change in the predictor T. In linear models, the effect on Y dependsonly on the difference between t1 and t0 but not on the levels of t1 and t0 themselves.

However, with nonlinear models, binary responses, and interaction effects, the computation of causalmediation effects and decompositions does, in general, depend on the levels of t1 and t0. Using differentsets of t1 and t0 (even if their difference remains constant) leads to numerically different estimates of causalmediation effects. By default, PROC CAUSALMED sets the treatment and control levels around the centerof the distribution of the treatment variable. That is,

t1 D Nt C 0:5

t0 D Nt � 0:5

where Nt is the sample mean of the treatment variable. This sample mean value is treated as fixed whencomputing standard errors.

You can define your own treatment and control levels for evaluating causal mediation effects and decomposi-tions. For example, instead of using a single unstandardized unit as the treatment amount, you can use onestandard deviation,

t1 D Nt C 0:5 � st

t0 D Nt � 0:5 � st

where st is the sample standard deviation of the treatment variable. This sample standard deviation is treatedas fixed when computing standard errors.

PROC CAUSALMED enables you to set the treatment and control levels either on an unstandardized scale oron a standardized scale. Table 38.5 presents more options for setting these levels.

Default Settings of the Controlled Mediator Level

For binary mediator variables, PROC CAUSALMED uses the second (last) level of the variable as the defaultcontrolled (baseline) level, m�, of the mediator variable. This is consistent with the way that you specify themediator model in the MEDIATOR statement. That is, by default, the procedure models the probability ofthe event indicated by the first level of the mediator variable.

For continuous or ordinal mediator variables, PROC CAUSALMED uses the sample mean of M as the defaultcontrolled mediator level, m�, when evaluating causal mediation effects. Table 38.5 presents more optionsfor setting this level.

Page 52: The CAUSALMED Procedure

2410 F Chapter 38: The CAUSALMED Procedure

Covariate Levels and Their Default Settings

When you specify the effects of confounder covariates in the COVAR statement, the CAUSALMED procedurecomputes mediation effects conditionally at specific levels of the covariates. You can provide one or moreEVALUATE statements to request that these effects be computed at specified settings that are of interest inyour study. However, whether or not you provide an EVALUATE statement, the CAUSALMED procedureuses the sample means of the covariates to compute “overall” measures of causal mediation effects, whichare displayed in the “Summary of Effects” table. For an illustration, see Example 38.2.

Although the means of ordinal and continuous covariates are well defined, less apparent is how to define themean levels of categorical covariates and any interaction terms that might be included in the model.

To illustrate this, suppose that C1 is a continuous covariate and C2 is a categorical covariate that has threelevels: 1, 2, and 3. Also suppose that there are six observations for C1 and C2:

C1 C21 12 13 24 25 36 3

All other variables are not shown.

The following design matrix for the linear predictor contains one column for C1, three columns for C2, andthree columns for the interaction of the two variables:

C1 C2 C1 x C21 1 0 0 1 0 02 1 0 0 2 0 03 0 1 0 0 3 04 0 1 0 0 4 05 0 0 1 0 0 56 0 0 1 0 0 6

The parameterization shown here for C2 is represented internally in PROC CAUSALMED. You are notrequired to use this coding in the input.

The marginal means of the seven columns are 3.5, 1/3, 1/3, 1/3, 1.5, 3.5, and 5.5, respectively. By default,PROC CAUSALMED substitutes these means for covariate levels in the formulas for computing mediationeffects and decompositions.

Substitution of marginal means makes intuitive sense when the models for Y and M are both linear. Inthis case, the computed causal mediated effects and decompositions can be interpreted as marginal effects.However, causal mediation effects that are computed in this way for nonlinear models (for example, binaryresponses with logit links) cannot be interpreted as marginal effects. Nonetheless, the default provides“overall” causal mediation effect estimates that are not entirely arbitrary. In a sense, the default method forcategorical covariates provides an averaged categorical profile for evaluating causal mediation effects.

The default levels are not the only setting that you can consider. In this example, it would be interesting toconduct three causal mediation analyses, each of which is conditioned on a particular level of C2. You canrequest these analyses by specifying the following EVALUATE statements:

Page 53: The CAUSALMED Procedure

Evaluating Causal Mediation Effects F 2411

evaluate 'Conditional on Level 1 of C2' C1=mean C2='1';evaluate 'Conditional on Level 2 of C2' C1=mean C2='2';evaluate 'Conditional on Level 3 of C2' C1=mean C3='3';

Each EVALUATE statement generates a set of mediation analysis results.

In summary, you can use the EVALUATE statement to examine causal mediation effects that are conditionalon the covariate levels that you specify. The CAUSALMED procedure displays these effects in the outputtogether with overall effects that are conditioned on default settings; For illustrations, see Example 38.2and Example 38.3. The next section describes the options for specifying treatment, control, mediator, andcovariate levels.

Options for Setting Variables Levels

You use the EVALUATE statement to request the computation of causal mediation effects that are conditionalon particular levels of variables. You can set the levels of variables by specifying an assignment of thefollowing form:

var-key=value-key

Table 38.5 summarizes the options for var-key and value-key . The last two columns of Table 38.5 display thedefault value-key .

Table 38.5 EVALUATE Statement Options for SettingVariable Levels

Level var-key value-key Default value-key

ClassVariable

Count orContinuousVariable

ClassVariable

Count orContinuousVariable

Treatment_TREATMENT FIRST MAX FIRST mean + 0.5_A1 LAST MEAN_T1 'level ' MINvname(TREATMENT) value

value(SD)Control

_CONTROL FIRST MAX LAST mean – 0.5_A0 LAST MEAN_T0 'level ' MINvname(CONTROL) value

value(SD)Mediator

_MEDIATOR FIRST MAX LAST mean_MSTAR LAST MEANvname 'level ' MIN

valuevalue(SD)

Page 54: The CAUSALMED Procedure

2412 F Chapter 38: The CAUSALMED Procedure

Table 38.5 continued

Variable var-key value-key Default value-key

ClassVariable

Count orContinuousVariable

ClassVariable

Count orContinuousVariable

Covariatevname FIRST MAX mean mean

LAST MEAN orMODE MIN MODE'level ' value

value(SD)

In this table, vname represents an actual variable name, 'level ' represents an actual level of a classificationvariable, and value represents an actual value of a numeric variable. In the last two columns, mean representsthe sample mean of a continuous variable or the sample mean of a categorical variable (in dummy coding).

To specify an assignment , first look for the correct var-key in the second column. Different var-keys areused for the treatment, control, mediator, and covariate levels. In all cases, you can use the actual variablename of the variable. Next, select one of the value-keys in the third or fourth column to specify the desiredvariable level.

Repeat as many assignments as you need to specify the levels of various variables.

For example, suppose that there is a continuous treatment variable Exposure and a binary mediator variablePerceivedPain in your analysis. You identify the roles of these variables by using the following statements:

proc causalmed;class PerceivedPain;mediator PerceivedPain = Exposure;model outcome = PerceivedPain | Exposure;

To set the treatment level at the maximum sample value, the control level at the mean value, and the mediatorat the level encoded as “none,” you can use any of the following equivalent specifications:

evaluate 'Setting 1' _t1=max _t0=mean _mstar='none';evaluate 'Setting 2' _treatment=max _control=mean _mediator='none';evaluate 'Setting 3' Exposure(treatment)=max Exposure(control)=mean

PerceivedPain='none';

This example shows that you can specify a var-key either directly (by providing an actual variable name) orindirectly (by providing a keyword). Likewise, you can specify an value-key either directly (by providingan actual level) or indirectly (by providing a keyword). For a complete description of these options, see theEVALUATE statement.

Note that the default value-key for categorical covariates can be either the sample means (denoted as mean inthe table) or MODE. If you do not assign any levels for categorical covariates in an EVALUATE statement,PROC CAUSALMED uses the sample means as the default levels for all unassigned categorical covariatesthat are specified in the COVAR statement. For example, the sample means of C1, C2, and C3 are the defaultlevels used in the EVALUATE statement for the following specification:

Page 55: The CAUSALMED Procedure

Evaluating Causal Mediation Effects F 2413

proc causalmed;class C1 C2 C3;mediator M = T;model Y = T | M;covar C1 C2 C3 C4;evaluate 'Conditional on C4=max' C4=max M=mean;

If you assign the level of at least one categorical covariate in an EVALUATE statement, PROC CAUSALMEDuses MODE as the default level for the unassigned categorical covariates that are specified in the COVARstatement. For example, the modal levels of C2 and C3 and the sample mean of C4 are the default levels usedin the EVALUATE statement for the following specification:

proc causalmed;class C1 C2 C3;mediator M = T;model Y = T | M;covar C1 C2 C3 C4;evaluate 'Conditional on C1=1' C1='1' M=mean;

Multimodal Covariates

If you specify MODE as the value-key for a categorical covariate and it has multiple modes, an averagingprocess is used to compute the levels. To illustrate this, suppose that C1 is a continuous covariate and C2 andC3 are binary covariates. Also suppose that there are six observations with the following values for the threecovariates:

C1 C2 C31 1 12 1 13 1 14 1 25 2 26 2 2

The design matrix for the linear predictor contains one column for C1 and two columns for each of C2 andC3:

C1 C2 C31 1 0 1 02 1 0 1 03 1 0 1 04 1 0 0 15 0 1 0 16 0 1 0 1

Suppose you specify the following EVALUATE statement:

Page 56: The CAUSALMED Procedure

2414 F Chapter 38: The CAUSALMED Procedure

evaluate 'Setting A' C1=mean C2=mode C3=mode;

The mean of C1 is 3.5. The modal class of C2 is ‘1’, and hence the coding ‘1 0’ is used as the covariatelevel for C2. However, because C3 has two modal classes,‘1 0’ and ‘0 1’, these two modal class codingsare averaged out with other levels. The final coding vector for the covariate levels is then the average of thefollowing two vectors:

3.5 1 0 1 03.5 1 0 0 1

As a result, the averaged levels 3.5, 1, 0, 0.5, and 0.5 are used in the formulas for evaluating causal mediationeffects and decompositions.

If an interaction between C1 and C3 is also modeled, then the average of the following two vectors is used:

3.5 1 0 1 0 3.5 03.5 1 0 0 1 0 3.5

Here the last two columns represent the interaction terms. As a result, the averaged levels 3.5, 1, 0, 0.5, 0.5,1.75, and 1.75 are used in the formulas for evaluating causal mediation effects and decompositions.

Bootstrap MethodsIf you specify the BOOTSTRAP statement, PROC CAUSALMED uses bootstrap resampling to computestandard errors and confidence intervals for causal mediation effects and decompositions. The proceduresamples as many bootstrap sample data sets (replicates) as you specify in the NBOOT= option and thenestimates the effects and decompositions for each replication.

Bootstrap confidence intervals are computed only for the effects and their corresponding percentages. Theseintervals are not computed for the parameters in the outcome or mediator models. You can specify one or moreof the following types of bootstrap confidence intervals by using the BOOTCI option in the BOOTSTRAPstatement:

� The BOOTCI(NORMAL) option requests bootstrap confidence intervals that are based on the normalapproximation method. The .1 � ˛/100% normal bootstrap confidence interval is given by

O�j ˙ ���j� z.1�˛=2/

where O�j is the estimate of �j from the original sample, ���j

is the standard deviation of the bootstrapparameter estimates, and z.1�˛=2/ is the 100.1 � ˛=2/th percentile of the standard normal distribution.

� The BOOTCI(PERC) option requests bootstrap confidence intervals that are based on the percentilemethod. The confidence limits are the 100.˛=2/th and 100.1 � ˛=2/th percentiles of the bootstrapparameter estimates, which are computed as follows. Let ��j;1; �

�j;2; . . . ; ��j;B represent the ordered

values of the bootstrap estimates for the potential outcome mean �j . Let the kth weighted averagepercentile be q, set p D k

100, and let

np D l C g

Page 57: The CAUSALMED Procedure

ODS Table Names F 2415

where l is the integer part of np and g is the fractional part of np. Then the kth percentile, q, iscomputed as follows, which corresponds to the default percentile definition used by the UNIVARIATEprocedure:

q D

8̂<̂:

12

���j;lC ��

j;lC1

�if g D 0

��j;lC1

if g > 0

� The BOOTCI(BC) option requests bias-corrected bootstrap confidence intervals, which use the cumu-lative distribution function (CDF), G.��/, of the bootstrap parameter estimates to determine the upperand lower endpoints of the confidence interval. The bias-corrected bootstrap confidence interval isgiven by

G�1�ˆ.2z0˙z˛=2/

�where ˆ is the standard normal CDF, z˛=2 D ˆ�1.˛=2/, and z0 is a bias correction,

z0 D ˆ�1

�N���j � O�j

�B

�where O�j is the original sample estimate of �j from the input data set, N.��j � O�j / is the number ofbootstrap estimates (��j ) that are less than or equal to O�j , and B is the number of bootstrap replicatesfor which an estimate for the treatment effect is obtained.

Bias-corrected bootstrap confidence intervals are the default.

PROC CAUSALMED requires at least 50 bootstrap samples for normal bootstrap confidence intervals anddoes not compute them if fewer than 40 of the samples produce usable estimates. The procedure requiresat least 1,000 bootstrap samples for percentile and bias-corrected bootstrap confidence intervals and doesnot compute them if fewer than 900 of the samples produce usable estimates. If the number of samples nspecified in the NBOOT=n option is less than 1,000 and percentile or bias-corrected bootstrap confidenceintervals are requested, the value of n is ignored.

ODS Table NamesPROC CAUSALMED assigns a name to each table it creates. You can use these names to refer to the tablewhen you use the Output Delivery System (ODS) to select tables and create output data sets. These namesare listed in Table 38.6. The options or specifications of the specific statements that produce these outputtables are shown in the last two columns. For more information about ODS, see Chapter 23, “Using theOutput Delivery System.”

Page 58: The CAUSALMED Procedure

2416 F Chapter 38: The CAUSALMED Procedure

Table 38.6 ODS Tables Produced by the CAUSALMEDProcedure

ODS Table Name Description Statement Option orSpecification

BootstrapSamples Information about bootstrap samples BOOTSTRAP DefaultClassLevels Classification variable levels CLASS Classification

variablesEffectDecomp Decompositions of the total effect PROC CAUSALMED DECOMPEffectSummary Summary of the direct and mediated

effectsDefault

MediatorEstimates Parameter estimates for the mediatormodel

PROC CAUSALMED PMEDMOD

MediatorProfile Frequency counts for a binarymediator variable

CLASS Binary mediator

ModelInfo Model information DefaultNObs Number of observations DefaultOutcomeEstimates Parameter estimates for the outcome

modelPROC CAUSALMED POUTCOMEMOD

PercentDecomp Percentage decompositions of the totaleffect

PROC CAUSALMED DECOMP

ResponseProfile Frequency counts for a binaryoutcome variable

MODEL DIST=BIN

TreatmentProfile Frequency counts for a binarytreatment variable

CLASS Binary treatment

To control the display of multiple ODS tables, you can override the “Default” settings in Table 38.6 byspecifying global display options in the PROC CAUSALMED statement. Table 38.7 shows these options.The ODS tables that are displayed by these options are marked by *. Notice that the NOPRINT optionsuppresses all ODS table output.

Table 38.7 Global Display Options of the CAUSALMEDProcedure

Options PALL Default PSHORT PSUMMARY NOPRINT

BootstrapSamples * * * *ClassLevels * *EffectDecomp *EffectSummary * * * *MediatorEstimates *MediatorProfile * *ModelInfo * * *NObs * * *OutcomeEstimates *PercentDecomp *

Page 59: The CAUSALMED Procedure

Example 38.1: Mediation Analysis with Interaction Effects and Four-Way Decomposition F 2417

Options PALL Default PSHORT PSUMMARY NOPRINT

ResponseProfile * *TreatmentProfile *

Examples: CAUSALMED Procedure

Example 38.1: Mediation Analysis with Interaction Effects and Four-WayDecomposition

This example continues the example in the section “Getting Started: CAUSALMED Procedure” on page 2366by including an interaction effect between the treatment and the mediator in the outcome model. It alsoshows how you can obtain a four-way decomposition of the effects.

The goals of the observational study on page 2366 are to determine whether an encouraging environmentprovided by parents (which is represented by the variable Encourage) has an effect on the cognitivedevelopment of children (which is represented by the variable CogPerform) and to estimate the amount of thetotal causal effect that is due to the mediation of learning motivation (which is represented by the variableMotivation).

In the example on page 2366, the following statements are used to request a mediation analysis in which themain effects of Encourage and Motivation are specified in the outcome model:

proc causalmed data=Cognitive;model CogPerform = Encourage Motivation;mediator Motivation = Encourage;covar FamSize SocStatus;

run;

This analysis also specifies confounding covariates, and it produces the summary of effects in Output 38.1.1.

Output 38.1.1 Estimation of Causal Effects Adjusting for Confounding Covariates

Summary of Effects

EstimateStandard

ErrorWald 95%

Confidence Limits Z Pr > |Z|

Total Effect 6.8435 0.1525 6.5446 7.1424 44.88 <.0001

Controlled Direct Effect (CDE) 4.2962 0.1098 4.0811 4.5114 39.14 <.0001

Natural Direct Effect (NDE) 4.2962 0.1098 4.0811 4.5114 39.14 <.0001

Natural Indirect Effect (NIE) 2.5473 0.1563 2.2410 2.8536 16.30 <.0001

Percentage Mediated 37.2219 1.7523 33.7874 40.6564 21.24 <.0001

Percentage Due to Interaction 0 . . . . .

Percentage Eliminated 37.2219 1.7523 33.7874 40.6564 21.24 <.0001

The following statements extend the analysis by including an interaction term between Encourage andMotivation in the outcome model:

Page 60: The CAUSALMED Procedure

2418 F Chapter 38: The CAUSALMED Procedure

proc causalmed data=Cognitive decomp;model CogPerform = Encourage | Motivation;mediator Motivation = Encourage;covar FamSize SocStatus;

run;

The specification Encourage | Motivation includes the main effects of Encourage and Motivation andtheir interaction. Equivalently, you could specify Encourage Motivation Encourage*Motivation,where the third term represents the interaction effect. The results of this analysis are shown in Output 38.1.2.

Output 38.1.2 Summary of Causal Effects with Interaction Effects

Summary of Effects

EstimateStandard

ErrorWald 95%

Confidence Limits Z Pr > |Z|

Total Effect 6.8421 0.1430 6.5618 7.1224 47.84 <.0001

Controlled Direct Effect (CDE) 4.1797 0.04696 4.0876 4.2717 89.00 <.0001

Natural Direct Effect (NDE) 4.1509 0.04706 4.0587 4.2432 88.21 <.0001

Natural Indirect Effect (NIE) 2.6912 0.1453 2.4065 2.9759 18.53 <.0001

Percentage Mediated 39.3325 1.3704 36.6465 42.0184 28.70 <.0001

Percentage Due to Interaction 0.4197 0.02367 0.3733 0.4661 17.73 <.0001

Percentage Eliminated 38.9128 1.3574 36.2524 41.5733 28.67 <.0001

When the interaction term is included, the ‘Percentage Mediated’ changes slightly from 37% (for the modelwithout this term) to 39%. Although the percentage due to interaction that is shown in Output 38.1.2 issignificant, it is less than 1%. Therefore, the interpretation of the results is not drastically different from thoseof the analysis with no interaction.

When you specify the DECOMP option, the CAUSALMED procedure generates a table, shown in Out-put 38.1.3, that displays various decompositions of the total effect: several two-way and three-way decom-positions and a four-way decomposition. For more information about various decompositions and theirinterpretations, see the section “Causal Mediation Effects: Theory, Definitions, and Effect Decompositions”on page 2397.

Page 61: The CAUSALMED Procedure

Example 38.1: Mediation Analysis with Interaction Effects and Four-Way Decomposition F 2419

Output 38.1.3 Decompositions of the Total Effect

Decompositions of Total Effect

Decomposition Effect EstimateStandard

ErrorWald 95%

Confidence Limits Z Pr > |Z|

NDE+NIE Natural Direct 4.1509 0.04706 4.0587 4.2432 88.21 <.0001

Natural Indirect 2.6912 0.1453 2.4065 2.9759 18.53 <.0001

CDE+PE Controlled Direct 4.1797 0.04696 4.0876 4.2717 89.00 <.0001

Portion Eliminated 2.6625 0.1438 2.3807 2.9443 18.52 <.0001

TDE+PIE Total Direct 4.2084 0.04695 4.1163 4.3004 89.63 <.0001

Pure Indirect 2.6338 0.1423 2.3548 2.9127 18.51 <.0001

NDE+PIE+IMD Natural Direct 4.1509 0.04706 4.0587 4.2432 88.21 <.0001

Pure Indirect 2.6338 0.1423 2.3548 2.9127 18.51 <.0001

Mediated Interaction 0.05743 0.003391 0.05078 0.06407 16.93 <.0001

CDE+PIE+PAI Controlled Direct 4.1797 0.04696 4.0876 4.2717 89.00 <.0001

Pure Indirect 2.6338 0.1423 2.3548 2.9127 18.51 <.0001

Portion Due to Interaction 0.02871 0.002009 0.02478 0.03265 14.30 <.0001

Four-Way Controlled Direct 4.1797 0.04696 4.0876 4.2717 89.00 <.0001

Reference Interaction -0.02871 0.002009 -0.03265 -0.02478 -14.30 <.0001

Mediated Interaction 0.05743 0.003391 0.05078 0.06407 16.93 <.0001

Pure Indirect 2.6338 0.1423 2.3548 2.9127 18.51 <.0001

Total Total Effect 6.8421 0.1430 6.5618 7.1224 47.84 <.0001

Note: NDE=CDE+IRF, NIE=PIE+IMD, PAI=IRF+IMD, PE=PAI+PIE, TDE=CDE+PAI.

Important effects such as CDE, NDE, and NIE that contribute to the components of the decompositions areshown in the “Summary of Effects” table in Output 38.1.2.

The primary decomposition in the table in Output 38.1.3 is the four-way decomposition. All other componenteffects can be deduced by summing up particular subsets of the effects in the four-way decomposition. Thenote at the bottom of the table shows how component effects are related.

The DECOMP option also generates a table of percentage decompositions, which is shown in Output 38.1.4.

Page 62: The CAUSALMED Procedure

2420 F Chapter 38: The CAUSALMED Procedure

Output 38.1.4 Percentage Decompositions of the Total Effect

Percentage Decompositions of Total Effect

Decomposition Effect PercentStandard

ErrorWald 95%

Confidence Limits Z Pr > |Z|

NDE+NIE Natural Direct 60.67 1.37 57.98 63.35 44.27 <.0001

Natural Indirect 39.33 1.37 36.65 42.02 28.70 <.0001

CDE+PE Controlled Direct 61.09 1.36 58.43 63.75 45.00 <.0001

Portion Eliminated 38.91 1.36 36.25 41.57 28.67 <.0001

TDE+PIE Total Direct 61.51 1.34 58.87 64.14 45.75 <.0001

Pure Indirect 38.49 1.34 35.86 41.13 28.63 <.0001

NDE+PIE+IMD Natural Direct 60.67 1.37 57.98 63.35 44.27 <.0001

Pure Indirect 38.49 1.34 35.86 41.13 28.63 <.0001

Mediated Interaction 0.84 0.04 0.77 0.91 23.65 <.0001

CDE+PIE+PAI Controlled Direct 61.09 1.36 58.43 63.75 45.00 <.0001

Pure Indirect 38.49 1.34 35.86 41.13 28.63 <.0001

Portion Due to Interaction 0.42 0.02 0.37 0.47 17.73 <.0001

Four-Way Controlled Direct 61.09 1.36 58.43 63.75 45.00 <.0001

Reference Interaction -0.42 0.02 -0.47 -0.37 -17.66 <.0001

Mediated Interaction 0.84 0.04 0.77 0.91 23.65 <.0001

Pure Indirect 38.49 1.34 35.86 41.13 28.63 <.0001

Note: NDE=CDE+IRF, NIE=PIE+IMD, PAI=IRF+IMD, PE=PAI+PIE, TDE=CDE+PAI.

This table shows that the two components that involve the interaction make up a very small percentage of thetotal effect. The mediated interaction effect represents less than 1%, and the reference interaction is verysmall and negative.

Example 38.2: Evaluating Controlled Direct Effects and ConditionalMediation Effects

This example continues the analysis of Example 38.1; it illustrates the use of the EVALUATE statement forcomputing controlled direct effects and mediation effects conditional on covariate values.

The following code includes three EVALUATE statements that assign different values for the mediatorMotivation:

proc causalmed data=Cognitive;model CogPerform = Encourage | Motivation;mediator Motivation = Encourage;covar FamSize SocStatus;evaluate 'Default Mean Value of Mediator' Motivation=mean;evaluate 'High-Motivation Group' Motivation = 1(SD);evaluate 'Low-Motivation Group' Motivation = -1(SD);

run;

The labels, which are enclosed in quotation marks, distinguish the three EVALUATE statements and theoutput that they produce. The first EVALUATE statement specifies the level of the mediator Motivation asits mean. This happens to be the default level, so you should expect this statement to produce the sameevaluation of causal effects that PROC CAUSALMED produces by default. Output 38.2.1 displays the causal

Page 63: The CAUSALMED Procedure

Example 38.2: Evaluating Controlled Direct Effects and Conditional Mediation Effects F 2421

mediation effects that are evaluated by default, and Output 38.2.2 displays the causal mediation effects thatare evaluated for the mediator level in the first EVALUATE statement. Clearly, these two tables are identical.

Output 38.2.1 Summary of Effects (Default)

Summary of Effects

EstimateStandard

ErrorWald 95%

Confidence Limits Z Pr > |Z|

Total Effect 6.8421 0.1430 6.5618 7.1224 47.84 <.0001

Controlled Direct Effect (CDE) 4.1797 0.04696 4.0876 4.2717 89.00 <.0001

Natural Direct Effect (NDE) 4.1509 0.04706 4.0587 4.2432 88.21 <.0001

Natural Indirect Effect (NIE) 2.6912 0.1453 2.4065 2.9759 18.53 <.0001

Percentage Mediated 39.3325 1.3704 36.6465 42.0184 28.70 <.0001

Percentage Due to Interaction 0.4197 0.02367 0.3733 0.4661 17.73 <.0001

Percentage Eliminated 38.9128 1.3574 36.2524 41.5733 28.67 <.0001

Output 38.2.2 Replicating the Default Summary of Effects

Summary of Effects: Default Mean Value of Mediator

EstimateStandard

ErrorWald 95%

Confidence Limits Z Pr > |Z|

Total Effect 6.8421 0.1430 6.5618 7.1224 47.84 <.0001

Controlled Direct Effect (CDE) 4.1797 0.04696 4.0876 4.2717 89.00 <.0001

Natural Direct Effect (NDE) 4.1509 0.04706 4.0587 4.2432 88.21 <.0001

Natural Indirect Effect (NIE) 2.6912 0.1453 2.4065 2.9759 18.53 <.0001

Percentage Mediated 39.3325 1.3704 36.6465 42.0184 28.70 <.0001

Percentage Due to Interaction 0.4197 0.02367 0.3733 0.4661 17.73 <.0001

Percentage Eliminated 38.9128 1.3574 36.2524 41.5733 28.67 <.0001

There might be situations in which you want to evaluate the causal effects at other mediator levels. Thesecond and third EVALUATE statements set the mediator level at one standard deviation above and belowthe mean, respectively. PROC CAUSALMED computes the sample mean and standard deviation (SD) forMotivation and then computes the levels of motivation as

m� D meanC SD

m� D mean � SD

These values of m� are then used to evaluate the various causal mediation effects, which are displayed inOutput 38.2.3 and Output 38.2.4.

Page 64: The CAUSALMED Procedure

2422 F Chapter 38: The CAUSALMED Procedure

Output 38.2.3 Evaluation of Effects for the High-Motivation Group

Summary of Effects: High-Motivation Group

EstimateStandard

ErrorWald 95%

Confidence Limits Z Pr > |Z|

Total Effect 6.8421 0.1430 6.5618 7.1224 47.84 <.0001

Controlled Direct Effect (CDE) 4.3403 0.04687 4.2484 4.4321 92.60 <.0001

Natural Direct Effect (NDE) 4.1509 0.04706 4.0587 4.2432 88.21 <.0001

Natural Indirect Effect (NIE) 2.6912 0.1453 2.4065 2.9759 18.53 <.0001

Percentage Mediated 39.3325 1.3704 36.6465 42.0184 28.70 <.0001

Percentage Due to Interaction -1.9278 0.08279 -2.0901 -1.7656 -23.29 <.0001

Percentage Eliminated 36.5653 1.3995 33.8224 39.3082 26.13 <.0001

Output 38.2.4 Evaluation of Effects for the Low-Motivation Group

Summary of Effects: Low-Motivation Group

EstimateStandard

ErrorWald 95%

Confidence Limits Z Pr > |Z|

Total Effect 6.8421 0.1430 6.5618 7.1224 47.84 <.0001

Controlled Direct Effect (CDE) 4.0190 0.04746 3.9260 4.1121 84.68 <.0001

Natural Direct Effect (NDE) 4.1509 0.04706 4.0587 4.2432 88.21 <.0001

Natural Indirect Effect (NIE) 2.6912 0.1453 2.4065 2.9759 18.53 <.0001

Percentage Mediated 39.3325 1.3704 36.6465 42.0184 28.70 <.0001

Percentage Due to Interaction 2.7671 0.08527 2.6000 2.9343 32.45 <.0001

Percentage Eliminated 41.2603 1.3189 38.6753 43.8454 31.28 <.0001

Output 38.2.3 and Output 38.2.4 show that the total effect remains the same in the two evaluations, asexpected. Because the controlled direct effect is defined at a particular level of the mediator level (m�), it isnot surprising that the two evaluations lead to different estimates of the controlled direct effect.

At one standard deviation above the mean of Motivation, the controlled direct effect is 4.34. This is higherthan the controlled direct effect at one standard deviation below the mean, which is 4.02. The percentages ofthe total effect that are due to interaction also differ for the two levels of Motivation. One percentage is –2%and the other is 3%, although both are small and negligible.

You can also use the EVALUATE statement to evaluate causal mediation effects for particular target groups.The following EVALUATE statements estimate causal mediation effects for small families (FamSize=3) andlarge families (FamSize=7):

proc causalmed data=Cognitive;model CogPerform = Encourage | Motivation;mediator Motivation = Encourage;covar FamSize SocStatus;evaluate 'Small Families' FamSize=3;evaluate 'Large Families' FamSize=7;

run;

Output 38.2.5 and Output 38.2.6 display the corresponding effect summaries.

Page 65: The CAUSALMED Procedure

Example 38.2: Evaluating Controlled Direct Effects and Conditional Mediation Effects F 2423

Output 38.2.5 Mediation Effects Conditional on Small Families

Summary of Effects: Small Families

EstimateStandard

ErrorWald 95%

Confidence Limits Z Pr > |Z|

Total Effect 6.8495 0.1423 6.5705 7.1285 48.12 <.0001

Controlled Direct Effect (CDE) 4.1797 0.04696 4.0876 4.2717 89.00 <.0001

Natural Direct Effect (NDE) 4.1584 0.04707 4.0661 4.2506 88.34 <.0001

Natural Indirect Effect (NIE) 2.6912 0.1453 2.4065 2.9759 18.53 <.0001

Percentage Mediated 39.2900 1.3732 36.5985 41.9815 28.61 <.0001

Percentage Due to Interaction 0.5273 0.02278 0.4826 0.5719 23.15 <.0001

Percentage Eliminated 38.9788 1.3492 36.3344 41.6233 28.89 <.0001

Output 38.2.6 Mediation Effects Conditional on Large Families

Summary of Effects: Large Families

EstimateStandard

ErrorWald 95%

Confidence Limits Z Pr > |Z|

Total Effect 6.8127 0.1457 6.5271 7.0982 46.77 <.0001

Controlled Direct Effect (CDE) 4.1797 0.04696 4.0876 4.2717 89.00 <.0001

Natural Direct Effect (NDE) 4.1215 0.04717 4.0290 4.2140 87.37 <.0001

Natural Indirect Effect (NIE) 2.6912 0.1453 2.4065 2.9759 18.53 <.0001

Percentage Mediated 39.5025 1.3590 36.8389 42.1662 29.07 <.0001

Percentage Due to Interaction -0.01090 0.07140 -0.1508 0.1290 -0.15 0.8787

Percentage Eliminated 38.6487 1.3905 35.9234 41.3740 27.80 <.0001

The patterns of all causal effects are similar for small families and large families. Small families appearto have a slightly higher total effect. For both groups, the percentage of the total effect that is due to theinteraction between Encourage and Motivation is very small. For both groups, about 40% of the total effect isdue to the mediation of Motivation.

The next set of EVALUATE statements estimate causal mediation effects for subjects whose social status(SocStatus) is high or low.

proc causalmed data=Cognitive;model CogPerform = Encourage | Motivation;mediator Motivation = Encourage;covar FamSize SocStatus;evaluate 'High Social Status' SocStatus=1(SD);evaluate 'Low Social Status' SocStatus=-1(SD);

run;

Output 38.2.7 and Output 38.2.8 display the corresponding effect summaries.

Page 66: The CAUSALMED Procedure

2424 F Chapter 38: The CAUSALMED Procedure

Output 38.2.7 Mediation Effects Conditional on High Social Status

Summary of Effects: High Social Status

EstimateStandard

ErrorWald 95%

Confidence Limits Z Pr > |Z|

Total Effect 6.8894 0.1378 6.6193 7.1595 50.00 <.0001

Controlled Direct Effect (CDE) 4.1797 0.04696 4.0876 4.2717 89.00 <.0001

Natural Direct Effect (NDE) 4.1982 0.04746 4.1052 4.2912 88.47 <.0001

Natural Indirect Effect (NIE) 2.6912 0.1453 2.4065 2.9759 18.53 <.0001

Percentage Mediated 39.0625 1.3935 36.3312 41.7938 28.03 <.0001

Percentage Due to Interaction 1.1031 0.08592 0.9347 1.2715 12.84 <.0001

Percentage Eliminated 39.3321 1.2980 36.7881 41.8760 30.30 <.0001

Output 38.2.8 Mediation Effects Conditional on Low Social Status

Summary of Effects: Low Social Status

EstimateStandard

ErrorWald 95%

Confidence Limits Z Pr > |Z|

Total Effect 6.7948 0.1482 6.5043 7.0854 45.84 <.0001

Controlled Direct Effect (CDE) 4.1797 0.04696 4.0876 4.2717 89.00 <.0001

Natural Direct Effect (NDE) 4.1037 0.04733 4.0109 4.1964 86.70 <.0001

Natural Indirect Effect (NIE) 2.6912 0.1453 2.4065 2.9759 18.53 <.0001

Percentage Mediated 39.6062 1.3467 36.9667 42.2457 29.41 <.0001

Percentage Due to Interaction -0.2733 0.1094 -0.4877 -0.05890 -2.50 0.0125

Percentage Eliminated 38.4877 1.4190 35.7066 41.2688 27.12 <.0001

Again, the patterns of all causal effects are similar for both groups. The high social status group appears tohave a slightly higher total effect.

You can also combine the specifications of covariates to evaluate specific causal mediation effects. In thefollowing EVALUATE statements, subjects are defined by a combination of levels of FamSize and SocStatus:

proc causalmed data=Cognitive;model CogPerform = Encourage | Motivation;mediator Motivation = Encourage;covar FamSize SocStatus;evaluate 'Most Favorable Environment' FamSize=-.5(SD) SocStatus=1(SD);evaluate 'Least Favorable Environment' FamSize=.5(SD) SocStatus=-1(SD);

run;

The effects labeled ‘Most Favorable Environment’ are defined by FamSize at 0.5 standard deviation belowthe mean family size and SocStatus at 1 standard deviation above the mean social status rating. The effectslabeled ‘Least Favorable Environment’ are defined by FamSize at 0.5 standard deviation above the meanfamily size and SocStatus at 1 standard deviation below the mean social status rating.

Output 38.2.9 and Output 38.2.10 display the corresponding effect summaries.

Page 67: The CAUSALMED Procedure

Example 38.3: Smoking Effect on Infant Mortality F 2425

Output 38.2.9 Mediation Effects Conditional on Most Favorable Environment

Summary of Effects: Most Favorable Environment

EstimateStandard

ErrorWald 95%

Confidence Limits Z Pr > |Z|

Total Effect 6.8969 0.1371 6.6281 7.1656 50.29 <.0001

Controlled Direct Effect (CDE) 4.1797 0.04696 4.0876 4.2717 89.00 <.0001

Natural Direct Effect (NDE) 4.2057 0.04755 4.1125 4.2989 88.45 <.0001

Natural Indirect Effect (NIE) 2.6912 0.1453 2.4065 2.9759 18.53 <.0001

Percentage Mediated 39.0202 1.3963 36.2835 41.7570 27.94 <.0001

Percentage Due to Interaction 1.2102 0.09789 1.0183 1.4020 12.36 <.0001

Percentage Eliminated 39.3978 1.2900 36.8694 41.9261 30.54 <.0001

Output 38.2.10 Mediation Effects Conditional on Least Favorable Environment

Summary of Effects: Least Favorable Environment

EstimateStandard

ErrorWald 95%

Confidence Limits Z Pr > |Z|

Total Effect 6.7874 0.1489 6.4955 7.0793 45.58 <.0001

Controlled Direct Effect (CDE) 4.1797 0.04696 4.0876 4.2717 89.00 <.0001

Natural Direct Effect (NDE) 4.0962 0.04742 4.0033 4.1891 86.39 <.0001

Natural Indirect Effect (NIE) 2.6912 0.1453 2.4065 2.9759 18.53 <.0001

Percentage Mediated 39.6497 1.3438 37.0160 42.2835 29.51 <.0001

Percentage Due to Interaction -0.3836 0.1222 -0.6231 -0.1441 -3.14 0.0017

Percentage Eliminated 38.4201 1.4276 35.6221 41.2180 26.91 <.0001

The patterns of all causal mediation effects are similar for the two groups. The total effect for ‘Most FavorableEnvironment’ is slightly larger than the total effect for ‘Least Favorable Environment’.

Together, these evaluations show that about 40% of the effect of parental encouragement on cognitivedevelopment is mediated by children’s learning motivation. The interaction effect of parental encouragementand children’s learning motivation is small. And more importantly, these conclusions appear to hold fordifferent family sizes and levels of social status.

For more information about setting the covariate levels, see the EVALUATE statement and the section“Evaluating Causal Mediation Effects” on page 2408.

Example 38.3: Smoking Effect on Infant MortalityThis example demonstrates causal mediation analysis with treatment, outcome, and mediator variables thatare all binary. The data contain information about infant mortality in 2003 and were obtained from the USNational Center for Health Statistics. A random sample of 100,000 observations is used in this example. Theanalysis and its interpretation are purely illustrative; definitive conclusions should not be drawn from thisexample.

The following statements print the first 10 observations of the data set, which are shown in Output 38.3.1:

Page 68: The CAUSALMED Procedure

2426 F Chapter 38: The CAUSALMED Procedure

proc print data=sashelp.birthwgt(obs=10);run;

Output 38.3.1 First 10 Observations of birthwgt Data Set

Obs LowBirthWgt Married AgeGroup Race Drinking Death Smoking SomeCollege

1 No No 3 Asian No No No Yes

2 No No 2 White No No No No

3 Yes Yes 2 Native No Yes No No

4 No No 2 White No No No No

5 No No 2 White No No No Yes

6 No No 2 White No No No

7 No No 2 Asian No No No Yes

8 No No 3 White No No No Yes

9 No Yes 1 Black No No No No

10 No No 2 Native No No No Yes

The main variables in the analysis are as follows:

� The treatment variable is Smoking. It is an indicator of maternal smoking behavior, with values 'Yes'and 'No'.

� The outcome variable is Death. It is an indicator of infant death within one year of birth, with values'Yes' and 'No'.

� The mediator variable is LowBirthWgt. It is an indicator of low birth weight (less than 2,500 grams),with values 'Yes' and 'No'.

The analysis also includes five confounding covariates:

� AgeGroup represents maternal ages of less than 20, between 20 and 35, and greater than 35, withvalues 1, 2, and 3, respectively.

� Drinking is an indicator of maternal drinking during pregnancy, with values 'Yes' and 'No'.

� Married is an indicator of marital status, with values 'Yes' and 'No'.

� Race is an indicator of race, with values 'Asian', 'Black', 'Hispanic', 'Native' (nativeAmerican), and 'White'.

� SomeCollege is an indicator of whether the mother has 12 or more years of education, with values'Yes' and 'No'.

The following statements specify a causal mediation model:

proc causalmed data=sashelp.birthwgt decomp;class LowBirthWgt Smoking Death AgeGroup Married Race

Drinking SomeCollege /descending;mediator LowBirthWgt = Smoking;

Page 69: The CAUSALMED Procedure

Example 38.3: Smoking Effect on Infant Mortality F 2427

model Death = LowBirthWgt | Smoking;covar AgeGroup Married Race Drinking SomeCollege;evaluate 'Low Birth-Weight' LowBirthWgt='Yes' / nodecomp;evaluate 'Normal Birth-Weight' LowBirthWgt='No' / nodecomp;

run;

The DECOMP option requests various total effect decompositions. The MEDIATOR statement specifiesthe mediator model for the response LowBirthWgt. The MODEL statement specifies the outcome model forthe response Death and assumes an interaction between LowBirthWgt and Smoking. The CLASS statementnames the categorical variables in the analysis, and the DESCENDING option models the probability ofthe last level of both responses (Death='Yes' and LowBirthWgt='Yes'). The COVAR statement specifiesthe five covariates. Finally, the two EVALUATE statements specify the mediator levels for comparing theirpatterns of causal mediation effects.

Output 38.3.2 displays the model information, which includes the outcome, treatment, and mediator variables,the distributions, and the link functions of the response variables. Because observations that have missingvalues are not included, only 93,292 observations are used for analysis.

Output 38.3.2 Model Information

Model Information

Data Set SASHELP.BIRTHWGT

Outcome Variable Death

Treatment Variable Smoking

Mediator Variable LowBirthWgt

Outcome Modeling Generalized Linear Model

Outcome Distribution Binomial

Outcome Link Function Logit

Mediator Modeling Generalized Linear Model

Mediator Distribution Binomial

Mediator Link Function Logit

Number of Observations Read 100000

Number of Observations Used 93292

Output 38.3.3 displays the levels of the categorical variables, including binary response variables.

Output 38.3.3 Class Levels

Class Level Information

Class Levels Values

LowBirthWgt 2 Yes No

Smoking 2 Yes No

Death 2 Yes No

AgeGroup 3 3 2 1

Married 2 Yes No

Race 5 White Native Hispanic Black Asian

Drinking 2 Yes No

SomeCollege 2 Yes No

Output 38.3.4 displays frequency counts of the binary outcome, mediator, and treatment variables. It also

Page 70: The CAUSALMED Procedure

2428 F Chapter 38: The CAUSALMED Procedure

shows which levels of the response variables are being modeled.

Output 38.3.4 Profiles of Binary Outcome, Mediator, and Treatment Variables

Response Profile

OrderedValue Death

TotalFrequency

1 Yes 527

2 No 92765

Outcome probability modeled is Death='Yes'.

Mediator Profile

OrderedValue LowBirthWgt

TotalFrequency

1 Yes 7562

2 No 85730

Mediator probability modeled is LowBirthWgt='Yes'.

Treatment Profile

OrderedValue Smoking

TotalFrequency

1 Yes 20984

2 No 72308

Output 38.3.5 displays the major decompositions of effects on infant mortality on both the odds ratio (OR)scale and the excess relative risk scale. Percentages of the total effect are displayed only on the excess relativerisk scale.

Output 38.3.5 Summary of Effects on Infant Mortality

Summary of Effects

Nontransformed Scale Back-Transformed from Log Scale

EstimateStandard

ErrorWald 95%

Confidence Limits Z Pr > |Z| 95% Confidence Limits Z Pr > |Z|

Odds Ratio Total Effect 1.7071 0.2215 1.2729 2.1412 3.19 0.0014 1.3237 2.2014 4.12 <.0001

Odds Ratio ControlledDirect Effect (CDE)

1.8940 0.3540 1.2002 2.5879 2.53 0.0116 1.3131 2.7320 3.42 0.0006

Odds Ratio NaturalDirect Effect (NDE)

1.3626 0.1768 1.0160 1.7092 2.05 0.0403 1.0566 1.7572 2.38 0.0171

Odds Ratio NaturalIndirect Effect (NIE)

1.2528 0.03432 1.1855 1.3201 7.37 <.0001 1.1873 1.3219 8.23 <.0001

Total Excess RelativeRisk

0.7071 0.2215 0.2729 1.1412 3.19 0.0014

Excess Relative RiskDue to CDE

0.3246 0.1207 0.08810 0.5611 2.69 0.0071

Excess Relative RiskDue to NDE

0.3626 0.1768 0.01604 0.7092 2.05 0.0403

Excess Relative RiskDue to NIE

0.3445 0.06119 0.2245 0.4644 5.63 <.0001

Percentage Mediated 48.7165 9.8917 29.3291 68.1040 4.92 <.0001

Percentage Due toInteraction

8.1202 19.8380 -30.7615 47.0020 0.41 0.6823

Percentage Eliminated 54.0930 11.6647 31.2306 76.9554 4.64 <.0001

Page 71: The CAUSALMED Procedure

Example 38.3: Smoking Effect on Infant Mortality F 2429

The first four rows of the table in Output 38.3.5 summarize the effects on the odds ratio scale. The controlleddirect effect (CDE) on this scale is 1.894. This is the CDE when the mediator variable LowBirthWgt iscontrolled at the level 'No'. In other words, this is the CDE odds ratio for the group that has normal birthweights. The natural direct effect (NDE) and natural indirect effect (NIE) on the odds ratio scale are 1.363and 1.253, respectively. Their product, rather than their sum, is the same as the total effect on the odds ratioscale, which is 1.707.

There are two sets of confidence limits, z-values, and p-values for the odds ratio effects in Output 38.3.5. Oneset is based on the normality of the original (nontransformed) scale, and the other is based on the normalityof log scale with back-transformations. The log scale inferences are sometimes preferred because they arerange-respecting. That is, unlike the nontransformed Wald confidence intervals that could include negativevalues for odds ratios, the confidence limits constructed from back-transformation of the log scale are alwaysnonnegative. However, for the current example, the two sets of confidence limits, z-values, and p-valuesresult in very much the same statistical inferences about the four causal mediation effects.

The next seven rows of the table in Output 38.3.5 summarize effects on the excess relative risk (ERR) scale.The natural direct effect (0.363) and natural indirect effect (0.345) have an additive property on this scale;they sum to the total excess relative risk, which is 0.707. Additivity makes it easier to use these values todeduce the ‘Percentage Mediated’, which is 48.72% (= 0.3445/0.7071�100%). Therefore, about 50% of thesmoking effect on infant mortality is mediated through the lowering of babies’ birth weights. However, the95% confidence interval for the ‘Percentage Mediated’ is (29.3%, 68.1%), which is fairly wide. More datawould yield a more precise interval estimate.

The percentage of total effect due to the interaction between smoking and low birth weights is about 8%,which is relatively small. Again, the corresponding 95% confidence interval, (–30.8%, 47.0%), is quite wide.

The DECOMP option requests various total effect decompositions, which are shown in Output 38.3.6.Following VanderWeele (2014), all these decompositions are computed on the excess relative risk scale.

Output 38.3.6 Decompositions of Smoking Effects on Infant Mortality

Decompositions of Total Excess Relative Risk

Decomposition Excess Relative Risk EstimateStandard

ErrorWald 95%

Confidence Limits Z Pr > |Z|

NDE+NIE Natural Direct 0.3626 0.1768 0.01604 0.7092 2.05 0.0403

Natural Indirect 0.3445 0.06119 0.2245 0.4644 5.63 <.0001

CDE+PE Controlled Direct 0.3246 0.1207 0.08810 0.5611 2.69 0.0071

Portion Eliminated 0.3825 0.1556 0.07752 0.6874 2.46 0.0140

TDE+PIE Total Direct 0.3820 0.2188 -0.04688 0.8109 1.75 0.0809

Pure Indirect 0.3251 0.03534 0.2558 0.3943 9.20 <.0001

NDE+PIE+IMD Natural Direct 0.3626 0.1768 0.01604 0.7092 2.05 0.0403

Pure Indirect 0.3251 0.03534 0.2558 0.3943 9.20 <.0001

Mediated Interaction 0.01940 0.05229 -0.08309 0.1219 0.37 0.7106

CDE+PIE+PAI Controlled Direct 0.3246 0.1207 0.08810 0.5611 2.69 0.0071

Pure Indirect 0.3251 0.03534 0.2558 0.3943 9.20 <.0001

Portion Due to Interaction 0.05742 0.1547 -0.2457 0.3606 0.37 0.7105

Four-Way Controlled Direct 0.3246 0.1207 0.08810 0.5611 2.69 0.0071

Reference Interaction 0.03801 0.1024 -0.1627 0.2387 0.37 0.7105

Mediated Interaction 0.01940 0.05229 -0.08309 0.1219 0.37 0.7106

Pure Indirect 0.3251 0.03534 0.2558 0.3943 9.20 <.0001

Total Excess Relative Risk 0.7071 0.2215 0.2729 1.1412 3.19 0.0014

Note: NDE=CDE+IRF, NIE=PIE+IMD, PAI=IRF+IMD, PE=PAI+PIE, TDE=CDE+PAI.

Page 72: The CAUSALMED Procedure

2430 F Chapter 38: The CAUSALMED Procedure

As shown in Output 38.3.7, PROC CAUSALMED also displays the corresponding decompositions by theirpercentage contribution to the total effect on the excess relative risk scale.

Output 38.3.7 Percentage Decomposition of Smoking Effects on Infant Mortality

Percentage Decompositions of Total Excess Relative Risk

Decomposition Excess Relative Risk PercentStandard

ErrorWald 95%

Confidence Limits Z Pr > |Z|

NDE+NIE Natural Direct 51.28 9.89 31.90 70.67 5.18 <.0001

Natural Indirect 48.72 9.89 29.33 68.10 4.92 <.0001

CDE+PE Controlled Direct 45.91 11.66 23.04 68.77 3.94 <.0001

Portion Eliminated 54.09 11.66 31.23 76.96 4.64 <.0001

TDE+PIE Total Direct 54.03 14.49 25.62 82.43 3.73 0.0002

Pure Indirect 45.97 14.49 17.57 74.38 3.17 0.0015

NDE+PIE+IMD Natural Direct 51.28 9.89 31.90 70.67 5.18 <.0001

Pure Indirect 45.97 14.49 17.57 74.38 3.17 0.0015

Mediated Interaction 2.74 6.70 -10.40 15.88 0.41 0.6823

CDE+PIE+PAI Controlled Direct 45.91 11.66 23.04 68.77 3.94 <.0001

Pure Indirect 45.97 14.49 17.57 74.38 3.17 0.0015

Portion Due to Interaction 8.12 19.84 -30.76 47.00 0.41 0.6823

Four-Way Controlled Direct 45.91 11.66 23.04 68.77 3.94 <.0001

Reference Interaction 5.38 13.14 -20.37 31.13 0.41 0.6824

Mediated Interaction 2.74 6.70 -10.40 15.88 0.41 0.6823

Pure Indirect 45.97 14.49 17.57 74.38 3.17 0.0015

Note: NDE=CDE+IRF, NIE=PIE+IMD, PAI=IRF+IMD, PE=PAI+PIE, TDE=CDE+PAI.

The entries for the four-way decomposition in Output 38.3.7 show that 46% of the total effect is attributedto neither interaction nor mediation (‘Controlled Direct’), 5% is attributed to interaction but not mediation(‘Reference Interaction’), 3% is attributed to both mediation and interaction (‘Mediated Interaction’), and46% is attributed to mediation but not interaction (‘Pure Indirect’).

In the three-way decomposition labeled ‘CDE+PIE+PAI,’ the percentage of total effect that is attributed tothe interaction (PAI or ‘Portion Due to Interaction’ in the table) is about 8%, which is not large but is also notignorable.

Note that some of the confidence intervals in this table span from negative to positive values. This indicatesthat the corresponding point estimates might not be very accurate.

As requested by the first EVALUATE statement, the table in Output 38.3.8 displays the major effects andpercentages when the mediator LowBirthWgt is set at the level 'Yes'.

Page 73: The CAUSALMED Procedure

Example 38.3: Smoking Effect on Infant Mortality F 2431

Output 38.3.8 Summary of Smoking Effects for the Low Birth-Weight Group

Summary of Effects: Low Birth-Weight

Nontransformed Scale Back-Transformed from Log Scale

EstimateStandard

ErrorWald 95%

Confidence Limits Z Pr > |Z| 95% Confidence Limits Z Pr > |Z|

Odds Ratio Total Effect 1.7071 0.2215 1.2729 2.1412 3.19 0.0014 1.3237 2.2014 4.12 <.0001

Odds Ratio ControlledDirect Effect (CDE)

1.0917 0.1591 0.7799 1.4036 0.58 0.5643 0.8205 1.4527 0.60 0.5470

Odds Ratio NaturalDirect Effect (NDE)

1.3626 0.1768 1.0160 1.7092 2.05 0.0403 1.0566 1.7572 2.38 0.0171

Odds Ratio NaturalIndirect Effect (NIE)

1.2528 0.03432 1.1855 1.3201 7.37 <.0001 1.1873 1.3219 8.23 <.0001

Total Excess RelativeRisk

0.7071 0.2215 0.2729 1.1412 3.19 0.0014

Excess Relative RiskDue to CDE

0.8669 1.4959 -2.0649 3.7988 0.58 0.5622

Excess Relative RiskDue to NDE

0.3626 0.1768 0.01604 0.7092 2.05 0.0403

Excess Relative RiskDue to NIE

0.3445 0.06119 0.2245 0.4644 5.63 <.0001

Percentage Mediated 48.7165 9.8917 29.3291 68.1040 4.92 <.0001

Percentage Due toInteraction

-68.5853 167.58 -397.04 259.87 -0.41 0.6823

Percentage Eliminated -22.6126 179.59 -374.60 329.38 -0.13 0.8998

The odds ratio CDE (which is evaluated for the low birth-weight group) is 1.09, with a corresponding 95%confidence interval of (0.82, 1.45) when the log scale is used for inferences.

As requested by the second EVALUATE statement, the table in Output 38.3.9 displays the major effects andpercentages when the mediator LowBirthWgt is set at the level 'No'.

Page 74: The CAUSALMED Procedure

2432 F Chapter 38: The CAUSALMED Procedure

Output 38.3.9 Summary of Smoking Effects for the Normal Birth-Weight Group

Summary of Effects: Normal Birth-Weight

Nontransformed Scale Back-Transformed from Log Scale

EstimateStandard

ErrorWald 95%

Confidence Limits Z Pr > |Z| 95% Confidence Limits Z Pr > |Z|

Odds Ratio Total Effect 1.7071 0.2215 1.2729 2.1412 3.19 0.0014 1.3237 2.2014 4.12 <.0001

Odds Ratio ControlledDirect Effect (CDE)

1.8940 0.3540 1.2002 2.5879 2.53 0.0116 1.3131 2.7320 3.42 0.0006

Odds Ratio NaturalDirect Effect (NDE)

1.3626 0.1768 1.0160 1.7092 2.05 0.0403 1.0566 1.7572 2.38 0.0171

Odds Ratio NaturalIndirect Effect (NIE)

1.2528 0.03432 1.1855 1.3201 7.37 <.0001 1.1873 1.3219 8.23 <.0001

Total Excess RelativeRisk

0.7071 0.2215 0.2729 1.1412 3.19 0.0014

Excess Relative RiskDue to CDE

0.3246 0.1207 0.08810 0.5611 2.69 0.0071

Excess Relative RiskDue to NDE

0.3626 0.1768 0.01604 0.7092 2.05 0.0403

Excess Relative RiskDue to NIE

0.3445 0.06119 0.2245 0.4644 5.63 <.0001

Percentage Mediated 48.7165 9.8917 29.3291 68.1040 4.92 <.0001

Percentage Due toInteraction

8.1202 19.8380 -30.7615 47.0020 0.41 0.6823

Percentage Eliminated 54.0930 11.6647 31.2306 76.9554 4.64 <.0001

The odds ratio CDE (which is evaluated for the normal birth-weight group) is now 1.89, with a corresponding95% confidence interval of (1.31, 2.73) when the log scale is used for inferences.

Note that the controlled level of the mediator requested by the second EVALUATE statement coincides thedefault setting that uses the last level of mediator as the controlled level. Hence, the results in Output 38.3.9and Output 38.3.5 are identical.

Example 38.4: Mediation Analysis by Linear Structural Equation ModelingThis example illustrates the use of linear structural equation modeling and the CALIS procedure for doing alimited form of mediation analysis. For this analysis, the CALIS procedure and the CAUSALMED procedureproduce results that are very similar. However, the more general approach implemented in the CAUSALMEDprocedure is needed to define and compute the mediation effects in a broader context. Within this context,Example 38.1 illustrates how the general approach deals with interaction effects, and Example 38.3 illustrateshow it treats binary outcomes and binary mediators in a unified fashion.

The scenario in this example is the observational study that is presented in the section “Getting Started:CAUSALMED Procedure” on page 2366. The goals of the study are to determine whether an encouragingenvironment provided by parents (which is represented by the variable Encourage) has an effect on thecognitive development of children (which is represented by the variable CogPerform) and to estimate theamount of the total causal effect that is due to the mediation of learning motivation (which is represented bythe variable Motivation).

In the example in the section “Getting Started: CAUSALMED Procedure” on page 2366, PROCCAUSALMED is used to carry out two mediation analyses:

Page 75: The CAUSALMED Procedure

Example 38.4: Mediation Analysis by Linear Structural Equation Modeling F 2433

proc causalmed data=Cognitive;model CogPerform = Encourage Motivation;mediator Motivation = Encourage;

run;

proc causalmed data=Cognitive;model CogPerform = Encourage Motivation;mediator Motivation = Encourage;covar FamSize SocStatus;

run;

The first analysis does not specify any confounding covariates. It produces the summary of effects inOutput 38.4.1, which shows that the ‘Percentage Mediated’ is about 47%.

Output 38.4.1 Estimation of Causal Effects without Adjusting for Confounding Covariates

Summary of Effects

EstimateStandard

ErrorWald 95%

Confidence Limits Z Pr > |Z|

Total Effect 8.0423 0.03200 7.9796 8.1050 251.30 <.0001

Controlled Direct Effect (CDE) 4.2835 0.1062 4.0754 4.4917 40.33 <.0001

Natural Direct Effect (NDE) 4.2835 0.1062 4.0754 4.4917 40.33 <.0001

Natural Indirect Effect (NIE) 3.7588 0.1091 3.5449 3.9727 34.44 <.0001

Percentage Mediated 46.7377 1.3254 44.1400 49.3353 35.26 <.0001

Percentage Due to Interaction 0 . . . . .

Percentage Eliminated 46.7377 1.3254 44.1400 49.3353 35.26 <.0001

The second analysis specifies confounding covariates. It produces the summary of effects in Output 38.4.2.These effects have more appropriate causal interpretations if FamSize and SocStatus are the only importantconfounding variables that must be controlled for. Controlling for covariates, Output 38.4.2 shows a moreconservative ‘Percentage Mediated’ of 37%.

Output 38.4.2 Estimation of Causal Effects Adjusting for Confounding Covariates

Summary of Effects

EstimateStandard

ErrorWald 95%

Confidence Limits Z Pr > |Z|

Total Effect 6.8435 0.1525 6.5446 7.1424 44.88 <.0001

Controlled Direct Effect (CDE) 4.2962 0.1098 4.0811 4.5114 39.14 <.0001

Natural Direct Effect (NDE) 4.2962 0.1098 4.0811 4.5114 39.14 <.0001

Natural Indirect Effect (NIE) 2.5473 0.1563 2.2410 2.8536 16.30 <.0001

Percentage Mediated 37.2219 1.7523 33.7874 40.6564 21.24 <.0001

Percentage Due to Interaction 0 . . . . .

Percentage Eliminated 37.2219 1.7523 33.7874 40.6564 21.24 <.0001

he second analysis decomposes the total effect of an encouraging environment on cognitive development intotwo percentages:

� 63% of the total effect is through the direct pathway Encourage!CogPerform

� 37% of the total effect is through the mediation pathway Encourage!Motivation!CogPerform

Page 76: The CAUSALMED Procedure

2434 F Chapter 38: The CAUSALMED Procedure

Statements such as these invite the use of structural equation modeling, which offers the same type oflanguage for describing causal sequences. Indeed, mediation analysis has a relatively long history in the fieldof psychology, where structural equation modeling is quite popular.

By specifying the relevant causal pathways in structural equation models, you can use the CALIS procedureto obtain essentially the same mediation analyses as those obtained with the CAUSALMED procedure:

proc calis data=cognitive;path

Encourage ===> Motivation,Encourage Motivation ===> CogPerform;

effpart Encourage ===> CogPerform;run;

proc calis data=cognitive;path

Encourage ===> Motivation,Encourage Motivation ===> CogPerform,FamSize ===> Encourage Motivation CogPerform,SocStatus ===> Encourage Motivation CogPerform;

effpart Encourage ===> CogPerform;run;

The EFFPART statements request the total effect decompositions of Encourage on CogPerform in the twoanalyses. Output 38.4.3 shows the total effect decomposition when the covariates are ignored in the linearstructural equation model. The total, direct, and indirect effects and their standard error estimates closelymatch those in Output 38.4.1.

Output 38.4.3 Summary of Causal Effects

Effects of Encourage

Effect / Std Error / t Value / p Value

Total Direct Indirect

CogPerform 8.04230.0321

250.8761<.0001

4.28350.106440.2662<.0001

3.75880.109334.3806<.0001

Output 38.4.4 shows the total effect decomposition when the covariates are incorporated in the linear structuralequation model. Again, the total, direct, and indirect effects and their standard error estimates closely matchthose in Output 38.4.2.

Output 38.4.4 Summary of Causal Effects

Effects of Encourage

Effect / Std Error / t Value / p Value

Total Direct Indirect

CogPerform 6.84350.152744.8044<.0001

4.29620.109939.0749<.0001

2.54730.156516.2739<.0001

However, the similarity of the analyses obtained with the CALIS and CAUSALMED procedures does not

Page 77: The CAUSALMED Procedure

Example 38.5: Causal Mediation Analysis of a Time-to-Event Outcome F 2435

extend to more general situations. The limitations of structural equation modeling include the following:

� It does not have a clear foundation for defining causal mediation effects.

� It does not deal with interaction effects effectively.

� It does not treat binary outcomes and binary mediators in a unified fashion.

The general mediation approach that is implemented in PROC CAUSALMED overcomes these limitationsof traditional linear structural equation modeling. For more information about the theoretical foundation ofthe general mediation approach, see the sections “Causal Mediation Effects: Theory, Definitions, and EffectDecompositions” on page 2397 and “Causal Mediation Effects: Assumptions, Identification, and Estimation”on page 2404.

Example 38.5: Causal Mediation Analysis of a Time-to-Event OutcomeThis example illustrates causal mediation analyses of time-to-event data (in this case, the event is death).Lagakos and Mosteller (1981) presented a case study of the effects of Red 40, a monoazoaryl disodiumdisulfonate dye that is used as a color additive in foods and drugs, on the development of reticuloendothelial(RE) tumors and acceleration of death in mice.

The experiment took place in 1976. Four hundred mice, 200 females and 200 males, were allocated to fourgroups: a control group, and three dose-level groups of Red 40. There were 50 females and 50 males in eachgroup. The original plan was to run the experiment for two years (104 weeks). If a mouse died before theexperiment ended, the presence of RE tumors would be investigated. If a mouse survived to week 104, it waseuthanized to investigate the presence of RE tumors. However, for some reason, 142 mice were unexpectedlyeuthanized at week 42. No RE tumors were found in these mice. Therefore, the time-to-death measure in thedata can be censored at either week 42 or week 104.

Lagakos and Mosteller (1981) noticed that the evaluation of Red 40 effects could have been complicated bycage and litter effects. Unfortunately, these variables were collected in the experiment. Despite that problem,the data are used here to demonstrate some simplified causal mediation analyses for time-to-event data. Inany case, this example is not intended to provide definitive analyses of the data.

For simplicity, only the data for the control and the high-dose-level (treatment) groups are analyzed. Thefollowing DATA step inputs the observations for the control and treatment groups:

data RedDye;input RedDye Weeks Censor Female Tumor Freq;datalines;

0 29 0 0 0 10 30 0 0 0 10 38 0 0 0 10 48 0 0 0 10 53 0 0 0 10 56 0 0 0 10 62 0 0 0 10 70 0 0 0 10 71 0 0 0 10 74 0 0 0 1

Page 78: The CAUSALMED Procedure

2436 F Chapter 38: The CAUSALMED Procedure

0 74 0 0 0 10 76 0 0 0 10 85 0 0 1 10 86 0 0 0 10 86 0 0 0 10 92 0 0 0 10 97 0 0 1 10 99 0 0 1 10 101 0 0 0 10 102 0 0 0 10 103 0 0 0 10 104 1 0 1 00 104 1 0 0 120 42 1 0 0 170 70 0 1 1 10 77 0 1 0 10 83 0 1 1 10 87 0 1 0 10 92 0 1 0 10 92 0 1 0 10 93 0 1 1 10 96 0 1 1 10 100 0 1 1 10 102 0 1 0 10 102 0 1 0 10 103 0 1 1 10 104 1 1 1 20 104 1 1 0 160 42 1 1 0 203 2 0 0 0 13 16 0 0 0 13 23 0 0 0 13 34 0 0 0 13 35 0 0 1 13 35 0 0 1 13 67 0 0 1 13 77 0 0 0 13 77 0 0 0 13 79 0 0 1 13 84 0 0 0 13 89 0 0 0 13 92 0 0 0 13 96 0 0 0 13 97 0 0 0 13 98 0 0 0 13 99 0 0 0 13 104 1 0 1 03 104 1 0 0 193 42 1 0 0 143 34 0 1 1 13 36 0 1 1 13 48 0 1 1 13 48 0 1 0 13 65 0 1 1 1

Page 79: The CAUSALMED Procedure

Example 38.5: Causal Mediation Analysis of a Time-to-Event Outcome F 2437

3 91 0 1 1 13 91 0 1 0 13 98 0 1 0 13 102 0 1 0 13 102 0 1 0 13 103 0 1 1 13 104 1 1 1 33 104 1 1 0 183 42 1 1 0 18;

The six variables in the data set are described as follows:

� RedDye indicates the absence (0, the control level) or high dose level (3, the treatment level) of Red40. This is the treatment variable of interest.

� Weeks measures the time to death in weeks. This is the outcome variable of interest.

� Censor is an indicator of a censored outcome. A value of 1 indicates that Weeks was a censoredmeasure.

� Female indicates the sex of the mice, 0 for male and 1 for female. This variable is a confoundingcovariate in the following causal mediation analyses.

� Tumor indicates the absence (0) or presence (1) of RE tumors. This variable is the mediator variable ofinterest.

� Freq indicates the frequency of an observation. As mentioned, the values of Weeks in some observa-tions were censored at week 42 or week 104. The frequencies of these censored observations could bedifferent from 1. In contrast, all noncensored observations have a frequency value of 1 in the data set.

Before doing a causal mediation analysis, it is useful to compare some simple statistics between the controland treatment groups. The following statements compute the means and other statistics of some variables:

proc means mean stderr min max data=RedDye;var Censor Female Tumor Weeks;class RedDye;freq Freq;

run;

Output 38.5.1 displays the observed means of Censor, Female, Tumor, and Weeks in the control and treatmentgroups. The treatment (high-dose) group has a slightly higher rate of RE tumors and a slightly longer averagelife than the control group. But these observed differences are not greater than their corresponding standarderrors and thus are negligible.

Page 80: The CAUSALMED Procedure

2438 F Chapter 38: The CAUSALMED Procedure

Output 38.5.1 Comparing the Control and High-Dose Groups

RedDye N Obs Variable Mean Std Error Minimum Maximum

0 100 CensorFemaleTumorWeeks

0.67000000.50000000.110000073.0300000

0.04725820.05025190.03144662.8561277

000

29.0000000

1.00000001.00000001.0000000

104.0000000

3 100 CensorFemaleTumorWeeks

0.72000000.50000000.130000074.2200000

0.04512610.05025190.03379983.1066751

000

2.0000000

1.00000001.00000001.0000000

104.0000000

It is important to note that the means of Tumor and Weeks might have been plagued by the censoredobservations. The proportions of censored observations are high—67% and 72%, respectively, for the controland treatment groups. Therefore, the comparisons of these means between groups must be interpreted withcaution.

Fortunately, you can analyze right-censored time-to-event outcomes together with noncensored outcomesin the CAUSALMED procedure. You perform a causal mediation analysis of the data by specifying thefollowing statements:

proc causalmed data=RedDye ciratio=log poutcomemod pmedmod;class RedDye Female Tumor;model Weeks*Censor(1) = RedDye | Tumor / aft;mediator Tumor(event='1') = RedDye(treat='3');covar Female;freq Freq;

run;

In the PROC CAUSALMED statement, you use the CIRATIO=LOG option to base the computationsof confidence intervals, z-values, and p-values of the mean ratio effects on the log scale. You use thePOUTCOMEMOD and PMEDMOD options, respectively, to output the estimates of the outcome andmediator models.

In the CLASS statement, you specify the binary variables RedDye, Female, and Tumor.

In the MODEL statement, you use the AFT option to fit an accelerated failure time model for the outcomevariable Weeks. You include the RedDye effect, the Tumor effect, their interaction effect, and the covariateeffect of Female (which is specified in the COVAR statement) in this outcome model. Observations with acensored outcome are indicated by a value of ‘1’ for the variable Censor.

In the MEDIATOR statement, you model the mediator variable Tumor by using a logistic regression modelthat includes the RedDye treatment effect and the covariate effect of Female, which is specified in the COVARstatement. The EVENT=‘1’ option specifies that a value of ‘1’ for Tumor indicates the presence of a tumor.The TREAT=‘3’ option specifies that a value of ‘3’ for RedDye indicates the treatment condition—that is, ahigh dose of Red 40.

In the FREQ statement, you specify that Freq indicates the frequency of an observation.

Output 38.5.2 displays information about various variables and their modeling and distributional types in theanalysis. You can use this table to check whether your specifications have been set as intended.

Page 81: The CAUSALMED Procedure

Example 38.5: Causal Mediation Analysis of a Time-to-Event Outcome F 2439

Output 38.5.2 Model Information

Model Information

Data Set WORK.REDDYE

Outcome Variable Log(Weeks)

Censoring Variable Censor

Censoring Value(s) 1

Treatment Variable RedDye

Mediator Variable Tumor

Frequency Variable Freq

Outcome Modeling Accelerated Failure Time

Outcome Distribution Weibull

Mediator Modeling Generalized Linear Model

Mediator Distribution Binomial

Mediator Link Function Logit

Output 38.5.3 shows the number of observations and frequencies in different categories. Because thefrequency variable is specified, the total number of mice in the study was 200. Of this total, 139 (69.5%)were right-censored.

Output 38.5.3 Number of Observations

Number of Observations Read 73

Number of Observations Used 71

Right-Censored Observations 10

Noncensored Observations 61

Sum of Frequencies Read 200

Sum of Frequencies Used 200

Right-Censored Frequencies 139

Noncensored Frequencies 61

Percentage Censored 69.5

Output 38.5.4 is useful for checking whether the treatment level and the mediator level for modeling werespecified correctly. The information in these tables confirms the intended specifications.

Output 38.5.4 Class Levels, Mediator Profile, and Treatment Profile

Class LevelInformation

Class Levels Values

RedDye 2 3 0

Female 2 0 1

Tumor 2 1 0

Mediator Profile

OrderedValue Tumor

TotalFrequency

1 1 24

2 0 176

Page 82: The CAUSALMED Procedure

2440 F Chapter 38: The CAUSALMED Procedure

Output 38.5.4 continued

Mediator probability modeled is Tumor='1'.

Treatment Profile

OrderedValue RedDye

TotalFrequency

1 3 100

2 0 100

Output 38.5.5 shows a summary of the causal mediation effects. The causal effects are expressed as meanratios. A ratio of 1 means that the average mean time to death in the treatment group is the same as that in thecontrol group, indicating no treatment effect. The mean ratio total effect is 1.14, which is not significantlydifferent from the null value of 1. This indicates that there is no significant total causal treatment effect ofRed 40 on the survival time.

The natural indirect effect (NIE) is 0.99. Although this indicates that a high dose of Red 40 might have avery small negative indirect effect on survival through its effect on the tumor, the evidence here is very weakbecause the NIE is not statistically significantly different from 1. The natural direct effect (NDE) is 1.15,which also is not significantly different from 1. For these mean ratio causal effects, you can verify that theproduct of NIE and NDE is the same as the total effect.

The total excess mean ratio measures how different the mean ratio total effect is from 1. In this case, it is 0.14(=1.14–1). The percentage decomposition of effects in the summary table is based on the partitioning of thetotal excess mean ratio rather than that of the mean ratio total effect. For example, the percentage mediatedis about –8%, which is computed by –0.011/0.140�100%. The 95% confidence interval for percentagemediated is very wide and includes the zero value. Therefore, this percentage is not statistically significant.

In fact, no effect or percentage estimates in Output 38.5.5 are statistically significant.

Output 38.5.5 Summary of Causal Mediation Effects

Summary of Effects

EstimateStandard

Error

95%Confidence

Limits Z Pr > |Z|

Mean Ratio Total Effect 1.1402 0.1180 0.9308 1.3967 1.27 0.2050

Mean Ratio Controlled Direct Effect (CDE) 1.1803 0.1286 0.9535 1.4612 1.52 0.1279

Mean Ratio Natural Direct Effect (NDE) 1.1515 0.1184 0.9414 1.4087 1.37 0.1700

Mean Ratio Natural Indirect Effect (NIE) 0.9902 0.02232 0.9474 1.0349 -0.44 0.6607

Total Excess Mean Ratio 0.1402 0.1180 -0.09115 0.3716 1.19 0.2349

Excess Mean Ratio Due to CDE 0.1851 0.1314 -0.07239 0.4426 1.41 0.1588

Excess Mean Ratio Due to NDE 0.1515 0.1184 -0.08054 0.3836 1.28 0.2006

Excess Mean Ratio Due to NIE -0.01134 0.02582 -0.06195 0.03927 -0.44 0.6605

Percentage Mediated -8.0882 20.2332 -47.7446 31.5682 -0.40 0.6893

Percentage Due to Interaction -28.4718 20.4780 -68.6080 11.6644 -1.39 0.1644

Percentage Eliminated -32.0379 27.1096 -85.1717 21.0959 -1.18 0.2373

To complete the interpretations of the results, you would like to examine the estimation of the outcome andmediator models. Output 38.5.6 shows the estimates for the outcome model.

Page 83: The CAUSALMED Procedure

Example 38.5: Causal Mediation Analysis of a Time-to-Event Outcome F 2441

Output 38.5.6 Outcome Model Estimation

Outcome Model Estimates

Parameter EstimateStandard

ErrorWald 95%

Confidence LimitsWald

Chi-Square Pr > ChiSq

Intercept 5.0436 0.1110 4.8261 5.2611 2065.0523 <.0001

Female 0 -0.3366 0.1015 -0.5356 -0.1376 10.9921 0.0009

Female 1 0 . . . . .

RedDye 3 0.1658 0.1089 -0.04765 0.3793 2.3178 0.1279

RedDye 0 0 . . . . .

Tumor 1 -0.2952 0.1414 -0.5723 -0.01801 4.3569 0.0369

Tumor 0 0 . . . . .

RedDye*Tumor 3 1 -0.3804 0.1953 -0.7631 0.002341 3.7946 0.0514

RedDye*Tumor 3 0 0 . . . . .

RedDye*Tumor 0 1 0 . . . . .

RedDye*Tumor 0 0 0 . . . . .

Scale 0.3468 0.03761 0.2804 0.4290

Weibull Shape 2.8833 0.3127 2.3312 3.5662

As suggested by the effect estimate of 0.166, a high dose of Red 40 might have a positive effect on thesurvival time. But the corresponding p-value of 0.128 does not support the statistical significance of thiseffect.

The Tumor effect (p-value = 0.037) and the RedDye�Tumor effect (p-value = 0.051) are both negative. Thesenegative effects suggest that the development of a tumor (which is the mediator in the analysis) and itscombination with a high dose of Red 40 might accelerate the death of the mice. However, these negativeeffects do not lead to a statistically significant NIE (in Output 38.5.5) for the mediation analysis. The mediatormodel estimation results in Output 38.5.7 might provide a hint as to why this is the case.

Output 38.5.7 Mediator Model Estimation

Mediator Model Estimates

Parameter EstimateStandard

ErrorWald 95%

Confidence LimitsWald

Chi-Square Pr > ChiSq

Intercept -1.6859 0.3553 -2.3823 -0.9896 22.5196 <.0001

Female 0 -1.0020 0.4740 -1.9311 -0.07296 4.4685 0.0345

Female 1 0 . . . . .

RedDye 3 0.1944 0.4418 -0.6715 1.0603 0.1936 0.6599

RedDye 0 0 . . . . .

In Output 38.5.7, a high dose of RedDye does not have a significant effect on Tumor. Therefore, this weaklinkage between RedDye and Tumor did not lead to a meaningful indirect effect (NIE) of Red 40 on the timeto death via the tumor development.

Finally, instead of fitting the accelerated failure time model to the data, you can fit a Cox proportional hazardsmodel for the time-to-event outcome to the same data. To do this, you use almost the same specification as inthe preceding analysis, except that now you use the COXPH option in the MODEL statement, as follows:

Page 84: The CAUSALMED Procedure

2442 F Chapter 38: The CAUSALMED Procedure

proc causalmed data=RedDye ciratio=log poutcomemod pmedmod;class RedDye Female Tumor;model Weeks*Censor(1) = RedDye | Tumor / coxph;mediator Tumor(event='1') = RedDye(treat='3');covar Female;freq Freq;

run;

When you use the proportional hazards model, the causal effects in the output are expressed as hazard ratios.Output 38.5.8 shows the summary of the causal mediation analysis.

Output 38.5.8 Summary of Causal Mediation Effects Using Cox Proportional Hazards Model

Summary of Effects

EstimateStandard

Error

95%Confidence

Limits Z Pr > |Z|

Hazard Ratio Total Effect 0.9444 0.2808 0.5274 1.6913 -0.19 0.8474

Hazard Ratio Controlled Direct Effect (CDE) 0.6146 0.1921 0.3331 1.1340 -1.56 0.1193

Hazard Ratio Natural Direct Effect (NDE) 0.8777 0.2412 0.5122 1.5040 -0.47 0.6349

Hazard Ratio Natural Indirect Effect (NIE) 1.0761 0.1802 0.7750 1.4940 0.44 0.6615

Total Excess Hazard Ratio -0.05559 0.2808 -0.6059 0.4947 -0.20 0.8430

Excess Hazard Ratio Due to CDE -0.3287 0.1769 -0.6754 0.01800 -1.86 0.0631

Excess Hazard Ratio Due to NDE -0.1223 0.2412 -0.5951 0.3504 -0.51 0.6120

Excess Hazard Ratio Due to NIE 0.06675 0.1561 -0.2393 0.3728 0.43 0.6690

Percentage Mediated -120.07 788.41 -1665.32 1425.18 -0.15 0.8790

Percentage Due to Interaction -441.30 2513.97 -5368.59 4485.99 -0.18 0.8607

Percentage Eliminated -491.28 2811.86 -6002.43 5019.86 -0.17 0.8613

Because a higher hazard ratio implies a shorter expected survival time, the causal mediation effects that areexpressed as hazard ratios (that is, in Output 38.5.8) would show the opposite directions as those that areexpressed as mean ratios of survival time (that is, in Output 38.5.5). For example, whereas the hazard ratiosfor the total effect, CDE, and NDE in Output 38.5.8 are all less than 1, the corresponding mean ratios forthe total effect, CDE, and NDE in Output 38.5.5 are all greater than 1. Similarly, whereas the excess hazardratios for the total effect, CDE, and NDE in Output 38.5.8 are all less than 0, the corresponding excess meanratios for the total effect, CDE, and NDE in Output 38.5.5 are all greater than 0. Therefore, these two sets ofcausal mediation results are in fact consistent.

References

Baron, R. M., and Kenny, D. A. (1986). “The Moderator-Mediator Variable Distinction in Social Psychologi-cal Research: Conceptual, Strategic, and Statistical Considerations.” Journal of Personality and SocialPsychology 51:1173–1182.

Bollen, K. A. (1989). Structural Equations with Latent Variables. New York: John Wiley & Sons.

Cox, D. R. (1972). “Regression Models and Life-Tables.” Journal of the Royal Statistical Society, Series B34:187–220. With discussion.

Page 85: The CAUSALMED Procedure

References F 2443

Hong, G. (2015). Causality in a Social World: Moderation, Mediation, and Spill-Over. New York: JohnWiley & Sons.

Imai, K., Keele, L., Tingley, D., and Yamamoto, T. (2010). “Causal Mediation Analysis Using R.” InAdvances in Social Science Research Using R, edited by H. D. Vinod, 129–154. New York: Springer.

Kalbfleisch, J. D., and Prentice, R. L. (1980). The Statistical Analysis of Failure Time Data. New York: JohnWiley & Sons.

Lagakos, S., and Mosteller, F. (1981). “A Case Study of Statistics in the Regulatory Process: The FD&C RedNo. 40 Experiments.” Journal of the National Cancer Institute 66:197–212.

Lawless, J. F. (2003). Statistical Model and Methods for Lifetime Data. 2nd ed. New York: John Wiley &Sons.

Marjoribanks, K., ed. (1974). Environments for Learning. London: National Foundation for EducationalResearch Publications.

Pearl, J. (2001). “Direct and Indirect Effects.” In Proceedings of the Seventeenth Conference on Uncertaintyin Artificial Intelligence, edited by J. Breese and D. Koller, 411–420. San Francisco: Morgan Kaufmann.

Pearl, J. (2009). Causality: Models, Reasoning, and Inference. 2nd ed. Cambridge: Cambridge UniversityPress.

Robins, J. M., and Greenland, S. (1992). “Identifiability and Exchangeability for Direct and Indirect Effects.”Epidemiology 3:143–155.

Valeri, L., and VanderWeele, T. J. (2013). “Mediation Analysis Allowing for Exposure-Mediator Interactionsand Causal Interpretation: Theoretical Assumptions and Implementation with SAS and SPSS Macros.”Psychological Methods 18:137–150.

Valeri, L., and VanderWeele, T. J. (2015). “SAS Macro for Causal Mediation Analysis with Survival Data.”Epidemiology 26:e23–e24.

VanderWeele, T. J. (2011). “Causal Mediation Analysis with Survival Data.” Epidemiology 22:582–585.

VanderWeele, T. J. (2014). “A Unification of Mediation and Interaction: A 4-Way Decomposition.” Epidemi-ology 25:749–761.

VanderWeele, T. J. (2015). Explanation in Causal Inference: Methods for Mediation and Interaction. NewYork: Oxford University Press.

VanderWeele, T. J., and Vansteelandt, S. (2009). “Conceptual Issues Concerning Mediation, Interventionsand Compositions.” Statistics and Its Interface 2:457–468.

VanderWeele, T. J., and Vansteelandt, S. (2010). “Odds Ratios for Mediation Analysis for a DichotomousOutcome.” American Journal of Epidemiology 172:1339–1348.

Page 86: The CAUSALMED Procedure

Subject Index

bias-corrected confidence intervalCAUSALMED procedure, 2378, 2415

bootstrap normal confidence intervalCAUSALMED procedure, 2414

bootstrap percentile methodCAUSALMED procedure, 2378

CAUSALMED procedurebias-corrected confidence interval, 2378, 2415bootstrap normal confidence interval, 2414bootstrap percentile method, 2378conditional effect evaluation, 2383confidence interval, 2378degrees of freedom, 2378mediator model, 2387ODS table names, 2415output table names, 2415percentile confidence interval, 2415printing options, 2416variances, 2378

classification variablessort order of levels (CAUSALMED), 2376

conditional effect evaluationCAUSALMED procedure, 2383

confidence intervalCAUSALMED procedure, 2378

degrees of freedomCAUSALMED procedure, 2378

mediator modelCAUSALMED procedure, 2387

output table namesCAUSALMED procedure, 2415

percentile confidence intervalCAUSALMED procedure, 2415

probability distribution, built-inCAUSALMED procedure, 2393

variancesCAUSALMED procedure, 2378

Page 87: The CAUSALMED Procedure
Page 88: The CAUSALMED Procedure

Syntax Index

ABSCONV optionPROC CAUSALMED statement, 2374

ABSFCONV optionPROC CAUSALMED statement, 2374

ABSGCONV optionPROC CAUSALMED statement, 2375

AFT optionMODEL statement, 2393

ALPHA= optionPROC CAUSALMED statement, 2372

BOOTSTRAP statementCAUSALMED procedure, 2378

BY statementCAUSALMED procedure, 2381

CASECONTROL optionPROC CAUSALMED statement, 2372

CAUSALMED procedure, 2371syntax, 2371

CAUSALMED procedure, BOOTSTRAP statement,2378

BOOTCI option, 2379IGNORECC option, 2380MINSAMP= option, 2380NBOOT= option, 2380NOSKIP option, 2380SEED= option, 2380

CAUSALMED procedure, BY statement, 2381CAUSALMED procedure, CLASS statement, 2381

CPREFIX= option, 2381DESCENDING option, 2381LPREFIX= option, 2382MISSING option, 2382ORDER= option, 2382REF= option, 2382TRUNCATE option, 2382

CAUSALMED procedure, COVAR statement, 2383CAUSALMED procedure, EVALUATE statement,

2383CAUSALMED procedure, FREQ statement, 2387CAUSALMED procedure, MEDIATOR statement,

2387CONTROL= option, 2389DESCENDING option, 2388, 2390EVENT= option, 2388ORDER= option, 2388, 2390REFERENCE= option, 2389TREAT= option, 2390

CAUSALMED procedure, MODEL statement, 2391AFT option, 2393COXPH option, 2393DESCENDING option, 2392DIST= option, 2393DISTRIBUTION= option, 2393EVENT= option, 2392LINK= option, 2394NOLOG option, 2395ORDER= option, 2393REFERENCE= option, 2393

CAUSALMED procedure, PROC CAUSALMEDstatement, 2371

ABSCONV= option, 2374ABSFCONV= option, 2374ABSGCONV= option, 2375ALPHA= option, 2372CASECONTROL option, 2372CIRATIO= option, 2373DATA= option, 2373DECOMP option, 2373DESCENDING option, 2374FCONV= option, 2375GCONV= option, 2375MAXFUNC= option, 2375MAXITER= option, 2376MAXTIME= option, 2376NAMELENGTH= option, 2374NLOPTIONS option, 2374NOPRINT option, 2376ORDER= option, 2376PALL option, 2377PMEDMOD option, 2377POUTCOMEMOD option, 2377PSHORT option, 2377PSUMMARY option, 2377RORDER= option, 2377SINGULAR= option, 2378TECHNIQUE= option, 2376THREADS= option, 2378VARDEF= option, 2378

CAUSALMED procedure, STD statement, 2395CAUSALMED procedure, WEIGHT statement, 2396CI option

BOOTSTRAP statement (CAUSALMED), 2379CIRATIO= option

PROC CAUSALMED statement, 2373CLASS statement

Page 89: The CAUSALMED Procedure

CAUSALMED procedure, 2381CONTROL= option

MEDIATOR statement, 2389COVAR statement

CAUSALMED procedure, 2383COXPH option

MODEL statement, 2393CPREFIX= option

CLASS statement (CAUSALMED), 2381

DATA= optionPROC CAUSALMED statement, 2373

DECOMP optionPROC CAUSALMED statement, 2373

DESCENDING optionCLASS statement (CAUSALMED), 2381MEDIATOR statement (CAUSALMED), 2388,

2390MODEL statement (CAUSALMED), 2392PROC CAUSALMED statement, 2374

DIST= optionMODEL statement, 2393

DISTRIBUTION= optionMODEL statement, 2393

EVALUATE statementCAUSALMED procedure, 2383

EVENT= optionMEDIATOR statement, 2388MODEL statement, 2392

FCONV optionPROC CAUSALMED statement, 2375

FREQ statementCAUSALMED procedure, 2387

GCONV optionPROC CAUSALMED statement, 2375

IGNORECC optionBOOTSTRAP statement (CAUSALMED), 2380

LINK= optionMODEL statement, 2394

LPREFIX= optionCLASS statement (CAUSALMED), 2382

MAXFUNC= optionPROC CAUSALMED statement, 2375

MAXITER= optionPROC CAUSALMED statement, 2376

MAXTIME= optionPROC CAUSALMED statement, 2376

MEDIATOR statementCAUSALMED procedure, 2387

MINSAMP= optionBOOTSTRAP statement (CAUSALMED), 2380

MISSING optionCLASS statement (CAUSALMED), 2382

MODEL statementCAUSALMED procedure, 2391

NAMELENGTH= optionPROC CAUSALMED statement, 2374

NBOOT= optionBOOTSTRAP statement (CAUSALMED), 2380

NLOPTIONS optionPROC CAUSALMED statement, 2374

NOLOG optionMODEL statement, 2395

NOPRINT optionPROC CAUSALMED statement, 2376

NOSKIP optionBOOTSTRAP statement (CAUSALMED), 2380

ORDER= optionCLASS statement (CAUSALMED), 2382MEDIATOR statement, 2388, 2390MODEL statement, 2393PROC CAUSALMED statement, 2376

PALL optionPROC CAUSALMED statement, 2377

PMEDMOD optionPROC CAUSALMED statement, 2377

POUTCOMEMOD optionPROC CAUSALMED statement, 2377

PROC CAUSALMED statement, see CAUSALMEDprocedure

PSHORT optionPROC CAUSALMED statement, 2377

PSUMMARY optionPROC CAUSALMED statement, 2377

REF= optionCLASS statement (CAUSALMED), 2382

REFERENCE= optionMEDIATOR statement, 2389MODEL statement, 2393

RORDER= optionPROC CAUSALMED statement, 2377

SEED= optionBOOTSTRAP statement (CAUSALMED), 2380

SINGULAR= optionPROC CAUSALMED statement, 2378

STD statementCAUSALMED procedure, 2395

TECHNIQUE= option

Page 90: The CAUSALMED Procedure

PROC CAUSALMED statement, 2376THREADS= option

PROC CAUSALMED statement, 2378TREAT= option

MEDIATOR statement, 2390TRUNCATE option

CLASS statement (CAUSALMED), 2382

VARDEF= optionPROC CAUSALMED statement, 2378

WEIGHT statementCAUSALMED procedure, 2396