My 2016 workshop schedule on mediation and moderation analysis using PROCESS can be found on the PROCESS page. In 2016 I will be offering workshops in Australia, Switzerland, and the United States. Registration is now open.

## My Macros and Code for SPSS and SAS

On this page you will find information about many of the macros for SPSS and SAS that I have written. Most of these are described in various publications, and I recommend you read the corresponding publication before using the macro.

As with all statistical software, all attempts are made to make sure that the computations programmed into these procedures are performed correctly. When bugs are found and reported, I attempt to eliminate them as quickly as possible. I offer this procedures to the research community "as is" and accept no responsibility for any negative consequences that might result from their use.

If you have trouble getting anything on this page to work or just have a question, first check my "Rules and FAQ page" and read the documentation and corresponding journal articles before contacting me by email.

Here is a document on how to install custom dialog files into SPSS. If you can't solve a write or installation permissions error, try this.

For macros (the .sps files or .sas files). Make sure you run the code exactly as downloaded in a syntax or program file. Modifying the code will produce errors. Do not modify the code at all. See the documentation for each of my macros for instructions on their use.

For real time updates about my work on mediation and moderation, "Like" the facebook page for my lab. (Note: This page is not a discussion forum. I do not answer questions posted on the wall of this page. Contact me at hayes.338@osu.edu if you have questions not answered on my FAQ page)

As with all statistical software, all attempts are made to make sure that the computations programmed into these procedures are performed correctly. When bugs are found and reported, I attempt to eliminate them as quickly as possible. I offer this procedures to the research community "as is" and accept no responsibility for any negative consequences that might result from their use.

If you have trouble getting anything on this page to work or just have a question, first check my "Rules and FAQ page" and read the documentation and corresponding journal articles before contacting me by email.

__Installing Custom Dialog files in SPSS__Here is a document on how to install custom dialog files into SPSS. If you can't solve a write or installation permissions error, try this.

For macros (the .sps files or .sas files). Make sure you run the code exactly as downloaded in a syntax or program file. Modifying the code will produce errors. Do not modify the code at all. See the documentation for each of my macros for instructions on their use.

For real time updates about my work on mediation and moderation, "Like" the facebook page for my lab. (Note: This page is not a discussion forum. I do not answer questions posted on the wall of this page. Contact me at hayes.338@osu.edu if you have questions not answered on my FAQ page)

MEMORE

