The CAUSALMED Procedure

MEDIATOR Statement

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

The MEDIATOR statement is required for specifying the mediator model. You provide mediator (the name of the mediator variable) to the left of the equal sign and treatment (the name of the treatment variable) to the 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 in the analysis:

mediator M = T;

Together, the COVAR, MEDIATOR, and MODEL statements specify the relationships of all variables in the mediation analysis. The mediator and treatment variables that you specify in the MEDIATOR statement must be consistent with those that you specify in the MODEL statement. If there are covariates in the analysis, do not specify them or their effects in the MEDIATOR statement even though covariate effects on the mediator variable 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 or treatment variable is a binary variable by listing it in the CLASS statement. Otherwise, it is assumed to be continuous.

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 binary mediator.

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

DESCENDING
DESC

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

EVENT='level' | FIRST | LAST

specifies the event category or level for the binary mediator. The same event level is also assumed for the mediator variable in the outcome model that you specify in the MODEL statement. PROC CAUSALMED 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 reference level (see the REF= option). This reference level is the controlled mediator value for computing controlled 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 value of 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 mediator variable, use the following MEDIATOR statement:

mediator M(event='1') = T;
ORDER=DATA | FORMATTED | FREQ | INTERNAL

specifies the sort order for the levels of the mediator variable. The following table displays the available 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 are sorted by their unformatted (internal) value. The sort order is machine-dependent.
FREQ Descending frequency count. Levels that have the most observations come first in the order.
INTERNAL Unformatted value. The sort order is machine-dependent.

By default, ORDER=FORMATTED.

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

REFERENCE='level' | FIRST | LAST
REF='level' | FIRST | LAST

specifies the reference level for the binary mediator variable. This reference level is also the controlled mediator value for computing controlled direct effects. The same reference level is also assumed for the 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 mediator variable.

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 the formatted 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 or control level. You can use the following treat-options to specify the attributes of the binary treatment levels:

CONTROL='level' | FIRST | LAST
REF='level' | FIRST | LAST

specifies the control level for the binary treatment variable. The same control level is also assumed for the 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 the treatment level of the treatment variable (see the TREAT= option). You cannot specify both the CONTROL= and TREAT= options.

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

'level'

specifies the level in quotation marks to be used as the control level. Specify the formatted value 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
DESC

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

ORDER=DATA | FORMATTED | FREQ | INTERNAL

specifies the sort order for the levels of the treatment variable. The following table displays the available 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 are sorted by their unformatted (internal) value. The sort order is machine-dependent.
FREQ Descending frequency count. Levels that have the most observations come first in the order.
INTERNAL Unformatted value. The sort order is machine-dependent.

By default, ORDER=FORMATTED.

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

TREAT='level' | FIRST | LAST

specifies the treatment level of the treatment variable. The same treatment level is also assumed for the treatment 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 control level (see the CONTROL= option). You cannot specify both the CONTROL= and TREAT= options for 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 the formatted 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.

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 the treatment variable, use the following MEDIATOR statement:

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

Last updated: December 09, 2022