NOTE: This page was created using SPSS version 19.0.1.
There are a few reasons why you may not be able to see your variables in some of the SPSS dialog boxes. One possible reason is that your variable is a string variable and the dialog box will only accept numeric variables. Another possibility is that your variable has a different measurement scale than the dialog box will accept. A third possibility is that your variable does not have the appropriate role. We will discuss each of these issues and how to resolve them.
If you are using syntax, you need to know if the variable is numeric or string (and you may need to convert string variables to numeric format), but the measurement level and variable role settings do no matter. These assignments can be modified using syntax (as shown below).
Some dialog boxes show all of the variables in your data set, regardless of type of variable. For example, you will see both numeric and string variables in the list of variables from which to choose. Other dialog boxes, including the dialog box for the correlate command, will display only numeric variables. Notice that although you can see the variable female in the data set, it does not appear in the list of variables that can be used in the correlation.
If we look at the Variable View window, we can see that the variable female is a string variable, even though it has values of "0" and "1".
There are several ways to convert string variables to numeric form. For example, you could use the autorecode command, the recode command, or the numeric function with the compute command. Below, we will use the autorecode command to convert the string variable female into the numeric variable female_num.
autorecode female / into female_num. exe.
Please see our Introduction to SPSS Syntax seminar (section 7) for a more thorough discussion of these commands and examples. Once the variable has been made into a numeric variable, it will appear in the dialog box.
On the right side of the Variable View window, you will see a column titled Measure. There are three possible settings for numeric variables: nominal, ordinal and scale. String variables can be either nominal or ordinal.
The dialog boxes for automatic linear modeling, nptests (non-parametric tests) and genlinmixed use measurement level to determine which variables can be used in the various dialog boxes.
In the dialog box above, the yellow bars at an angel are scales and indicate that variable is a scale variable. The three vertical bars indicate that the variable is an ordinal variable, and the three circles indicate that the variable is a nominal variable.
From the SPSS help file system:
Note: For ordinal string variables, the alphabetic order of string values is assumed to reflect the true order of the categories. For example, for a string variable with the values of low, medium, high, the order of the categories is interpreted as high, low, medium, which is not the correct order. In general, it is more reliable to use numeric codes to represent ordinal data.
When reading data into SPSS, the following conditions are used to determine the measurement level.
Copied from the SPSS help file located at http://127.0.0.1:4235/help/index.jsp?topic=/com.ibm.spss.statistics.help/overvw_auto_0.htm .
|All values of a variable are missing||Nominal|
|Format is dollar or custom-currency||Continuous|
|Format is date or time (excluding Month and Wkday)||Continuous|
|Variable contains at least one non-integer value||Continuous|
|Variable contains at least one negative value||Continuous|
|Variable contains no valid values less than 10,000||Continuous|
|Variable has N or more valid, unique values*||Continuous|
|Variable has no valid values less than 10||Continuous|
|Variable has less than N valid, unique values*||Nominal|
* N is a user-specified cut-off value. The default is 24.
You can change the measurement level of a variable in the Variable View window. Alternatively, the variable level command can be used to change the measurement level of variables.
variable level id race schtyp (nominal) /ses (ordinal) /female prog read write math science socst (scale).
Also, the cutoff value (how many unique values a variable must have to be given a level of scale) can be changed in the Options dialog box (Edit -> Options -> Data tab).
The variable role command was added to SPSS in version 18. This setting can be seen in the variable View window on the far right. It is used by the dialogs of some commands to pre-select variables for analysis. You can modify a variable’s role either by changing it in the Variable View window or via syntax with the "variable role" command. A variable’s role has no effect when running commands via syntax; it only matters when using the point-and-click interface of some of the newer commands in SPSS.
Some of the commands whose point-and-click interface uses the variable role are genlinmixed and automatic linear modeling.
Here is a brief summary of roles. This information is taken from the Command Syntax Reference Guide entry for variable role. By default, all variables are assigned the input role.
|Both||both input and output (both DV and IV)|
|None||no role assignment|
|Partition||the variable will be used to partition the data into separate samples for training, testing, and validation|
|Split||This is used with IBM SPSS Modeler. This is not a variable that will be used in to "split the file" in SPSS Statistics|
The variable role command can be used to change the role of variables.
variable role /target write read /input math science ses schtyp /both socst.