|
Doing More With Your Variables:
Creating New Variables and Organizing Cases
Creating New Variables:
- You may decide that some variables in your data file need modifications
before you do certain analyses. For example, you may want to: (1) compute a new variable
from other variables in the data set (e.g., create a sum); and/or (2) change the way that
the variable was coded (e.g., make age groups, collapse certain categories).
- To do these analyses, make sure you are in the data sheet window (e.g.,
module1.sav).
- To Create New Variables From Old Variables:
- Compute. SPSS provides over 100 statistical functions to
transform variables. Most commonly, you may want to use a SUM function to make a composite
of a number of variables in your data set. You can then use this newly computed variables
in subsequent analyses.
- To use the compute command, click Transform
à Compute.
à
Compute.
- Once you are in the Compute window, it is up to you: (1) to state how
your new variable will be named (Target Variable; remember that computer
variable names need to be eight characters or less); (2) to choose the variables that will
be used; and (3) to select one of the functions such as SUM for your Numeric Expression.
- Count: A second way to create a composite of other
variables in the data set is to click Transform
à Count.
à
Count.
The count command will
evaluate a set of variables that you choose and give one point for every instance of a
value or a set of values (that you specify).
- First provide a computer name (eight characters or less) and a longer
name (Target Label) for the new variable that you want to create.
- Next, choose your variables from the list and use the black arrow key in
middle to move the variables to the Numeric Variables box.
- Finally, click Define Values to specify the values you
want, Continue (to bring you back to the Count menu), and then OK to tell
SPSS that it is time to create the new variable.
- To Change The Coding Of Some Original Variables:
- Recode: You can recode string variables (e.g., Y/N) as
easily as numeric variables.
- To use the recode command, click Transform
à Recode
à Into Different Variables.
à
Recode
à Into Different Variables.
- Choose the variable(s) you would like to recode and the new name(s) and
label(s). Click Change to register changes.
- Click Old and New Values to start specifying how you want
the new variable to be coded.
- For each value of the existing variable ("Old Value") you will
need to state how you want the new variable to be coded ("New Value". For each
value specified, click Add to register the proposed change. When you are
through, click Continue (which will bring you back to the Recode menu), and OK
(to process the command).


- Go to the far right
of the data sheet and see that your new variable is there.
Organizing Cases:
- You also are likely to find yourself wanting to rearrange your data
somewhat before you do analyses. For example, you may want to (1) sort your data on a
particular variable; and (2) only analyze a subset of the cases in your data file.
- To do these analyses, make sure you are in the data sheet window (e.g.,
module1.sav).
- Sort. There are many reasons why you might want to sort on
a variable in your data set including for data checking.
- To do this, click Data
à Sort
à
Sort
Cases
and choose the variable(s) on which you would like
to sort (put in the Sort By box). You can choose ascending or descending order for
the sort.
- When you say OK, SPSS will process your
command and you can look at your data sheet to see the results of the sort.

- Selecting Cases: You may not want to
do all analyses on all cases at all times, and this procedure allows you to choose subsets
of cases.
There are a number of steps to selecting cases:
- Click Data
à Select Cases
à If condition is satisfied
à If.
à
Select Cases
à
If condition is satisfied à
If.
- Choose the variable(s) from the list and specify (as a formula) the
condition of selection. For example, if you would like to analyze only women, you would
type sex = 2, assuming that women are coded as 2 for the sex variable.
- Click Continue, and OK in the select cases window.
- Do whatever analyses you want (they will be conducted on only the women
in the sample).
- When you want to use the whole sample again, click
Data à Select
Cases à
All Cases à OK.
à
Select Cases
à All Cases
à
OK.
© Copyright 1997-2005 by The Measurement Group LLC. All rights
reserved. |