Recode Sex; this is also an example
of dummy coding (coding a dichotomous variable with 0 and 1).
Start off by importing the
ExampleData001.sav
into the Data Editor window of PASW / SPSS (from this point forward
referred to as simply SPSS).
To recode an item it is generally recommended that
one use the 'Recode into Different Variables...' menu choice of the
'Transform' button on the SPSS task bar. That way we preserve the
original data or the data in its original form.
Next, we want to move the variable Sex [Gender]
into the "Numeric Variable --> Output Variable:" box. Then we
can name the output variable Sex_RC with the label Gender Recoded and
click the "Change" button, which will move the output variable into the
middle box; as shown below. Next, click on the "Old and New Values"
button.
Now we can specify the old and new values by
typing a 1 in the "Old Value" "Value" box and typing a 0 in the "New
Value" "Value" box; then click the "Add" button to bring that re-code
to the "Old --> New:" box. Then, type a 2 in the "Old Value"
"Value" box and typing a 1 in the "New Value" "Value" box; then click
the "Add" button to bring that re-code to the "Old --> New:"
box. Then we can click the "Continue" button.
Next, click on the "OK" button (or the "Paste"
button if you prefer to maintain a syntax file for your records). The
output window should pop up and show the syntax for the recode
procedure.
Next, go back to the Data Window and click on the
"Variable View" tab at the lower left corner. Once in the Variable
View, select the "Values" cell of our newly created Sex_RC variable.
Specifically, you want to click on the button with three dots. This
will bring up the "Value Labels" dialog box.
Inside the "Values" field, first type a zero (0)
and type Female in the "Label:" field, then click the "Add" button.
Second, type a one (1) in the "Values" field, and type Male in the
"Label:" field, then click the "Add" button. Now we can click the "OK"
button to finish assigning value labels to the recoded variable.
That concludes the recoding of Sex (with label
Gender and
value labels 1 = Female,
2 = Male) into Sex_RC (with label Gender Recoded and value labels 0 =
Female, 1 = Male).
Remember, this is also an example of dummy coding
(coding a dichotomous variables with zeros and ones) as would be done
for entering a categorical variable into a regression model/analysis.
|