Dummy Variables and Moderator Variables in Regression with PSPP (SPSS)
Code dummy variables, avoid the dummy variable trap and test a moderator with mean centering and simple slopes in PSPP or SPSS
Key takeaways
A categorical variable with k groups needs k - 1 dummy variables, and each dummy coefficient is a difference in means from the reference group.
Unlike SPSS, PSPP 2.1.2 does not catch the dummy variable trap: it prints NaN, a Tolerance of zero and extreme VIF values.
Adding occupation and gender as control variables raises R² by only 0.005 (p = .793), so the main effects of PV, SAT and TRU are robust.
Mean centering cuts the VIF of the product term from 48.56 to the range 1.10 to 1.67 without changing its test (B = -0.02, p = .677).
A non-significant moderator is not proof of a zero effect: read the confidence interval, remember that interaction tests have low power and do not go fishing for moderators.
Two questions come up often after you have run the regression model of Post 14, "Multiple Linear Regression in PSPP (SPSS)". First: how do you put occupation or gender into a regression, when the codes 1, 2, 3, 4 are only labels and not numbers? Second: is the effect of Satisfaction on Repurchase intention the same for every customer, or is it stronger among people who trust Marketplace X?
The first question is solved with dummy variables. The second is tested with a moderator variable. This post shows both on the sample data set (marketplace_x_analysis.sav), with real results from the syntax file dummy_moderation.sps from the GitHub repository of this post (Free Software Foundation, 2026). The results have one notable feature: neither the dummy variables nor the moderator is significant. The post uses exactly this result to show how to read and report a finding of "no effect" correctly, a situation that is very common but rarely explained.
Sample data and scripts. The data files and scripts for this post are in the research-data-analysis repository on GitHub (folder
data/andscripts/). Download the whole repository with Code > Download ZIP.
About the output. Figures 2, 3, 4 and 6 are cropped from the PSPP 2.1.2 Output Viewer on macOS, exported to PDF on 19 November 2026 after running
dummy_moderation.sps(in thescripts/folder of the repository) onmarketplace_x_analysis.sav(in thedata/folder). The table in Figure 6 that runs over two pages of the export is joined; no value is changed. Because the data file has variable labels, PSPP prints labels such as "Office worker (vs Student)" or "Satisfaction (mean of SAT1-SAT4)" instead of the variable names. Figures 1 and 5 are diagrams, and Figure 7 is drawn with Python from the same data. A few numbers that the syntax does not print (marked in the text) come from the scriptsupplement.py; its output is inscripts/supplement_output.txt. The complete PSPP output is inraw/post16-output.pdfin the same repository folder.
1. Dummy variables: putting a categorical variable into a regression
Why not put OCCUP straight into the regression?
The variable OCCUP is coded 1 = Student, 2 = Office worker, 3 = Self-employed, 4 = Other. If you put OCCUP straight into a regression, the software treats it as a quantitative variable and estimates one coefficient. That coefficient assumes that "Self-employed" is above "Office worker" by exactly the same distance as "Office worker" is above "Student". This makes no sense for a nominal variable: change the order of the codes and you get a completely different result.
Code the dummy variables
The correct way is to create dummy variables that take the value 0 or 1. A variable with k groups needs k - 1 dummies (Cohen et al., 2003; Hardy, 1993). The group that has no dummy of its own (all zeros) is the reference group.

