How to Enter Data into SPSS and Define Variables

Probability and Statistics Topic Index > SPSS for Statistics > How to Enter Data into SPSS and Define Variables

how to enter data into spss

SPSS looks a little like Microsoft Excel. At first glance, you might think you can type your data into the spreadsheet in the same way as you can in Excel. However, this isn’t the case. With SPSS, you need to define your variables carefully, otherwise you run the risk that your graphs and statistical tests will be nonsensical.

How to Enter Data into SPSS: Steps

The data editor (the SPSS equivalent of a worksheet) opens automatically when you open SPSS. Variables are placed in columns and cases of data are placed into different rows.

How to Enter Data into SPSS: Setting up a new variable in the variable view.

Click “variable view” at the bottom left of the data enter to enter variable view. This is where you will set up new variables. The top row gives you several options:
NAME: What you want to call your variable (i.e. names, pets, occupation).
VARIABLE TYPE: What type of data you want to enter. Click the square to the right of the box to open a dialog box for options. Most of these variables are self-explanatory (like dollar, date, or scientific notation), but there are a couple that aren’t.

  • String variable: Use when you want to type letters. For example, peoples’ names, breeds of dog, occupations. You can also include numbers or symbols, but they will be treated by SPSS as text. For example, zip codes are numeric but you may want to treat them as text (i.e. you don’t actually want to perform calculations on them like 90210 * 10 ! ).
  • Comma: Numeric variables that are separated every three places by a comma. For example, 100,000.00 or 999,988,565.21.
  • Dot: Similar to comma, but the dot is used to separate the three places and a comma is used to indicate a decimal. For example. 100.000,00 and 999.988.565,21. Not used in the UK or USA, but common in some other countries.

You are most likely to use either string variables, or numeric variables. For a full explanation of the different types of variables you can put into SPSS, see this article at Kent State University.

Set the number of characters in your variable in the “characters” box on the Variable Type screen.

LABEL: Not strictly necessary but it can help you remember what the variable means; it allows you to put in a description. For example, if your variable NAME is “Type” then you can use the label “Type of Pet.” This can help you a year down the road when you have forgotten what the label “Type” means!

VALUES: Valid if you have a numeric variable. If you are using numbers to groups, you can click the box to assign labels. For example: 1. Junior 2. Senior. Tip: Once you have assigned these values, you can toggle them in the data editor to show either the numbers or the names. The toggle button looks like to arrows with 1 and A on them.

MEASURE: Tell SPSS what type of variable you have (for example, a nominal variable).

How to Define Variables in SPSS

When you perform a more complicated operation, like a z-test or a Student’s t-test, you must define variables in SPSS before you perform the test. In other words, you need to tell SPSS what your variables represent. For example, you may have a list of women and men in a pharmaceutical trial with a “1” representing a woman in your data list and 2 representing a man. SPSS won’t know what a “1” or a “2” means until you tell it, through defining variables.

Sample Problem: Define the variables for sex in the following data sheet, where “1” represents a female and “2” represents a male.
define variables in spss

Step 1: Click “Data” and then click “Define Variable Properties.”

how to define variables in spss
Variables are defined in SPSS with the Data>Define Variable Properties command.

Step 2: Click a variable in the left window that you want to define. In this sample problem, we want to define the “sex” variable, so click “Sex” and then click the center arrow.

Selecting the variables to define in SPSS.
Selecting the variables to define in SPSS.

Step 3: Click “Continue.” The main Define Variable Properties window will open.

Step 4: Type your variable names in the “Label” section of the Define Properties window. For this sample problem, type “Female” to the right of the value 1.00 and “Male” to the right of the value 2.00.
define variables in spss 4

Step 5: Click “OK” to save the variable changes.

Tip: You can also define variables by double-clicking on the variable name (at the top of the column). This opens the variable window where you can double-click on the “…” to open the define variable window. If you choose this option, you’ll need to separately enter the variable value and variable name.


Comments? Need to post a correction? Please Contact Us.