Title: Data Manipulation II Transforming, Recoding, and SplittingGrouping
1Data Manipulation IITransforming, Recoding, and
Splitting/Grouping
- SPSS Training
- Thomas Joshua, MS
- July 2008
2Lecture Overview
- Transformation (computing) of Data
- Recoding
- Splitting/Grouping
3Transformation (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
4Computing A New Variable
- Target Variable - 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 the Type and Label for the new Variable.
5Conditionally 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)
-
6Transforming 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 the Target Variable
7Recoding Variables
- Another way to modify the values of existing
variables in your dataset. In the Data Editor
Transform -gt 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.
8Recoding VariablesCategories 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 -gt 1
- Custodial 2 -gt 2
- Manager 3 -gt 2
9Recoding Variables
Input variable -gt Output variable -gt Change
bottom -gt Define the old and new values
10- With System-missing selected
- Without System-missing selected
11Recoding VariablesNumeric 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) -gt 1
More than 27,000 (High) -gt
2
12Recoding VariablesNumeric to Categories
13- Where is the value 27,000?
- How about if there are more than 2 groups?
14Splitting/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 -gt Split File...
15Splitting/Grouping
- If you select the option to "Sort the file by
grouping variable," SPSS will run the "Sort File"
command in the background.
Because the split file command remains in effect
indefinitely, you should reset this option when
you no longer want a split file analysis.
16Splitting/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
SORT CASES BY gender . SPLIT FILE LAYERED BY
gender .
17Splitting/Grouping
- Organize output by groups
SORT CASES BY gender . SPLIT FILE SEPARATE BY
gender .
Gender Female
Gender Male
18Thank You