Type Variables on the SPSS Variable View Tab

By Keith McCormick, Jesus Salcedo, Aaron Poh

Most data you enter in SPSS Statistics will be just regular numbers. Some, however, will be a special type, such as currency, and some will be displayed in a special format. Other data, such as dates, will require special procedures for calculation. You simply specify what type you have, and SPSS takes care of those other details for you. This is a comprehensive look at all the types.

On the Variable View tab, click the cell in the Type column you want to fill in, and a button with three dots appears on its right. Click that button, and the Variable Type dialog box appears.

The Variable Type dialog box allows you to specify the type of variable you're defining.

The Variable Type dialog box allows you to specify the type of variable you’re defining.

You can choose from the following predefined types of variables:

  • Numeric: Standard numbers in any recognizable form. The values are entered and displayed in the standard form, with or without decimal points. Values can be formatted in standard scientific notation, with an embedded E to represent the start of the exponent.

    The Width value is the total number of all characters in a number — including any positive or negative signs and the exponent indicator. The Decimal Places value specifies the number of digits displayed to the right of the decimal point, not including the exponent.

  • Comma: This type specifies numeric values with commas inserted between three-digit groups. The format includes a period as a decimal point. The Width value is the total width of the number, including all commas and the decimal point. The Decimal Places value specifies the number of digits to the right of the decimal point.

    You may enter data without the commas, but SPSS will insert them when it displays the value. Commas are never placed to the right of the decimal point.

  • Dot: Same as Comma, except a period is used to group the digits into threes, and a comma is used for the decimal point.

  • Scientific Notation: A numeric variable that always includes the E to designate the power-of-ten exponent. The base (the part of the number to the left of the E) may or may not contain a decimal point. The exponent (the part of the number to the right of the E, which also may or may not contain a decimal) indicates how many times 10 multiplies itself, after which it’s multiplied by the base to produce the actual number.

    You may enter D or E to mark the exponent, but SPSS always displays the number using E. For example, the number 5,286 can be written as 5.286E3. To represent a small number, the exponent can be negative. For example, the number 0.0005 can be written as 5E–4. This format is useful for very large or very small numbers.

  • Date: A variable that can include the year, month, day, hour, minute, and second. When you select Date, the available format choices appear in a list on the right side of the dialog box, as shown here.

    Selecting a date format also selects which items are included.

    Selecting a date format also selects which items are included.

    Choose the format that best fits your data. Your selection determines how SPSS will format the contents of the variable for display. This format also determines, to some extent, the form in which you enter the data. You can enter the data using slashes, colons, spaces, or other characters.

    The rules are loose — if SPSS doesn’t understand what you enter, it tells you, and you can re-enter it another way. For example, if you select a format with a two-digit year, SPSS accepts and displays the year that way, but it will use four digits to perform calculations. The first two digits (the number of the century) will be selected according to the configuration you set by choosing Edit →Options and then clicking the Data tab.

  • Dollar: When you select Dollar, the available format choices appear in a list on the right side of the dialog box. Dollar values are always displayed with a leading dollar sign and a period for a decimal point; for large values, they include commas to collect the digits in groups of threes.

    The different dollar formats mostly specify the number of digits to be included.

    The different dollar formats mostly specify the number of digits to be included.

    You select the format and its Width and Decimal Places values. The format choices are similar, but it’s important that you choose one that’s compatible with your other dollar-variable definitions so they line up when you print and display monetary values in output tables.

    The Width and Decimal Places settings help with vertical alignment in the output, no matter how many digits you include in the format itself. No matter what format you choose, you can enter the values without the dollar sign and the commas; SPSS inserts those for you.

  • Custom Currency: The five custom formats for currency are named CCA, CCB, CCC, CCD, and CCE, as shown here. You can view and modify the details of these formats by choosing Edit →Options and then clicking the Currency tab. Fortunately, you can modify the definitions of these custom formats as often as you like without fear of damaging your data. As with the Dollar format, the Width and Decimal Places settings are primarily for aligning the data when you’re printing a report.

    Five custom currency formats are available.

    Five custom currency formats are available.
  • String: A freeform non-numeric item. The only good time to use string is when it truly is a string, like an address, a proper name, or a product code (SKU). Avoid using the String type when it really should be labeled Numeric. Something like favorite color, sex, or state should not be a string because it has a finite list of possibilities that are known in advance.

    Strings are text like addresses, names, and open-ended responses.

    Strings are text like addresses, names, and open-ended responses.

    SPSS allows a very large number for the size of the string — so large that you could fit a paragraph, which is exactly what you would do if you were doing text mining. Open-ended response items in a survey would also be an example of a string.

  • Restricted Numeric: A relatively new choice, so you may not see it mentioned in older books about SPSS. This is perfect for numbers that sometimes have leading zeros like zip codes and Social Security numbers. They aren’t really numbers because you don’t perform arithmetic on them. Back in the day, these types of numbers had to be declared as strings.