Table 1
Arguments for Proc_R_dataorg Macro.
| Arguments | Description | Notes |
|---|---|---|
| PATH | Path where the macro is saved. | |
| PATHD | Path where the SAS dataset is stored. | By default, the SAS dataset will be saved in the “Work’’ SAS library. |
| DATA | Name of the SAS dataset that contains the data for mediation analysis. | Needs to read the data into SAS format before implementing the macro. |
| PATH_R | Path where R dataset and txt file will be stored. | Make sure the path includes only forward slashes (/). |
| X | The dataset that contains all potential mediators and covariates. | |
| MEDIATOR | The list of names or the column numbers in x of all potential mediators. If listed, the function tells whether the potential mediator is continuous or categorical by the type and number of unique values of each variable. | The arguments CATMED and BINMED are used only when specific reference groups are needed to be specified (by BINREF and CATREF). |
| CONTMED | Names or column numbers of continuous mediators in X. | |
| BINMED | Names or column numbers of binary mediators in X. | |
| BINREF | Reference group(s) of the potential binary mediators in BINMED. | The default reference group is the first level of the mediator. |
| CATMED | Names or column numbers of categorical mediators in X. | If the categorical variable has 3 or more groups and numeric values, it must be specified using CATMED to be treated as categorical. |
| CATREF | Reference groups of the potential categorical mediators in CATMED. | The default is the first level of the mediator. |
| PREDREF | If the predictor is categorical, the reference group for the predictor. | The default is the first level of the predictor. |
| JOINTM | Group(s) of variables whose joint effect is of interest. | The first item is the number of groups of joint mediators and the following items identify the column numbers of the mediators in X for each group of joint mediators. |
| REFY | The reference group for Y if Y is binary. | |
| ALPHA | The significance level to test if the potential mediators is significant in estimating Y. | The default is ALPHA=0.1. |
| ALPHA2 | The significance level to test if a potential mediator is significantly related with the predictor. | The default is ALPHA2=0.1. |
| PRED | The vector or matrix of predictor(s). | |
| Y | The vector or matrix of the outcome variable. | If Y is a survival outcome, then define it using the Surv(time,status) function. |
| TIME | If Y is a time-to-event outcome, this is the variable in the dataset that indicates follow up time. | |
| STATUS | If Y is a time-to-event outcome, this is a 0 to 1 indicator identifies no event or event separately. |

Figure 1
Summary of identified mediators.
Table 2
Arguments for Proc_R_med Macro.
| Arguments | Description | Notes |
|---|---|---|
| MARGIN | The change in predictor when calculating the mediation effects. | The argument is useful only when the predictor is continuous. By default, MARGIN=1. |
| D | If MART is used, the parameter specifies the “interaction.depth” in gbm function. | The default is D=3. |
| DISTN | If MART is used for the final full model, the assumed distribution of the outcome. | The default is DISTN=“gaussian” for continuous y and DISTN=“bernoulli” for binary y. |
| n | The time of resampling in calculating the indirect effects. | The default is n=20. |
| NU | If MART is used, set the parameter “shrinkage” in gbm function. | The default is nu=0.001. |
| NONLINEAR | If NONLINEAR=TRUE, MART will be used to fit the final full model in estimating the outcome. Splines with degree freedom DF1 are used to fit the relationship between the predictor and potential mediators. | The default is NONLINEAR=FALSE, a generalized linear model will be used. |
| DF1 | The degrees of freedom in the ns() function when MART is used. | The default is DF1=1. |
| TYPE | The type of prediction when Y is class Surv. | The default is “risk”. |

Figure 2
SAS output with the final full model.
Table 3
Arguments for Proc_R_bootmed Macro.
| Arguments | Description | Notes |
|---|---|---|
| n2 | The number of times of bootstrap resampling. | The default is n2 = 50. |
| RE | The summary function will also report the summaries of the relative effects, calculated as the “(in)direct effect/total effect” if RE=TRUE. |

Figure 3
The estimated mediation effects.

Figure 4
Summary of the bootmed function.
Table 4
Arguments for Proc_R_bootmed_Plot Macro.
| Arguments | Description | Notes |
|---|---|---|
| VARI | The name of the variable to plot. | |
| XLIM | The range of the variable to be plotted. | |
| ALPHA | For continuous predictor only, to draw the 1-alpha confidence interval of the indirect effect. | |
| QUANTILE | For continuous predictor only, to draw the alpha confidence interval of the indirect effect based on quantile QUANTILE=TRUE. |

Figure 5
The marginal effects of exercise on overweight and the marginal effect of sex on exercise.
