Our tutorials reference a dataset called "sample" in many examples. If you'd like to download the sample dataset to work through the examples, choose one of the files below:
In order for your data analysis to be accurate, it is imperative that you correctly identify the type and formatting of each variable. SPSS has special restrictions in place so that statistical analyses can't be performed on inappropriate types of data: for example, you won't be able to use a continuous variable as a "grouping" variable when performing a t-test.
Information for the type of each variable is displayed in the Variable View tab. Under the “Type” column, simply click the cell associated with the variable of interest. A blue “…” button will appear.
Click this and the Variable Type window will appear. You can use this dialog box to define the type for the selected variable, and any associated information (e.g., width, decimal places).
The two common types of variables that you are likely to see are numeric and string.
Numeric variables have values that are numbers (in standard format or scientific notation). Missing numeric variables appear as a period (i.e., “.”).
Example: Continuous variables that can take on any number in a range (e.g., height, weight, blood pressure, ...) would be considered numeric variables. The researcher can choose as many or as few decimal places as they feel are necessary. In this situation, the Measure setting should be defined as Scale; see the tutorial Defining Variables for more information. This particular type of numeric variable can be used calculations—e.g., we can compute the average and standard deviation of heights.
Example: Counts (e.g., number of free throws made per game) are a numeric variable with zero decimal places. In this situation, the Measure setting should be defined as Scale; see the tutorial Defining Variables for more information. Certain mathematical calculations are valid when applied to count variables (e.g., mean and standard deviation), but some statistical procedures are not (e.g., linear regression).
Example: Nominal categorical variables that have been coded numerically (e.g., recording a subject's gender as 1 if male or 2 if female) would be classified as numeric variables with zero decimal places. In this situation, the Measure setting must be defined as Nominal; see the tutorial Defining Variables for more information. This type of numeric variable should never be used in mathematical calculations.
Example: Ordinal categorical variables that have been coded numerically (e.g., a Likert item with responses 1=Good, 2=Better, 3=Best) would be classified as numeric variables with zero decimal places. In this situation, the Measure setting must be defined as Ordinal; see the tutorial Defining Variables for more information. In general, this type of numeric variable should not be used in mathematical calculations.
Note that some SPSS procedures require that grouping variables be coded as numeric (e.g., the independent samples t-test; legacy dialogues for nonparametric methods; etc.)
String variables -- which are also called alphanumeric variables or character variables -- have values that are treated as text. This means that the values of string variables may include numbers, letters, or symbols. Missing string values appear blank.
Example: Zip codes and phone numbers, although composed of numbers, are typically considered string variables because their values cannot be used meaningfully in calculations.
Example: Any written text is considered a string variable, including free-response answers to survey questions.
The next few variable types are all technically numeric, but indicate special formatting. If your data has been recorded in one of these formats, you must set the variable type appropriately so that SPSS can interpret the variables correctly. (For example, SPSS can not correctly use dates in calculations unless the variables are specifically defined as date variables.)
Numeric variables that include commas that delimit every three places (to the left of the decimals) and use a period to delimit decimals. SPSS will recognize these values as numeric—with or without commas, and also in scientific notation.
Example: Thirty-thousand and one half: 30,000.50
Example: One million, two hundred thirty-four thousand, five hundred sixty-seven and eighty-nine hundredths: 1,234,567.89
Numeric variables that include periods that delimit every three places and use a comma to delimit decimals. SPSS will recognize these values as numeric—with or without periods, and also in scientific notation.
Example: Thirty-thousand and one half: 30.000,50
Example: One million, two hundred thirty-four thousand, five hundred sixty-seven and eighty-nine hundredths:1.234.567,89
Note about comma versus dot notation: comma notation is standard in the United States. Oracle's International Language Environments Guide gives a list of countries and what form of notation is typically found in each.
Numeric variables whose values are displayed with an E and power-of-ten exponent. Exponents can be preceded by either an E or a D, with or without a sign, or only with a sign (no E or D). SPSS will recognize these values as numeric, with or without an exponent.
Example: 1.23E2, 1.23D2, 1.23E+2, 1.23+2.
Numeric variables that are displayed in any standard calendar date or clock-time formats. Standard formats may include commas, blank spaces, hyphens, periods, or slashes as space delimiters.
Example: Dates: 01/31/2013, 31.01.2013
Example: Time: 01:02:33.7
Numeric variables that contain a dollar sign (i.e., $) before numbers. Commas may be used to delimit every three places, and a period can be used to delimit decimals.
Example: Thirty-three thousand dollars and thirty-three cents: $33,000.33
Example: One million dollars and twelve point three cents: $1,000,000.123
Numeric variables that are displayed in a custom currency format. You must define the custom currency in the Variable Type window. Custom currency characters are displayed in the Data Editor but cannot be used during data entry.
Numeric variables whose values are restricted to non-negative integers (in standard format or scientific notation). The values are displayed with leading zeroes padded to the maximum width of the variable.
Example: 00000123456 (width 11)