SPSS, SAS, and R Macros and Code (2024)

My Macros and Code for SPSS, SAS, and R

SPSS, SAS, and R Macros and Code (1)

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.

PROCESS
Hayes, A. F. (2022). Introduction to mediation, moderation, and conditional process analysis: A regression-based approach (3rd edition). New York: The Guilford Press.

PROCESS is a macro for SPSS, SAS, and R that conducts observed-variable mediation, moderation, and conditional process analysis. It is documented in Appendices A and B of Hayes (2022).

PROCESS can be found at
www.processmacro.org

MEDYAD

Coutts, J., Hayes, A. F., & Jiang, T. (2019). Easy statistical mediation analysis with distinguishable dyadic data. Journal of Communication, 69, 612-549.[PDF]

MEDYAD is an easy-to-use regression-based computational tool for SPSS, SAS, and R that conducts mediation analysis with distinguishable dyadic data. In its most general form, it implements the Actor-Partner Independence Model extended to Mediation (APIMeM), but it is capable of simpler and more complex variants of the basic APIMeM. MEDYAD estimates the direct and indirect effects of each actor’s X on their own and their partner’s Y through their own and their partner’s mediator M. Options are available for conducting all possible pairwise comparisons between indirect effects that can be constructed linking an X to a Y through an M. Bootstrapping methods are available for inference about indirect effects and differences between them. MEDYAD allows up to twelve mediators (up to six measured on each member of the dyad, or twelve if each mediator measures an aspect of the relationship or a single member of the dyad) and can conduct contrasts between indirect effects within and between dyads and between and within mediators. MEDYAD also allows for the specification of an X or Y that measures a property of the dyad rather than of the individual member of the dyad. Numerous additional options are available, including options for controlling for covariates and saving bootstrap estimates of effects for further analysis.

Download MEDYAD from Jacob's web page.

OMEGA

Hayes, A. F., & Coutts, J. J. (2020). Use omega rather than Cronbach's alpha for estimating reliability. But... Communication Methods and Measures, 14, 1-24. [PDF]

Cronbach's alpha is the most widely-used measure of reliability when estimating the amount of random measurement error that exists in a sum score or average generated by a multi-item measurement scale. Yet methodologists have warned that a is not an optimal measure of reliability relative to its more general form, McDonald's omega. Hindering its more widespread adoption is the fact that the computation of omega heretofore has required the estimation of item factor loadings and error variances in a confirmatory factor analysis (CFA). Omega is an easy-to use macro for SPSS and SAS that calculates McDonald's omega without relying on the estimation of factor loadings or error variances using CFA. The OMEGA macro alsogenerates all possible subscales of at least three items from an additive scale containingkitems.For each possible subscale, it generates omega 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 brief form of a longer measurement instrument. Most of the features available for omega are also available for Cronbach's alpha, which the OMEGA macro can also generate.

Download OMEGA here: omega.zip


(Note: The archive also contains the "blirt" data files mentioned in the paper)

MEMORE

(

ME

diation and

MO

deration in

RE

peated-measures designs)

