PROCESS Syntax for Moderation, Mediation and Moderated Mediation:

Running Hayes' PROCESS-macro (Version 3) with SPSS Syntax

Arndt Regorz, Dipl. Kfm. & M.Sc. Psychologie, 09/20/2019

This tutorial will show you the main options you have when you are running PROCESS with SPSS syntax.

There are two primary reasons for running it by syntax (and not from the PROCESS dialog in SPSS):
a) To better document the steps of your analysis
b) To use additional options that are not available from the dialog

I have not included all possible options but only the most important syntax commands. There are a few more, e.g. for programming your own model templates (you are not limited to the preprogrammed ones). The full options list is part of Hayes' excellent book Introduction to mediation, moderation, and conditional process analysis: A regression-based approach (2017).


  1. Video tutorial
  2. A few basics
  3. Additional syntax parameters in general (moderation or mediation)
  4. Syntax parameters for models with moderation
  5. Syntax parameters for mediation models
  6. References

1. Video Tutorial

Here you can find a video tutorial about the main syntax options for Hayes' PROCESS macro for SPSS:

(Note: When you click on this video you are using a service offered by YouTube.)

2. A few basics

Initializing PROCESS 3

In order to run PROCESS from SPSS syntax it has to be initialized in each session you are using it.

To do that you open the syntax file process.sps (which you get on downloading PROCESS) and run it.

Do not use the word „process“ anywhere else in the syntax

If I write the following comment after initializing PROCESS:
*testing process model 1.
I get an error message even though the SPSS editor recognizes this line as a comment (it is shown in light grey):

Therefore: if you want to use the word „process“ in your comments insert a blank after each character, then it should work:
*testing p r o c e s s model 1.

Core PROCESS syntax

In order to run a PROCESS model you need to include the variables and the number of the model, at least.


Simple moderation
process y=health /x=stress /w=gender /model=1.

Simple mediation
process y=prejudice /x=contact /m=intergroup_anxiety /model=4.

Moderated Mediation (here with moderation of the a-path)
process y=prejudice /x=contact /m=intergroup_anxiety /w= ideological_climate /model=7.

All models contain y and x. Which other variables you have to include depends on the model you are testing.

Regarding the variable names: PROCESS allows longer variable names but internally only uses the first eight characters. So you should make sure that all variables you use differ somewhere on the first eight characters.

You can find the most common model templates with their numbers here:
The most important PROCESS 3 model templates
A full list is contained in Hayes (2017).


All additional options start with a slash, then the parameter follows with an equal sign, and the value of the parameter, in most cases a number. Only in front of the first parameter, y=..., there is no slash.





And at the end of the process command (and only there) after the last parameter there has to be a period.

3. Additional syntax parameters in general (moderation or mediation)

Covariates: /cov

If you want to add covariates to your model you can use /cov =..., followed by one or more covariates.

/cov = age gender

Confidence intervals: /conf

By default, 95% two-sided confidence intervals are calculated. If you want to test on a different confidence level (e.g. because of a correction for multiple testing) you can adjust this with /conf=..., followed by the confidence level.

/conf = 99.5

Number of bootstrap samples: /boot

By default, for models with bootstrapping the number of bootstrap samples is 5,000. You can change this with /boot=..., followed by the number of samples you request.

/boot = 10000

Bootstrapping - start value for the random number generator: /seed

Bootstrapping has a random component. Based on SPSS' random number generator random samples are drawn from your sample with replacement. Therefore, if you repeatedly run an analysis with bootstrapping you will get slightly different results (SE, p-values, confidence intervals) each time. If you want to get the same results each time you are running the analysis you can give the random number generator a start value with /seed..., followed by an integer number between 1 and 2,000,000,000.


Bootstrapping not only for indirect effects: /modelbt

By default, PROCESS bootstraps the indirect effects (mediation and moderated mediation). For those effects you get robust confidence intervals. If you want to get robust confidence intervals for the rest of the estimates you can do that with the command /modelbt =1.

/modelbt = 1

Robust standard errors for heteroscedasticity: /hc

PROCESS is based on multiple regression which has as an assumption the homoscedasticity of the residuals. If you want to run an analysis that is robust against violations of homocedasticity, you can use the command /hc=...., followed by 0, 1, 2, 3, or 4 (depending on the method you want to use, HC0, HC1, HC2, HC3, or HC4). I tend to use HC3 or HC4.

/hc = 4

Decimal place precision in the output: /decimals

By default you get four decimals in the output, based on the parameter value F10.4. If you change the last number of this parameter you can change the decimal place precision.

Example (for three decimals):

Categorial predictor or moderator: /mcx /mcw /mcz

