Next: Testing data consistency, Previous: Dealing with suspicious data, Up: Data Screening and Transformation [Contents][Index]
Data entry errors are not the only reason for wanting to recode data.
The sample file hotel.sav comprises data gathered from a
customer satisfaction survey of clients at a particular hotel.
In Example 5.4, this file is loaded for analysis.
The line display dictionary.
tells PSPP to display the
variables and associated data.
The output from this command has been omitted from the example for the sake of clarity, but
you will notice that each of the variables
v1, v2 … v5 are measured on a 5 point Likert scale,
with 1 meaning “Strongly disagree” and 5 meaning “Strongly agree”.
Whilst variables v1, v2 and v4 record responses
to a positively posed question, variables v3 and v5 are
responses to negatively worded questions.
In order to perform meaningful analysis, we need to recode the variables so
that they all measure in the same direction.
We could use the RECODE
command, with syntax such as:
recode v3 (1 = 5) (2 = 4) (4 = 2) (5 = 1).
However an easier and more elegant way uses the COMPUTE
command (see COMPUTE).
Since the variables are Likert variables in the range (1 … 5),
subtracting their value from 6 has the effect of inverting them:
compute var = 6 - var.
Example 5.4 uses this technique to recode the variables
v3 and v5.
After applying COMPUTE
for both variables,
all subsequent commands will use the inverted values.