Variable
Transformation in SPSS
The following working examples refer to the practice
dataset from the practice questionnaire
.
1. Compute
1.1 Transform
-> Compute
1.2 We want to construct a new variable to examine whether TV is a major
source of advertisement received by our respondents.
-
we have asked 5 types of products
-
the relevant questions are 2, 6, 10, 14, 18
-
the coding is 1 (chosen) and 0 (not chosen)
-
it is different from questions 4, 8, 12, 16, 20
-
*** to add
the "values" in questions 2, 6, 10, 14, 18 is meaningful ONLY if the coding
is either 1 or 0
1.3 Assign a new variable name (tvad) and
apply the appropriate formula:
compute tvad = v203 + v603 + v1003
+ v1403 + v1803.
execute.
-
the new variable will have range of values from 0 to 5
1.4 Likewise, you may construct similar variables for other media of advertisment.
1.5 After we have constructed 6 new variables, we can compare which
source is the most popular, and which is the least, using the Frequencies
command to examine the distributions.
2. Count
2.1 Transform -> Count
2.2 We want to construct a new variable to examine how important TV
is the source of advertisment referenced by our respondents.
-
unlike 1.2, it is meaningless to use Compute
, since the relevant questions (4, 8, 12, 16, 20) are coded as 0 (if not
chosen), 1 (ranked first), or 2 (ranked second)
-
Count has a different logic of computation
from Compute
-
Count will not add up the "values"
of the variables
-
it will tally (i.e. counting the number of occurrence) the existence of
"values" across the variables as specified in the command
-
we do not mind if TV is ranked first or second, so codes 1 and 2 will fit
our criteria
2.3 Assign a new variable name (tvref)
-
the relevant variables (not questions) are v403, v803, v1203, v1603, v2003
-
the new variable will have range of values from 0 to 5
2.4 Likewise, you may construct similar variables for other media of advertisment.
2.5 After we have constructed 6 new variables, we can compare which
source is the most important, and which is the least, use the Frequencies
command to examine the distributions.
3. Recode - Another
Ways to creat new variable
3.1 In the above examples, you may or may not notice that Compute
and Count are able to create new variables.
3.2 There are other commands in SPSS have the same function of creating
new variables. Among others, a commonly used procedure is Recode
... Into Different Variables .
3.3 In its simple operation, Recode
is used to:
-
combine response categories to facilitate crosstabulation
analysis
-
assign undesirable or illegitimate answers to the
number corresponding to the missing value defined
-
in either case, the variable under treatment CANNOT
be recovered to its original value, but all labels and missing value declaration
will remain unchanged.
3.4 Recode ... Into
Different Variables offer an alternative
to keep original values and perform transformation to the original values
by storing in a new variable.
3.5 Since Recode
... Into Different Variables creates a
new variable, labels and missing value have to be defined again.
3.6 Either simple Recode
or Recode ... Into Different Variables
does not require to tranform all original values. But the results
are different.
3.7 Simple Recode
-
keeps the untouched values as the original one and
also the value labels will remain the same
-
keeps the missing value
-
the undesirable consequence is that if the value
used to represent the combined categories is not existing originally, you
have to label it
-
on the contrary, if the value assigned to the combined
answers corresponds to any original value, the label will follow the original
one which may not truely reflect the meaning of the combined categories.
You have to re-label it when necessary.
3.8 Recode ... Into
Different Variables
-
will NOT copy untouched values in the original variable
to the newly created variable
-
all untouched values in the new variables will be
treated as "system missing value"
-
to deal with this, you are require to "recode" any
untouched answer to its own value
-
variable label, values labels and user-defined missing
value are empty, that means you have to define them again
3.9 Transform
-> Recode ->
-
Into Same Variables (i.e. replaces
the values of original variables)
-
Into Different Variables (i.e. new
variable created and the original variable remains unchanged, but missing
values in new variable to be redefined)
-
Recode -> If
... : clean up undesirable or illegitimate
answers
4. To record procedures of variable transformation
4.1 Keep track of what you have done to the variables.
4.2 To apply the same procedures when new cases are added.
4.3 In all procedures, click
button instead of OK.
4.4 The SPSS Syntax Editor will pop-up, the commands of the corresponding
tranformation are shown.
4.5 Highlight the necessary commands and also the "EXECUTE."
4.6 Press the Run Current button
to complete the transformation.
4.7 If the result of the tranformation (and other procedures) meet your
request, click the SPSS Syntax Editor window and save the syntax file,
the extension of the file will be .sps .
4.8 At later time to re-use the commands, File
-> Open -> Syntax
5. Basic Data Analysis
5.1 Univariate analysis: Analyze
->
-
Descriptive Statistics -> Frequencies
-
Descriptive Statistics -> Descriptives
-
revision on basic inferential statistics
5.2 Bivariate analysis: Analyze ->
-
Descriptive Statistics -> Crosstabs
-
Correlate -> Bivariate
-
Compare Means -> Independent-Samples
T Test
5.3 Revision on basic inferential
statistics