Dependent variable and mediator have to be on a metric scale for PROCESS. But independent variable or a moderator can be categorical variables. If those variables are binary (e.g. sex) you can run the normal model. If, however, one of those categorical variables has three or more levels you have to code those by dummy variables or related coding schemes. For this you use the commands /mcx=... (or for the moderators /mcw=...for the moderator W or /mcz=... for the Moderator Z). Depending on the parameter you use you get different coding schemes:

= 1: Dummy coding
With dummy coding the lowest value of the variable represents the reference category. The dummy variables represent the difference to the reference group, e.g. with four groups (group variable: 1, 2, 3, 4):

D1: group 2 compared to group 1
D2: group 3 compared to group 1
D3: group 4 compared to group 1

= 2: Sequential coding
With sequential coding each group is compared to the group with one level less, e.g. with four groups (group variable: 1, 2, 3, 4):

D1: group 2 compared to group 1
D2: group 3 compared to group 2
D3: group 4 compared to group 3

= 3: Helmert coding
Helmert is an orthogonal contrast coding scheme. It compares the mean of each level (except the last one) against the subsequent levels, e.g. with four groups (group variable: 1, 2, 3, 4):

D1: group 1 compared to groups 2,3,4
D2: group 2 compared to groups 3,4
D3: group 3 compared to group 4

= 4: Effect coding
This can be useful if all groups have the same size. In that case the variables represent the difference to the mean for all groups, e.g. with four groups (group variable: 1, 2, 3, 4):

D1: group 2 compared to all groups
D2: group 3 compared to all groups
D3: group 4 compared to all groups


/mcx = 2
(categorical independent variable with sequential coding)

/mcw =1
(categorical moderator W with dummy coding)

Enabling long variable names: /longname

PROCESS works only with the first eight characters of a variable name. So it discourages the use of longer variables. Since Version 3.5 you have to set this parameter to 1 if you call PROCESS with names longer than eight characters.

But please be careful: Using it you can run analyses with longer names but PROCESS still only looks at the first eight characters!

/longname =1

4. Syntax parameters for models with moderation

The following parameters can be used for moderation models and for the moderation components of moderated mediations.

Mean centering: /center

In a moderation analysis the interpretation of the regression weights is easier if you mean center the moderator (and maybe the independent variable, too). If you use the option /center...., followed by 1 all variables that go into interaction terms (IV and moderator) are mean centered. If you choose 2 instead only continous variables are mean centered (starting with PROCESS version 3.4).

/center = 1

Plotting interactions: /plot

If you have a significant interaction it is helpful to plot simple slopes (i.e. regression slopes for different values of the moderator). For this you use the option /plot..., followed by 1.

/plot = 1

Deciding when to probe interactions: /intprobe

By default, PROCESS probes interactions (by testing simple slopes) if their p-value is below .10. You can change this cut off value with /intprobe..., followed by the alpha-level of your choice. If you choose 1 interactions will be followed up regardless of the outcome.

/intprobe = .05

Changing the values for interaction plots and probes: /moments

By default, interaction plots and probes are calculated for the median, the 16th and the 84th quantile. You can change this to – 1 SD, mean, + 1 SD instead (which I prefer) with /moments..., followed by 1.

/moments = 1

Significance regions Johnson-Neyman: /jn

To get significance regions (Johnson-Neyman) you set the parameter /jn to 1.

/jn = 1

5. Syntax parameters for mediation models

Effect size: /effsize

If you run a mediation model you can calculate effect sizes (partially standardizes and fully standardizes indirect effects) with /effsize..., followed by 1.

/effsize =1

Total effect: /total

If you run a mediation model you can test the total effect (= c-path) with /total..., followed by 1.

/total =1

Sobel-Test in PROCESS: /normal

You can run a Sobel-test with /normal..., followed by 1.

/normal = 1

Comparing indirect effects: /contrast

If you run a model with parallel mediation paths (e.g. model 4) you can compare those paths with /contrast..., followed by 1 or 2. If you use 1 you get a test for the difference between their regression weights, if you use 2 you get a test for the difference of the absolute values of their regression weights. The second value can be useful if you want to compare one positive indirect effect to a negative one in order to assess whether the positive one is (in absolute terms) significantly larger than the negative one.

/contrast =1

Standardized effects: /stand

Starting with Version 3.2 you can get standardizes effects for all the regression paths by setting /stand to 1. This only works in models without moderation.

/stand =1

6. References

Hayes, A. F. (2017). Introduction to mediation, moderation, and conditional process analysis: A regression-based approach. New York, NY: Guilford Publications.

Hayes, A. F. (n.d.). PROCESS (Computer Software). Retrieved from

Additional tutorials about the PROCESS macro in general