In PSPP, use the RECODE ... INTO command as in Post 10, "Recoding Variables and Computing Composite Scores in PSPP (SPSS)" (menu Transform > Recode into Different Variables):
RECODE OCCUP (2=1) (1,3,4=0) (MISSING=SYSMIS) INTO D_OFFICE.
RECODE OCCUP (3=1) (1,2,4=0) (MISSING=SYSMIS) INTO D_SELFEMP.
RECODE OCCUP (4=1) (1,2,3=0) (MISSING=SYSMIS) INTO D_OTHER.(MISSING=SYSMIS) keeps respondents who did not answer the occupation question as missing on all three dummies, instead of putting them in the reference group. (In the sample data all 267 respondents answered it, so the clause changes nothing here, but it protects you with other data.) After creating the dummies, check them with a table of the mean of each dummy by the original groups:
MEANS TABLES=D_OFFICE D_SELFEMP D_OTHER BY OCCUP /CELLS=MEAN COUNT.
Choose the reference group
The reference group does not change R² or the predictions, but it decides what the coefficients are compared with. Three rules for choosing it:
A group that makes sense as a comparison for the research question. For example, if you want to know how working people differ from students, choose Student.
A large enough group. A small reference group gives every coefficient a large standard error. Avoid choosing "Other".
Not a vaguely defined group. "Other" contains many different occupations, so comparisons with it are hard to interpret.
For gender, the syntax file creates the dummy D_FEMALE (Female = 1, Male = 0) and sets the gender group "Other" to missing, because this group has only 5 respondents in the full sample of 267 (Post 9, "Descriptive Statistics in PSPP (SPSS)"; 4 of them are among the 263 complete responses used in the regressions), too few to estimate a reliable coefficient. This is a decision you should state clearly in the report.
2. Regression with dummy variables
A dummy coefficient is a difference in means
Run the regression of RI on the three occupation dummies only:
REGRESSION /VARIABLES=D_OFFICE D_SELFEMP D_OTHER /DEPENDENT=RI /METHOD=ENTER
/STATISTICS=COEFF R ANOVA.
Compare the two tables to see what each coefficient means:
Constant = 3.84 is the mean RI of the reference group (Student).
B of D_OFFICE = 0.08 is the difference between Office workers (3.92) and Students (3.84).
B of D_SELFEMP = -0.02 and B of D_OTHER = -0.05 are the differences between the other two groups and Students.
None of the differences is significant (p from .447 to .874), and the whole model explains only 0.5% of the variance in RI (F(3, 261) = 0.40, p = .751; R² = 0.65 / 140.25 = 0.005 from the ANOVA table, which PSPP prints as .00). A regression with dummy variables only is the same as a one-way ANOVA: Post 18, "One-Way ANOVA in PSPP (SPSS) and Post-Hoc Tests" gives this same result.
The dummy variable trap
What happens if you create all four dummies, including D_STUDENT, and enter them all in a model with a constant? The four dummies always add up to 1, exactly like the constant. This is perfect multicollinearity, called the dummy variable trap, and the model cannot be estimated.
SPSS detects this and drops one variable automatically. PSPP does not (this was true in PSPP 2.0 and is still true in PSPP 2.1.2, used here): the command runs and prints meaningless numbers.

If you see NaN, a Tolerance of zero (or a tiny negative number) or an extreme VIF in PSPP output, check whether one variable is an exact linear combination of the others.
Dummy variables as control variables
The most common use of dummy variables in a thesis is as control variables: add demographic characteristics to Model 2 of Post 14 to see whether the main results change. The syntax file runs both models on the same 259 responses that have complete information (Table 1).
Note: the model without controls is run with /STATISTICS=R ANOVA only, so its Beta values come from supplement.py. The R² values are computed from the ANOVA tables (43.59 / 135.07 and 44.20 / 135.07), because PSPP prints R Square with two decimals.
Adding the four control variables raises R² by only 0.005 (F(4, 250) = 0.42, p = .793, computed by supplement.py), and the main coefficients hardly change. Conclusion: the effects of PV, SAT and TRU are not due to differences in the occupation or gender of the respondents. This is evidence of the robustness of the results and should be reported together with the main model.
3. Moderator variables
The concept
A moderator W changes the strength or direction of the effect of X on Y (Baron & Kenny, 1986). Unlike a mediator (which lies between X and Y on the causal path), a moderator acts on the relationship itself between X and Y. In a diagram, it is an arrow pointing at an arrow.

This post tests an exploratory hypothesis: customers who trust Marketplace X more turn satisfaction into repurchase intention more strongly, because they worry less about risk in their next purchases. This hypothesis is not part of the original research model; it is set up to illustrate the method.
Test it with a product term
A moderating effect is tested by adding the product term X x W to the equation (Aiken & West, 1991):
RI = B0 + B1 SAT + B2 TRU + B3 (SAT x TRU) + other variables
Rearranged: RI = B0 + (B1 + B3 TRU) x SAT + ... The slope of SAT is now B1 + B3 TRU, which changes with TRU. If B3 is significantly different from 0, there is a moderating effect.
Mean-center before multiplying
Before you create the product term, you should mean-center the variables: subtract their mean.
AGGREGATE /OUTFILE=* MODE=ADDVARIABLES /M_SAT = MEAN(SAT) /M_TRU = MEAN(TRU)
/M_CONF = MEAN(CONF) /M_PV = MEAN(PV) /SD_TRU = SD(TRU).
COMPUTE SAT_C = SAT - M_SAT.
COMPUTE TRU_C = TRU - M_TRU.
COMPUTE CONF_C = CONF - M_CONF.
COMPUTE PV_C = PV - M_PV.
COMPUTE SATxTRU = SAT_C * TRU_C.To show why, the syntax file runs it both ways:

Comparing the two tables gives three lessons:
The VIF drops sharply. Without centering, SAT x TRU correlates very highly with SAT and TRU, because all values are positive (1 to 5). This is "nonessential" multicollinearity, created by where the origin of the scale lies.
The test of the product term does not change. The coefficient -0.02, t = -0.42 and p = .677 are identical. Echambadi and Hess (2007) show that mean centering does not change the conclusion about the moderating effect. Its main benefit is easier interpretation.
The coefficients of SAT and TRU change meaning. With a product term in the model, B1 is the effect of SAT when TRU = 0. With uncentered variables, TRU = 0 lies outside the 1-5 scale, so B1 = 0.30 (p = .193) describes a situation that does not exist. After centering, TRU_C = 0 means Trust at its average level, and B1 = 0.21 (p = .001) is the effect of SAT for a customer with average trust.
Test results
The syntax runs the two blocks as two separate REGRESSION commands on the same 263 responses (see Post 14 for how to compare blocks in PSPP). Table 2 shows the change in R².
The product term has B = -0.02, 95% CI [-0.13, 0.09], t = -0.42, p = .677. There is no moderating effect: Trust does not change the effect of Satisfaction on Repurchase intention.
4. Simple slopes
When there is a moderating effect, the next step is to compute simple slopes: the effect of SAT at different levels of TRU, usually low (-1 SD), average and high (+1 SD). Although the result here is not significant, the post still shows this technique because you need it when you do find a moderating effect.
In SPSS this is usually done automatically with Hayes's (2022) PROCESS macro. PSPP cannot run PROCESS, but you can do it by hand following Aiken and West (1991): move the origin of TRU to the level of interest and run the regression again. The coefficient of SAT_C is then the slope of SAT at that level of TRU.
COMPUTE TRU_LOW = TRU_C + SD_TRU.
COMPUTE SATxTRU_LOW = SAT_C * TRU_LOW.
REGRESSION /VARIABLES=CONF_C PV_C SAT_C TRU_LOW SATxTRU_LOW /DEPENDENT=RI /METHOD=ENTER
/STATISTICS=COEFF CI(95).Adding the SD to TRU_C looks backwards, but it is correct: the new variable TRU_LOW equals 0 when TRU_C = -SD, that is, when trust is one standard deviation below average. In the same way, TRU_HIGH = TRU_C - SD_TRU. Table 3 gives the three slopes.