(

MEMORE is a macro for SPSS and SAS that estimates the total, direct, and indirect effects of

Moderation functions have not yet been implemented in MEMORE.

SPSS version documentation: memore.pdf

SAS version documentation: memore_sas.pdf

If you have questions about the use of MEMORE, email Amanda Montoya (montoya.29@osu.edu)

(

__ME__diation and__MO__deration in__RE__peated-measures designs)

Montoya, A. K., & Hayes, A. F. (2015). Two condition within-participant statistical mediation analysis: A path-analytic framework.Montoya, A. K., & Hayes, A. F. (2015). Two condition within-participant statistical mediation analysis: A path-analytic framework.

*Manuscript submitted for publication*. [PDF]

MEMORE is a macro for SPSS and SAS that estimates the total, direct, and indirect effects of

*X*on*Y*through one or more mediators*M*in the two-condition or two-occasion within-subjects/repeated measures design. In a path-analytic form using OLS regression as illustrated in Montoya and Hayes (2015), it implements the method described by Judd, Kenny, and McClelland (2001,*Psychological Methods*) and extended by Montoya and Hayes (2015) to multiple mediators. Along with an estimate of the indirect effect(s), MEMORE generates confidence intervals for inference about the indirect effect(s) using bootstrapping, Monte Carlo, or normal theory approaches. MEMORE also provides an option that conducts pairwise contrasts between specific indirect effects in models with multiple mediators.Moderation functions have not yet been implemented in MEMORE.

**Download MEMORE here**: memore.zipSPSS version documentation: memore.pdf

SAS version documentation: memore_sas.pdf

If you have questions about the use of MEMORE, email Amanda Montoya (montoya.29@osu.edu)

**Coming soon!**

**RLM****Darlington, R. B. & Hayes, A. F. (2016).**

*Regression and linear models*(2nd Ed). New York: The Guilford PressThe RLM macro will be released with the publication of

*Regression and Linear Models*in the first half of 2016 and can be downloaded then from the book's web page. It is documented in Appendix A of the book. Available for SPSS and SAS, RLM is a supplement to SAS and SPSS's regression modules. In addition to the usual regression program output, it has options for heteroscedasticity-consistent inference (using either the HC0, HC1, HC2, and HC3 variance-covariance matrix), automatic coding of a multicategorical categorical regressor, options for estimating and probing interactions involving a multicategorical regressor, all subsets regression, spline regression, crossvalidation indices for the multiple correlation, an implementation of a limited form of dominance analysis, contrasts between regression coefficients, and a few other features.

INDIRECT

Preacher, K. J., & Hayes, A. F. (2008). Asymptotic and resampling strategies for assessing and comparing indirect effects in multiple mediator models.

This macro for SPSS and SAS estimates the path coefficients in a multiple mediator model and generates bootstrap confidence intervals (percentile, bias-corrected, and bias-corrected and accelerated) for total and specific indirect effects of

Note: INDIRECT is

Download INDIRECT: indirect.zip

Preacher, K. J., & Hayes, A. F. (2008). Asymptotic and resampling strategies for assessing and comparing indirect effects in multiple mediator models.

*Behavior Research Methods*, 40, 879-891. [PDF].This macro for SPSS and SAS estimates the path coefficients in a multiple mediator model and generates bootstrap confidence intervals (percentile, bias-corrected, and bias-corrected and accelerated) for total and specific indirect effects of

*X*on*Y*through a one or more mediator variable(s) M. This is macro is far superior to SOBEL, as it allows for more than one mediator and adjusts all paths for the potential influence of covariates not proposed to be mediators in the model. Since the macro was originally published, many improvements have been made to the SPSS version, including the ability to estimate models with dichotomous outcomes.Note: INDIRECT is

**obsolete**with the release of PROCESS. PROCESS is capable of doing everything that INDIRECT can do and a whole lot more. For a discussion of the parallel multiple mediation model, see Chapter 5 of Hayes (2013). To learn more about PROCESS and download, go here.Download INDIRECT: indirect.zip

**INDIRECT is obsolete with the release of PROCESS. To learn more about PROCESS, see Hayes (2013). PROCESS can be downloaded from processmacro.org.**

**MEDIATE**MEDIATE for SPSS is an alternative to PROCESS for conducting the kind of analysis described in

**Hayes, A. F., & Preacher, K., J. (2014). Statistical mediation analysis with a multicategorical independent variable,**

*67*, 451-470.

*British Journal of Mathematical and Statistical Psychology*[email me for a copy] DOI:10.1111/bmsp.12028 [online supplement]

**With the release of PROCESS v2.15 in January 2016, MEDIATE is obsolete. If you want to use the method described in Hayes and Preacher (2014), you can now use PROCESS.**

MEDIATE conducts mediation analysis (single and multiple mediators) with either continuous, dichotomous, or multicategorical independent variables. It is similar in functionality to INDIRECT but offers additional features that accommodate multiple independent variables simultaneously and that simplify the coding of multicategorical independent variables. When analyzing the effect of a multicategorical independent variable, the user can produce the requisite k - 1 variables coding group (where k is the number of groups) manually and enter them as independent variables or have MEDIATE automatically generate the variables using either indicator, effect, sequential coding, or Helmert coding. It offers tests of relative direct and indirect effects, including percentile bootstrap and Monte Carlo confidence intervals for indirect effects. It also automatically conducts a test of homogeneity of regression (i.e., interaction between X and M in the model of Y).

Download MEDIATE: mediate.zip

There is no SPSS custom dialog (.spd) version of MEDIATE, nor is there a SAS version. SAS users interested in applying the method described in the this paper can use PROCESS

SOBEL

Preacher, K. J., & Hayes, A. F. (2004). SPSS and SAS procedures for estimating indirect effects in simple mediation models.

This macro for SPSS and SAS estimates the size of an indirect effect of

Preacher, K. J., & Hayes, A. F. (2004). SPSS and SAS procedures for estimating indirect effects in simple mediation models.

*Behavior Research Methods, Instruments, and Computers, 36*, 717-731. [PDF]This macro for SPSS and SAS estimates the size of an indirect effect of

*X*on*Y*through a single mediator*M*, and computes both normal theory (Sobel’s test) and bootstrap approaches for inference. Although this was once a very popular macro, PROCESS (see above) can do everything SOBEL can do, and a lot more. If you intend to use this macro merely to implement the "Baron and Kenny" steps to mediation analysis or the Sobel test, I advise you against this. For a rationale, read Preacher and Hayes (2004), Hayes, A. F. (2009). Beyond Baron and Kenny: Statistical mediation analysis in the new millennium. Communication Monographs, 76, 408-420 [PDF], or see section 6.1 of Hayes (2013).

SOBEL is obsolete with the release of PROCESS. To learn more about PROCESS, see Hayes (2013). PROCESS can be downloaded from processmacro.org.SOBEL is obsolete with the release of PROCESS. To learn more about PROCESS, see Hayes (2013). PROCESS can be downloaded from processmacro.org.

**SOBEL is now available only by special request by email.**MODMED

Preacher, K. J., Rucker, D. D., & Hayes, A. F. (2007). Assessing moderated mediation hypotheses: Theory, methods, and prescriptions.

This SPSS macro conducts tests of conditional indirect effects when assessing

Download MODMED: modmed.zip

There is no SAS version of MODMED.

NOTE: There is no custom dialog for MODMED, nor is there a SAS version. SAS users interested in the functions of MODMED should use PROCESS instead. PROCESS is capable of doing almost all of what MODMED can do, plus PROCESS can estimate a larger set of moderated mediation models, with multiple mediators, as well as with dichotomous dependent variables. For a discussion of moderated mediation, see Chapters 10, 11, and 12 of Hayes (2013).

Preacher, K. J., Rucker, D. D., & Hayes, A. F. (2007). Assessing moderated mediation hypotheses: Theory, methods, and prescriptions.

*Multivariate Behavioral Research, 42*, 185-227. [PDF]This SPSS macro conducts tests of conditional indirect effects when assessing

*moderated mediation*, as described in Preacher, Rucker, and Hayes (2007). The syntax structure in this version differs slightly from the structure described in Preacher, Rucker, and Hayes. See the documentation for guidance.Download MODMED: modmed.zip

There is no SAS version of MODMED.

**MODMED is obsolete with the release of PROCESS. To learn more about PROCESS, see Hayes (2013). PROCESS can be downloaded from processmacro.org.**

NOTE: There is no custom dialog for MODMED, nor is there a SAS version. SAS users interested in the functions of MODMED should use PROCESS instead. PROCESS is capable of doing almost all of what MODMED can do, plus PROCESS can estimate a larger set of moderated mediation models, with multiple mediators, as well as with dichotomous dependent variables. For a discussion of moderated mediation, see Chapters 10, 11, and 12 of Hayes (2013).

MODPROBE

MODPROBE was originally released in 2009 and is described in

This SPSS and SAS macro is used for probing single-degree-of-freedom interactions in linear and logistic regression models. It implements the ‘pick-a-point’ approach for estimating effects of a focal predictor at specified values of the moderator as well as the Johnson-Neyman technique for calculating regions of significance. It also generates estimated values of the outcome from the model, which is useful for generating visual plots of the interaction. You might also check out a paper of mine that describes the dangers of not knowing how to properly interpret the coefficients in a regression model with interactions.

Note: PROCESS and RLM are capable of doing may things that MODPROBE can do and a whole lot more. For a discussion of moderation analysis, see Chapters 7, 8, and 9 of Hayes (2013) or Chapters 13 and 14 of Darlington and Hayes (2016).

Download MODPROBE: modprobe.zip

Take a course on interactions in linear regression from Andrew F. Hayes through Statistical Horizons. The next course is offered in May of 2016.

For some instruction on how to plot an interaction in SPSS using the output from MODPROBE's "est" option, click here.

Here is the logistic regression example mentioned in the Behavior Research Methods article.

If you are interested in estimating and probing a three way interaction, use PROCESS.

MODPROBE was originally released in 2009 and is described in

**Hayes, A. F., & Matthes, J. (2009). Computational procedures for probing interactions in OLS and logistic regression: SPSS and SAS implementations.***Behavior Research Methods*, 41, 924-936. [PDF].This SPSS and SAS macro is used for probing single-degree-of-freedom interactions in linear and logistic regression models. It implements the ‘pick-a-point’ approach for estimating effects of a focal predictor at specified values of the moderator as well as the Johnson-Neyman technique for calculating regions of significance. It also generates estimated values of the outcome from the model, which is useful for generating visual plots of the interaction. You might also check out a paper of mine that describes the dangers of not knowing how to properly interpret the coefficients in a regression model with interactions.

Note: PROCESS and RLM are capable of doing may things that MODPROBE can do and a whole lot more. For a discussion of moderation analysis, see Chapters 7, 8, and 9 of Hayes (2013) or Chapters 13 and 14 of Darlington and Hayes (2016).

Download MODPROBE: modprobe.zip

Take a course on interactions in linear regression from Andrew F. Hayes through Statistical Horizons. The next course is offered in May of 2016.

For some instruction on how to plot an interaction in SPSS using the output from MODPROBE's "est" option, click here.

Here is the logistic regression example mentioned in the Behavior Research Methods article.

If you are interested in estimating and probing a three way interaction, use PROCESS.

MEDCURVE

Hayes, A. F., & Preacher, K. J. (2010). Quantifying and testing indirect effects in simple mediation models when the constituent paths are nonlinear. Multivariate Behavioral Research, 45, 627-660. [PDF]

This macro for SPSS and SAS estimates instantaneous indirect effects in simple mediation models with nonlinear paths, as discussed in Hayes and Preacher (2010), and produces bootstrap confidence intervals for inference. The X->M, M|X->Y, and X|M->Y paths can be estimated as linear, quadratic, exponential, log, or inverse, in any combination, thereby allowing for the estimation of 125 different models.

Download MEDCURVE: medcurve.zip

Note: There is an error in the equation for Y-hat at the bottom of page 640 of Preacher and Hayes (2010). This equation should read Y-hat = -2.0823 + 1.1197(X) - 0.1292(X*X) + 0.7896(M). This does not affect any of the computations anywhere in the manuscript.

Hayes, A. F., & Preacher, K. J. (2010). Quantifying and testing indirect effects in simple mediation models when the constituent paths are nonlinear. Multivariate Behavioral Research, 45, 627-660. [PDF]

This macro for SPSS and SAS estimates instantaneous indirect effects in simple mediation models with nonlinear paths, as discussed in Hayes and Preacher (2010), and produces bootstrap confidence intervals for inference. The X->M, M|X->Y, and X|M->Y paths can be estimated as linear, quadratic, exponential, log, or inverse, in any combination, thereby allowing for the estimation of 125 different models.

Download MEDCURVE: medcurve.zip

Note: There is an error in the equation for Y-hat at the bottom of page 640 of Preacher and Hayes (2010). This equation should read Y-hat = -2.0823 + 1.1197(X) - 0.1292(X*X) + 0.7896(M). This does not affect any of the computations anywhere in the manuscript.

MEDTHREE and MED3C

Hayes, A. F., Preacher, K. J., & Myers, T. A. (2010). Mediation and the estimation of indirect effects in political communication research. In E. P. Bucy & R. Lance Holbert (Eds), Sourcebook for political communication research: Methods, measures, and analytical techniques. New York: Routledge. [at the publisher's page]

MEDTHREE and MED3C have been discontinued. PROCESS is capable of doing everything these can do and PROCESS provides much more detailed output and many more options. MEDTHREE and MED3C are thus obsolete. For a discussion of the serial mediation model described in this book chapter, see Chapter 5 of Hayes (2013).

Hayes, A. F., Preacher, K. J., & Myers, T. A. (2010). Mediation and the estimation of indirect effects in political communication research. In E. P. Bucy & R. Lance Holbert (Eds), Sourcebook for political communication research: Methods, measures, and analytical techniques. New York: Routledge. [at the publisher's page]

MEDTHREE and MED3C have been discontinued. PROCESS is capable of doing everything these can do and PROCESS provides much more detailed output and many more options. MEDTHREE and MED3C are thus obsolete. For a discussion of the serial mediation model described in this book chapter, see Chapter 5 of Hayes (2013).

HCREG

Hayes, A. F., & Cai, L. (2007). Using heteroscedasticity-consistent standard error estimators in OLS regression: An introduction and software implementation.

[PDF]

This macro for SPSS and SAS is used for estimating OLS regression models but with heteroscedasticity-consistent standard errors using the HC0, HC1, HC2, HC3, and HC4 procedures described by MacKinnon and White (1985), Long and Ervin (2000), and Cribari-Neto (2004).

Download HCREG: hcreg.zip

Documentation: see the Appendix of the article

Hayes, A. F., & Cai, L. (2007). Using heteroscedasticity-consistent standard error estimators in OLS regression: An introduction and software implementation.

*Behavior Research Methods, 39*, 709-722.[PDF]

This macro for SPSS and SAS is used for estimating OLS regression models but with heteroscedasticity-consistent standard errors using the HC0, HC1, HC2, HC3, and HC4 procedures described by MacKinnon and White (1985), Long and Ervin (2000), and Cribari-Neto (2004).

Download HCREG: hcreg.zip

Documentation: see the Appendix of the article

**RLM for SPSS and SAS implements the HC0, HC1, HC2, and HC3 standard error estimators discussed in this article.**

NOTE:NOTE:

KALPHA

Hayes, A. F., & Krippendorff, K. (2007). Answering the call for a standard reliability measure for coding data. Communication Methods and Measures, 1, 77-89. [PDF]

This macro computes Krippendorff's alpha reliability estimate for subjective judgments made at any level of measurement, any number of judges, with or without missing data.

Download KALPHA: kalpha.zip

Here is a document that describes the bootstrapping algorithm.

Hayes, A. F., & Krippendorff, K. (2007). Answering the call for a standard reliability measure for coding data. Communication Methods and Measures, 1, 77-89. [PDF]

This macro computes Krippendorff's alpha reliability estimate for subjective judgments made at any level of measurement, any number of judges, with or without missing data.

Download KALPHA: kalpha.zip

Here is a document that describes the bootstrapping algorithm.

HETREG

Cai, L., & Hayes, A. F. (2007). A new test of linear hypotheses under heteroscedasticity of unknown form. Journal of Educational and Behavioral Statistics, 33, 21-40. [PDF]

This SAS macro implements a new test for the regression coefficients in OLS regression that does not assume homoscedasticity. The paper includes some simulation results showing its superiority over the heteroscedasticity-consistent standard error estimators summarized by Long & Ervin (2000).

Please read the download instructions at the top of this page.

SAS Version

Documentation: See Appendix B of the article.

Macro: hetreg.sas

Cai, L., & Hayes, A. F. (2007). A new test of linear hypotheses under heteroscedasticity of unknown form. Journal of Educational and Behavioral Statistics, 33, 21-40. [PDF]

This SAS macro implements a new test for the regression coefficients in OLS regression that does not assume homoscedasticity. The paper includes some simulation results showing its superiority over the heteroscedasticity-consistent standard error estimators summarized by Long & Ervin (2000).

Please read the download instructions at the top of this page.

SAS Version

Documentation: See Appendix B of the article.

Macro: hetreg.sas

ALPHAMAX

This paper describes an SPSS and SAS macro that generates all possible subscales of at least two items from an additive scale containing

This paper describes an SPSS and SAS macro that generates all possible subscales of at least two items from an additive scale containing

*k*items. For each possible subscale, it generates Cronbach’s alpha and the subscale-full scale correlation and displays information about each subscale in a data spread sheet. It also generates summary statistics making it easy to find the most psychometrically appealing subscale in the set as well as some item analysis statistics useful for scale construction. To download the SPSS macro, click here. For the SAS version, click here. See the paper for instructions on the use of the macro.

__MCMED__This macro, available for SPSS and SAS, constructs a Monte Carlo confidence interval for the indirect effect in statistical mediation analysis. Its use is described in Chapter 4 and Appendix B of Introduction to Mediation, Moderation, and Conditional Process Analysis. You can obtain MCMED by downloading the PROCESS zip archive on the web page for this book.