SPSS Tips & Tricks #6 – Compute index

 In Tips & Tricks

Hi, today I will show you how you create an index, something that I talked about but not showed in the webinar about “measure the unmeasureable”.

Background: Example of an common index is “satisfaction index”.  It’s popular to create index from attitudes questions in a questionnaire. In the webinar I used the factor analysis as a method before the index should be created.

A rule says that you should use variables that are highly correlated to each other before you create an index. A smart way to effectively investigate the correlations is to use factor analysis (as in my webinar) but also you can validate the variables/questions you want to use in your index by testing the value of Cronbach’s alpha. If the value of Cronbach’s alpha is high (above 0.7) then you can be sure of a reliable index between the variables you would like to use in the index.

Demo: I would like to use these 4 variables in a “fast driver index” and I think the Cronbachs alpha is OK (it’s 0.69 so close to 0.7). These variables has a value between 1 and 5, where 5 is highly agree to the statement:


  1. It is annoying to drive behind a driver who is keeping the speed limit.
  2. It happens that I drive 30 km / h or more over the speed limit when traffic conditions permit it.
  3. I think it is OK to run a bit faster than the speed limit if you do it with reason.
  4. It is important to keep the flow of traffic than the speed limit.

If you have missing values in your data, I recommend you to use a mean value of these 4 variables so I will create an “fast driver index” based of that.

Command: Transform – Compute Variable

In the box under “Numeric Expression” the calculation should be written. Here I want the mean value caclulation. Instead of put (var1+var2+var3+var4 / 4) I will rather use the MEAN-function.

You find the functions in this boxes, follow my recommended order (1 and 2):

Then click on the arrow-button:  

So the calculation appears in the box: “Numeric Expression”:

Now the questions marks (?,?) should be replaced with your 4 variables. So either write them in manually, or more effective: click them in through your left variable box.

As you see when you click on the variable, you can see the variable name in the brackets (here it’s v251). This variable name is the one that SPSS will use in the command. See below that the firs question mark will be replaced by the variable name:

Continue with the other variables so it’s in the end looks like this:

An finish the command by clicking  on the “OK”-button.

In the data file, you have now got a new variable to the right in the data file, here you see the first 5 cases:

Case nr 1 is a person who likes to drive very fast (index value is 4.25) but case nr 5 doesn’t like to drive fast: (index value 1). Here you can compare with the original values (the answers from the respondents in this questionnaire), so you understand the mean values (ex: 3+5+5+4/4 = 4.25).

If you rather want to use the sum, then you must be sure that you don’t have any missing values! See the problem below if the first case hasn’t answered question: v242:

Then the sum would be a bad calculation method for the index:

Here is the calculation:

And here is the result in the data file, see “fast_driver2”, that is really misleading:

It looks like case 1 is similar to case 2,3,and 4 – but what we know is that case 2,3,4 is much more negative to drive fast. That’s why it’s better to use mean values as an calculation.

Thanks for watching and have a nice Monday!

Gunilla Rudander



error: Content is protected !!