Montoya, A. K., & Hayes, A. F. (2017). Two condition within-participant statistical mediation analysis: A path-analytic framework. Psychological Methods, 22, 6-27. [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, it implements the method described by Judd, Kenny, and McClelland (2001, Psychological Methods), extended 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.

Download MEMORE from Amanda Montoya's web page.

If you have questions about the use of MEMORE, email Amanda Montoya at UCLA (

akmontoya@psych.ucla.edu)

RLM
Darlington, R. B. & Hayes, A. F. (2017). Regression analysis and linear models: Concepts, application, and implementation. New York: The Guilford Press [purchase]

The RLM macro was released with the publication of Regression Analysis and Linear Models in the summer of 2016. It can be downloaded from the book's web page and 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, HC3, or HC4 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.

MLMED
Rockwood, N. J.& Hayes, A. F. (2017, May). MLmed: An SPSS macro for multilevel mediation and conditional process analysis. Poster presented at the annual meeting of the Association of Psychological Science (APS), Boston, MA. [PDF]

Hayes, A. F., & Rockwood, N. J. (2020). Conditional process analysis: Concepts, computation, and advances in the modeling of the contingencies of mechanisms. American Behavioral Scientist[PDF]

MLMED is an SPSS macro that conducts multilevel mediation and conditional process analysis. You can learn about MLMED by downloading the documentation and Nick Rockwood's MA thesis at www.njrockwood.com. MLMED and multilevel mediation and conditional process analysis is also discussed in Hayes and Rockwood (2020).

Download MLMED from Nick Rockwood's web page.

If you have questions about the use of MLMED, email Nick Rockwood at nrockwood@llu.edu

OGRS
Hayes, A. F., & Montoya, A. K. (2017). A tutorial on estimating, visualizing and probing an interaction involving a multicategorical independent variable in linear regression analysis. Communication Methods and Measures, 11, 1-30 [PDF]

OGRS (Omnibus Groups Regions of Significance) is a macro for SPSS and SAS that implements the Johnson-Neyman technique(via iterative approximation) for probing an interaction when the independent variable is multicategorical (i.e., three or more groups) and the moderator is continuous. It was written by Amanda Montoya and is described, tested, and documented in Montoya (2016). The paper referenced above illustrates its use.

Download OGRS from Amanda Montoya's web page.

If you have questions about the use of OGRS, email Amanda Montoya at UCLA (akmontoya@psych.ucla.edu)

INDIRECT, SOBEL, MEDIATE, MODMED, and MODPROBE

These macros are all obsolete with the release of PROCESS, which can do pretty much everything that these five macros can do and a whole lot more. PROCESS can be found at www.processmacro.org and is documented in Introduction to Mediation, Moderation, and Conditional Process Analysis

If you still want to use one of these macros, they can be downloaded in one archive right here. The archive contains five folders, one for each macro. I no longer support or respond to questions about these macros.

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.

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 Hayes (2022).

HCREG

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.

New to HCREG in November 2019: Newey-West standard errors!

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, HC4, and Newey-West procedures as described by MacKinnon and White (1985), Long and Ervin (2000), and Cribari-Neto (2004).

NOTE: This macro is mostly obsolete with the release of RLM, which is available for both SPSS and SAS and implements the HC0, HC1, HC2, HC3, and HC4 standard error estimators discussed in this article. RLM is documented in Darlington and Hayes (2017). Unlike HCREG, RLM can also estimate and probe interactions involving a multicategorical variable.

Download HCREG: hcreg.zip
Documentation: see the Appendix of the article

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.

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 hom*oscedasticity. The paper includes some simulation results showing its superiority over the heteroscedasticity-consistent standard error estimators summarized by Long & Ervin (2000).

Documentation: See Appendix B of the article.
Macro: hetreg.sas

SPSS, SAS, and R Macros and Code (2024)

FAQs

What is the difference between R SAS and SPSS? ›

SPSS and SAS are commercial software, while R is free and open source. R is flexible and easy to understand, and there are millions of free resources in the internet. Once you learn how to use R, you will not want to use SPSS or SAS. So I think everyone should start with R.

What is SPSS and SAS? ›

SPSS stands for “Statistical Package for Social Science”. SAS stands for “Statistical Analysis System”. Developed. It was developed by IBM in 1968. It was developed by SAS Inc in North Carolina University from 1966 to 1976.

Is SAS harder than SPSS? ›

SAS has a steeper learning curve due to its code-based nature, while SPSS has a menu-driven interface that is easier to use for basic tasks. SPSS is known for its user-friendly interface and is designed for users who may not have advanced statistical or programming skills.

Does R have macros like SAS? ›

Although you cannot use macros in R, R offers other features like functions and loops that can perform the same tasks as SAS macros.

Does SPSS require coding? ›

Prepare and analyze data with an easy-to-use interface without having to write code. Choose from purchase options including subscription and traditional licenses.

What programming language does SPSS use? ›

IBM® SPSS® Statistics provides an interface for programming with the R language on Windows®, Linux®, macOS, and for IBM SPSS Statistics Server. Use of the interface requires the IBM SPSS Statistics - Integration Plug-in for R, which is installed by default with your IBM SPSS Statistics product.

Is SPSS similar to Excel? ›

Much more sophisticated data visualisation in SPSS

Excel includes some basic charting options but SPSS's data visualisation capabilities are far superior. With SPSS, you can create a huge range of visually appealing and informative charts, graphs, and plots that help you present your findings more effectively.

Is SPSS similar to Python? ›

Ease of Learning: SPSS is easier to learn for beginners due to its graphical interface, while Python requires some programming knowledge. However, Python's learning curve can provide greater rewards in terms of versatility.

Which is better, R or SPSS? ›

If you're a beginner or need to perform basic statistical analyses, SPSS may be a better choice. If you need more flexibility, customization, or advanced statistical tools, R may be a better choice.

Is it better to learn SAS or R? ›

SAS is better equipped to manage large amounts of data than R because it processes data faster and smoother and is more secure. R is less efficient because it uses random access memory (RAM) to compute all of its data.

Is SAS coding easy? ›

SAS is not difficult to learn and supplies simple choice (PROC SQL) for individuals who already understand SQL.

Why is SAS outdated? ›

Outdated Syntax: One of the major drawbacks of SAS is its outdated syntax. The language relies on cumbersome and verbose statements that make it time-consuming to read and write code.

Which is better SAS R or Python? ›

New software developers widely use Python, as it is not that difficult. At the same time, R is also equally suitable for early and advanced data science learners. Sas is a highly advanced programming tool that requires expertise. It is also very expensive and mostly owned by big organisations.

Can SAS run R code? ›

SAS can pass data to an R session, and ask R for an analysis. All communication with R is done via SAS's PROC IML .

What are macros in R? ›

A macro is similar to a function definition except for handling of formal arguments. In a function, formal arguments are simply variables that contains the result of evaluating the expressions provided to the function call.

What is the difference between R and SPSS? ›

R and SPSS are the two industry-leading technologies for statistical data analysis. R is an open-source programming language widely used as the preferred option for analytics. Whereas SPSS is known as Statistical Package for social science, owned by IBM.

What is the difference between R and SAS statistics? ›

SAS is better equipped to manage large amounts of data than R because it processes data faster and smoother and is more secure. R is less efficient because it uses random access memory (RAM) to compute all of its data.

What is SPSS best used for? ›

This software can be used for many things in business, education, health care, and the social sciences, such as data analysis, data mining, research, and data presentation. It can also be used to analyze data in survey research and marketing research.

What is the equivalent of SAS in R? ›

There are three different structures in R that store data and are somewhat similar to SAS datasets. They are regular data frames, data tables, and tibbles. Data frame is the most popular of these and most R packages use it. In fact, this is a two-dimensional list.

Top Articles
2005 Ford F-150 Truck: Latest Prices, Reviews, Specs, Photos and Incentives | Autoblog
2005 Ford F-150 for Sale Near Me
Mybranch Becu
Where are the Best Boxing Gyms in the UK? - JD Sports
Http://N14.Ultipro.com
Jennette Mccurdy And Joe Tmz Photos
Teamexpress Login
Kent And Pelczar Obituaries
Cosentyx® 75 mg Injektionslösung in einer Fertigspritze - PatientenInfo-Service
Fcs Teamehub
United Dual Complete Providers
Jet Ski Rental Conneaut Lake Pa
How Quickly Do I Lose My Bike Fitness?
Vichatter Gifs
2016 Hyundai Sonata Price, Value, Depreciation & Reviews | Kelley Blue Book
Jack Daniels Pop Tarts
Curtains - Cheap Ready Made Curtains - Deconovo UK
Conan Exiles Colored Crystal
Apne Tv Co Com
Snow Rider 3D Unblocked Wtf
Parentvue Clarkston
Shopmonsterus Reviews
Parc Soleil Drowning
Tips and Walkthrough: Candy Crush Level 9795
Haunted Mansion Showtimes Near Epic Theatres Of West Volusia
Sandals Travel Agent Login
Water Temperature Robert Moses
Pacman Video Guatemala
Democrat And Chronicle Obituaries For This Week
Abga Gestation Calculator
Lindy Kendra Scott Obituary
Play It Again Sports Forsyth Photos
Kristen Hanby Sister Name
Wcostream Attack On Titan
M3Gan Showtimes Near Cinemark North Hills And Xd
Domina Scarlett Ct
Craigslist Georgia Homes For Sale By Owner
Craigslist Mount Pocono
Sc Pick 4 Evening Archives
Trizzle Aarp
T&Cs | Hollywood Bowl
Exploring the Digital Marketplace: A Guide to Craigslist Miami
Wgu Admissions Login
Sara Carter Fox News Photos
Craigslist St Helens
Hello – Cornerstone Chapel
15:30 Est
M Life Insider
Craigslist Charlestown Indiana
Códigos SWIFT/BIC para bancos de USA
32 Easy Recipes That Start with Frozen Berries
Latest Posts
Article information

Author: Prof. An Powlowski

Last Updated:

Views: 6153

Rating: 4.3 / 5 (64 voted)

Reviews: 95% of readers found this page helpful

Author information

Name: Prof. An Powlowski

Birthday: 1992-09-29

Address: Apt. 994 8891 Orval Hill, Brittnyburgh, AZ 41023-0398

Phone: +26417467956738

Job: District Marketing Strategist

Hobby: Embroidery, Bodybuilding, Motor sports, Amateur radio, Wood carving, Whittling, Air sports

Introduction: My name is Prof. An Powlowski, I am a charming, helpful, attractive, good, graceful, thoughtful, vast person who loves writing and wants to share my knowledge and understanding with you.