Creating a Variable in SPSS
This tutorial shows you how to create a new variable in SPSS. This tutorial assumes that you have started SPSS and optionally loaded a data set.
The first step in creating an SPSS variable can be accomplished in several ways:
The Variable view will appear:
Click in the cell at the intersection of row 1 and the Name column. Type the name
of the variable. The variable name should start with a letter, and contain only letters and numbers (no punctuation or
spaces). In this example, I will name the variable Class:
The variable has a default type of Numeric (a number). If this is not the correct
type, specify the type of the variable by clicking in the cell at the intersection of the
appropriate row and the Type column. An ellipsis will appear:
Click on the ellipsis to specify the type of variable that you have. The Variable
Type dialog box will appear:
We will use primarily the Numeric option, which says that we are dealing with a number and the String option, which says that we have a word or other alphabetic characters. Many of the other options (Dollar, Custom currency) primarily affect how the output is displayed. In this example, we will use the Numeric type. You can specify the number of decimal places that SPSS displays by typing the desired number in the Decimal Places text box. We will leave it set at two. Click on OK.
It is often useful, but not required, to assign a descriptive label to the variable.
This is useful because the variable name is limited to eight characters, while the label
can be much longer. Click in the cell at the intersection of the desired row and the Label
column and type in the variable's label. In this example, I will label the class variable
as "Class Condition.":
It is also useful to assign labels to the values of nominally and
ordinally scaled variables. Instead of having the number 1 represent the Distance Learning
condition, we could assign the label "Distance" to the value 1, and SPSS will often
(not always) use the label instead of the value in the output. This makes it easier to
read the output, especially if it has been several months since you last looked at the
data. To assign labels, click in the cell at the intersection of the appropriate row
and the Values column. An ellipsis appears in the cell:
Click on the ellipsis and the Value Labels dialog box appears:
Type the first value of the variable in the Value box and then click in the Value
Label box and type the label for the first value of the variable. In this example,
the value 1 has a label "Distance.":
Click on the Add button and repeat as necessary for the other values and labels of
the variable. This is what the dialog box looks like when we are done:
Click on OK when done.
Frequently, someone will leave a question blank, or fail to make a response. But you
would still like to use the rest of their data. In that case, you need to tell SPSS that
you have a missing value. To specify the missing value, click in the cell at the
intersection of the appropriate row and the Missing column. An ellipsis appears in the
cell. Click on the ellipsis. The Missing Values dialog box will appear:
SPSS has several ways of specifying missing values. You can give up to 3 discrete values that
represent missing values. For numeric variables, I often use 9999 (or some other number that
cannot occur in the data) as the missing value. For string variables, I often use NA (for
No Answer.) You can give a range and one
discrete missing value. In this example, we can only have values between 1 and 2, so I
will use 9999 as a single discrete missing value. Click in the circle next to Discrete
missing values:
The cursor should be blinking the left most text box under the Discrete missing values
option. Type in the missing values (9999):
Click on the OK button.
The last task in defining a variable is to specify its level of measurement. Click in
the cell at the intersection of the appropriate row and the Measure column. A down arrow
button appears in the cell:
Click on the down arrow and select the appropriate level of measure
(sometimes you have to click on the down arrow twice to get the drop down menu
to appear):
Scale is used for interval and ratio data. This variable is nominally scaled so click on Nominal.
Repeat the process for any remaining variables that you wish to define.
Click on the Data View tab at the lower left of the SPSS window to return to the
data view (or press Ctrl-T or click on View | Data):