3. Transformation (computing) of Data
SPSS has very powerful capabilities for creating new
variables as a function of existing variables, for
example
To create averages of existing variables
To rescale existing variables
To compute difference scores by subtracting one variable
from another
4. Computing A New Variable
TargetVariable - new variable
name.
Numeric Expression - defining
the new variable, essentially
giving SPSS a formula.
The variables in the Numeric
Expression need to be either
existing variables or
numbers.
Specify theType and Label
for the newVariable.
5. Conditionally Computing A New Variable
Variables can also be
computed conditionally.
For instance, if in the above
example, you were only
interested in the change in
salaries for people who began
working for the company
within the last six years.
If… button
(optional case selection
condition)
6. Transforming An Existing Variable
For example, the variable
jobtime represents months of
experience on the job, but
we may wish to analyze data
in terms of years on the job
Give a new variable name
or keep the existing name
for theTargetVariable
7. Recoding Variables
Another way to modify the values of existing variables
in your dataset. In the Data Editor: Transform ->
Recode
Into Same Variables option -
changes the values of the
existing variables.
Into Different Variables
option - create a new
variable with the recoded
values. (not overwrite your
original data)
Both options are essentially
the same, except that
recoding into a different
variable requires you to
supply a new variable name.
8. Recoding Variables
Categories to Categories
For example, the variable jobcat codes an employee's status in
three categories, but for a particular analysis you may want to
combine two of these classifications into a single category.
The original coding was
Clerical = 1 -> 1
Custodial = 2 -> 2
Manager = 3 -> 2
10. jobcat
Old New
3 2
2 2
1 1
0 (missing) ?
With System-
missing
selected
Without System-
missing
selected
11. Recoding Variables
Numeric to Categories
Recode the continuous variable to the categorical variable
Useful in cross-tabulation
Group ranges of the variable into categories
For example, we need to code an employee's current salary into
two categories as the following
Less than or equal to $27,000 (Low) -> 1
More than $27,000 (High) -> 2
13. How about if
there are more
than 2 groups?
Where is the
value 27,000?
14. Splitting/Grouping
In some situations, you may want to perform the same analysis
on different groups within the same dataset.
Analyses such as these can be conducted by first selecting the
Split File function from the Data menu in the Data Editor:
Data -> Split File...
15. Splitting/Grouping
Because the split file command remains in
effect indefinitely, you should reset this
option when you no longer want a split file
analysis.
If you select the option
to "Sort the file by
grouping variable,"
SPSS will run the
"Sort File" command
in the background.
16. Splitting/Grouping
The Compare groups and Organize output by groups result in the same
values in the output, regardless of the analysis being performed, but
they differ in the way in which the output is presented.
Compare groups
Descriptive Statistics
216 15750 58125 26031.92 7558.021
216
258 19650 135000 41441.78 19499.214
258
Current Salary
Valid N (listwise)
Current Salary
Valid N (listwise)
Gender
Female
Male
N Minimum Maximum Mean Std. Deviation
SORT CASES BY gender .
SPLIT FILE
LAYERED BY gender .
17. Splitting/Grouping
Organize output by groups
Descriptive Statisticsa
216 15750 58125 26031.92 7558.021
216
Current Salary
Valid N (listwise)
N Minimum Maximum Mean Std. Deviation
Gender = Female
a.
Gender = Female
Descriptive Statisticsa
258 19650 135000 41441.78 19499.214
258
Current Salary
Valid N (listwise)
N Minimum Maximum Mean Std. Deviation
Gender = Male
a.
Gender = Male
SORT CASES BY gender .
SPLIT FILE
SEPARATE BY gender .