The three slopes are nearly equal and their confidence intervals overlap almost completely, which visualizes the conclusion "no moderating effect". When there is a real moderating effect, the lines have clearly different slopes and may cross. This plot should always accompany the report of a significant moderating effect (Dawson, 2014).
5. Read a non-significant result correctly
A result of "no moderating effect" needs careful interpretation:
Not significant does not mean zero. The confidence interval [-0.13, 0.09] shows that a moderating effect, if there is one, is small. The data are not enough to claim that there is no effect at all.
Interaction tests have low statistical power. McClelland and Judd (1993) show that field studies usually need much larger samples to detect interaction effects than main effects. Aguinis et al. (2005) reviewed 30 years of research and found that the typical effect size of moderating effects is very small. With 263 responses, this study only has enough power to detect a fairly large moderating effect.
Do not go "fishing" for moderators. While preparing this post, I tried a few other moderators. One of them (age) gave p = .073 (
supplement.py). If you try 20 moderators, on average 1 will be "significant" at the .05 level purely by chance. Moderators must be proposed beforehand from theory. If you test several, report all of them and adjust the significance level (for example, Bonferroni: .05 divided by the number of tests).
6. Present the results in a report
Sample paragraph for control variables: "To check the robustness of the results, occupation (three dummy variables, with students as the reference group) and gender (female = 1, male = 0; the 4 respondents among the 263 complete responses who chose another gender were excluded from this analysis) were added to Model 2 as control variables. The control variables had no significant effect (R² change = 0.005; F(4, 250) = 0.42; p = .793), and the coefficients of the main variables hardly changed."
Sample paragraph for a moderator: "The moderating effect of Trust on the relationship between Satisfaction and Repurchase intention was tested with a regression including a product term, after mean-centering the variables. The coefficient of the product term was not significant (B = -0.02; 95% CI [-0.13, 0.09]; p = .677; R² change < 0.001). The effect of Satisfaction was of similar size at low (B = 0.23), average (B = 0.21) and high (B = 0.19) levels of Trust. The data therefore do not support a moderating role of Trust."
Five common mistakes
Entering a nominal variable into a regression as if it were quantitative, for example entering OCCUP with its codes 1-4 directly.
Falling into the dummy variable trap by creating k dummies for k groups. PSPP does not stop this error; it prints meaningless numbers.
Interpreting the main coefficients as the "overall effect" when the model has a product term, while each is the effect at the zero point of the moderator.
Reporting only the product-term coefficient without plotting simple slopes when you find a moderating effect.
Trying many moderators and reporting only the significant one.
Frequently asked questions
What if the moderator is categorical (for example gender)?
The procedure is the same, with the dummy D_FEMALE instead of a quantitative variable: the product term is SAT_C x D_FEMALE. The coefficient of SAT_C is then the effect of SAT in the reference group (Male), and the coefficient of the product term is the difference in the effect between women and men. In the sample data the moderating effect of gender is not significant either (p = .266, supplement.py).
Should I mean-center the dependent variable?
No. You only need to center the variables that enter the product term (and possibly the quantitative control variables, so that the constant is easy to interpret). The dependent variable stays as it is.
How is moderation tested differently in SmartPLS and AMOS?
SmartPLS has a built-in function that creates an interaction term between two latent variables (Post 41, "Moderation Analysis in SmartPLS 4"). AMOS usually uses multigroup analysis for a categorical moderator. Their advantage is that they take measurement error into account, which otherwise makes the interaction coefficient in ordinary regression underestimated.
References
Aguinis, H., Beaty, J. C., Boik, R. J., & Pierce, C. A. (2005). Effect size and power in assessing moderating effects of categorical variables using multiple regression: A 30-year review. Journal of Applied Psychology, 90(1), 94–107. https://doi.org/10.1037/0021-9010.90.1.94
Aiken, L. S., & West, S. G. (1991). Multiple regression: Testing and interpreting interactions. SAGE Publications.
Baron, R. M., & Kenny, D. A. (1986). The moderator–mediator variable distinction in social psychological research: Conceptual, strategic, and statistical considerations. Journal of Personality and Social Psychology, 51(6), 1173–1182. https://doi.org/10.1037/0022-3514.51.6.1173
Cohen, J., Cohen, P., West, S. G., & Aiken, L. S. (2003). Applied multiple regression/correlation analysis for the behavioral sciences (3rd ed.). Lawrence Erlbaum Associates.
Dawson, J. F. (2014). Moderation in management research: What, why, when, and how. Journal of Business and Psychology, 29(1), 1–19. https://doi.org/10.1007/s10869-013-9308-7
Echambadi, R., & Hess, J. D. (2007). Mean-centering does not alleviate collinearity problems in moderated multiple regression models. Marketing Science, 26(3), 438–445. https://doi.org/10.1287/mksc.1060.0263
Free Software Foundation. (2026). GNU PSPP (Version 2.1.2) [Computer software]. https://www.gnu.org/software/pspp/
Hardy, M. A. (1993). Regression with dummy variables. SAGE Publications.
Hayes, A. F. (2022). Introduction to mediation, moderation, and conditional process analysis: A regression-based approach (3rd ed.). Guilford Press.
McClelland, G. H., & Judd, C. M. (1993). Statistical difficulties of detecting interactions and moderator effects. Psychological Bulletin, 114(2), 376–390. https://doi.org/10.1037/0033-2909.114.2.376


Discussion about this post