SPSS Tutorial: Defining Variables
In this tutorial, we will take a look at SPSS's Variable View tab, and learn how to define variables within the program. To ensure that SPSS knows how to handle your data properly, it is important to specify the attributes associated with each of your variables - name, data type, level of measurement, etc. This tutorial will show you how to accomplish this using the Variable View tab.
Part 1: Adding a Variable
The simplest way to add a variable to your dataset is just to type data into an empty column in the Data View (click on the Data View tab at the bottom of the program window if you can't see the Data View grid). Start in the first cell of an empty column, and work downwards (see screenshot below, 1). In the video accompanying this tutorial, we added an Age variable to our original Gender and Smoker variables. SPSS automatically generated a name for this variable - VAR00001. To change the variable name, and to define the other attributes associated with the variable, click on the Variable View tab (2).
Part 2: Defining Variables
You can define the following variable attributes under the Variable View tab. Each attribute occupies its own column in the Variable View grid.
To change a variable name, double click on the name you want to alter and type in the new name. You cannot use spaces in variable names. Changing a variable name does not change the values associated with it. In our tutorial video, we changed SPSS generated VAR00001 to Age.
Type specifies the type of the variable, such as numeric, string, data, date, etc. In our example, SPSS had correctly identified Age as a numeric type. If you need to change the variable type, click inside the cell you want to change (within the Type column) and a list of variable types will be displayed. Select the variable type you require and click OK.
It's worth noting that the numeric type offers the most flexibility, so you should use this type if at all possible.