Helpdesk IBM SPSS Statistics 20 For students from Arnhem Business School  
Home  Codebook  Data  Data editing  Analysis  Graphs  Settings  Links  Methods 
Data editing ComputeWith Compute you can create/define variables using formulas, arithmetic and
manipulation of existing variables.
Example 1: Calculating the lenght of a time interval.
Description of the data fileIn our file two moments in time are recorded for every case. They are the starting time and the end time of an interview. We are interested in how much time each interview took. We want for each respondent the duration of the interview and we also want an overview of the duration for the entire survey process. Our data file looks like this in the Variable View:
Calculating the duration of the interview is simple. Just subtract the starting time from the end time. You can see how to do that in the screens below. Specifying the compute operation
We need to specify a name for the new target variable.
Finally click OK to create a new variable, which contains the calculated interview duration for each respondent. Note: In the Variable View you can see the new variable. If you like you can add a variable label afterwards instead of during the compute procedure. We chose for "Duration of the interview in seconds.". We also changed the number of decimals to 0. Using the new variableWe have created a histogram showing the distribution of the new variable interview duration. A first draft of this graph looks like this:
We see 40 interviews that took less than 1000 seconds, one interview needed between 1000 and 2000 seconds (1567 seconds to be precise) and there is one extreme outlier of 5742 seconds. Apparently something special happened during these two interviews. Of course you want to check what exactly went on there. But these outliers don't belong in our histogram. If we filter them using Data, Select Cases, IF (Interview_duration < 1000) our new histogram gives an overview of the duration of all the "normal" interviews.
Note that the time is in seconds; hence an interview took on average about 5 minutes, which seems ok. Example 2: Calculating the average trust in other peopleSource of this example: The World Values Survey; see www.worldvaluessurvey.org.
Description of the data fileIn the survey people are asked the following questions:
We would like to calculate the average of the answers that a respondent gave in order to have one number as an indication of his or her overall trust in other people. How can we compute this new variable "Trust"?
Specifying the compute operationIn the compute dialog box you have a whole range of
functions at your disposal to assist in your calculations.
Next we specify the mean of which arguments we want. In our case it is the mean of the questions related to trust in various groups of people.
Using the new variableWe have constructed an error bar for the average trust
that males and females have in other people.
We see a minute difference in average trust between males and females. But this is insignificant compared to the margin of error for the averages themselves.

Last modified
30102012
© Jos Seegers, 2009; English version by Gé Groenewegen. 