*“I'd like to mean center a lot of variables in order to compute interaction terms for a regression analysis. Is there an easy way to do this for many variables simultaneously?”*

## Mean Centering - What and Why

- This tutorial focuses on
*mean centering variables in SPSS*. However, we'll briefly introduce the concept first. - Mean centering a variable means subtracting its (arithmetic) mean from all its values.
- The result is that a mean centered variable has a mean of exactly zero. (Apart from that, its frequency distribution does not change.)
- Note that mean centering is also one of the two steps in
**standardizing**variables (computing their z-scores). - Mean centering without fully standardizing variables is usually done before computing
**interaction terms**in regression analysis. - Doing so decreases
**multicollinearity**between an interaction term and its corresponding main effects. It may also facilitate the**interpretation**of regression coefficients for the interaction terms.

## SPSS Mean Center Tool

SPSS Mean Center Variables Tool- Make sure you have the SPSS Python Essentials installed.
- Download and install Mean Center Variables. Note this is an SPSS custom dialog.
- Go to . Fill in the names of the variables you’d like to mean center.
- By entering a
**prefix**, mean centered variables will be created as new variables in the active dataset. With the prefix left empty, the original variables will be overwritten by their mean centered counterparts. - Click syntax. and run the pasted
- As a quick check, you could run
`DESCRIPTIVES`

on the mean centered variables to confirm that they all have zero means. - Clicking the tool's button will take you to this tutorial. We very much appreciate your feedback on it.

## This tutorial has 37 comments

## By Ruben Geert van den Berg on February 24th, 2015

@Stephanie: the error message very much sounds as if Python is not running properly in SPSS. Did you run a tiny Python test program (such as the one proposed here succesfully yet?

## By Frank Webster on February 24th, 2015

What I am doing wrong? I can't get the custom dialog box to show the procedure. I have installed Python 2.7. I feel pretty stupid because nothing that I am reading is directing me toward this simple procedure. The truth is that I can write the syntax to construct the centered variables myself, I just wanted to try the program, but I can't even find it. What is a person to do?

## By Stephanie Van Horn on February 24th, 2015

I am running SPSS 21 and when I try to run the mean centering syntax I get the following error:

>Error # 6890. Command name: begin program

>Configuration file spssdxcfg.ini is invalid.

>Execution of this command stops.

Configration file spssdxcfg.ini is invalid because the LIB_NAME is NULL.

Any help would be much appreciated! Thank you!

## By Stephanie on February 4th, 2015

It's working!!! Thank you so much!!

## By Ruben Geert van den Berg on February 4th, 2015

I rewrote the syntax from scratch. In the new version, the prefix is mandatory but you don't want to overwrite your variables anyway. It detects and excludes any string variables that are specified so that's a big plus. Hope you like it.