Enter and define variables in SPSS

5
Created by ASK (2012) Page 1 of 5 Table of Contents How to Enter and Define Variables in SPSS ................................................................ 2 1.1 Naming and entering variables ................................................................................................. 2 The Variable View: ....................................................................................................................... 2 The Data View: ............................................................................................................................. 2 1.2 Defining variables ...................................................................................................................... 3 The Variable View: ....................................................................................................................... 3 A few tips on defining variables: .................................................................................................. 3 Additional Resources.................................................................................................. 5

description

This tutorial shows you how to enter new variables and define them in SPSS

Transcript of Enter and define variables in SPSS

Page 1: Enter and define variables in SPSS

Created by ASK (2012) Page 1 of 5

Table of Contents

How to Enter and Define Variables in SPSS ................................................................ 2

1.1 Naming and entering variables ................................................................................................. 2

The Variable View: ....................................................................................................................... 2

The Data View: ............................................................................................................................. 2

1.2 Defining variables ...................................................................................................................... 3

The Variable View: ....................................................................................................................... 3

A few tips on defining variables: .................................................................................................. 3

Additional Resources.................................................................................................. 5

Page 2: Enter and define variables in SPSS

Created by ASK (2012) Page 2 of 5

How to Enter and Define Variables in SPSS

Variable names are entered from the Variable View. Data is entered from the Data View. (What

is a variable? How do I know what variables I have in my dataset?)

1.1 Naming and entering variables

The Variable View:

Enter variable names in the first column under “Name” (Figure 1).

o Names MUST begin with a letter.

o Names CANNOT have a space.

o Names CANNOT use special characters, except for an underscore.

Figure 1. First, enter variable names from the variable view.

The Data View:

This is where you enter your data for each variable.

Across the top of the columns it says “Var Var Var…”. After entering your variables in the

variable view, they will appear as the column headings replacing “Var Var Var…”. Figure 2

shows that the first column is now named “ID”.

DO NOT enter your variable names in the first row!! Only enter data in the Data View.

Figure 2. Variable names become column headings in the Data View.

Each variable name will appear as a column heading replacing var.

Enter variable names in the first column.

Page 3: Enter and define variables in SPSS

Created by ASK (2012) Page 3 of 5

1.2 Defining variables

The Variable View:

Table 1 below gives details about each of the columns in the variable view. YOU need to define

the items marked * for each variable. The other items can be left as default (most of the time).

* Name Enter the name of your variable – REMBMER: no spaces, no special characters (except _) and it must begin with a letter.

* Type Specify the data type of your variable. This will be numeric most of the time as categorical data should be coded. (See more detail below).

Width The maximum number of characters/digits of each data entry (field width).

Decimals The number of decimal places shown in the Data View. If the variable is categorical (nominal or ordinal), then you will want to change this to 0. If the variable is scale, choose a value that is most appropriate for the data you are entering.

* Label A description of the variable (IMPORTANT so you remember what the variable is). This label will appear in your output instead of the variable name. (See more detail below).

* Values Create labels for categorical variables. This allows you to specify what your numerical codes represent.

* Missing

Specify any missing values that you have coded. If you have left missing values blank, then you do not need to do anything here. However, if you have replaced all missing values with a code (e.g., 99, 999, -1, etc…), then you need to define that here. (See more detail below).

Columns The width of the column in Data View. You can adjust this from the data view like you would in Excel, so you don’t need to do anything here.

Align Alignment of your data in the Data View: Left, Right or Centre.

* Measure Specify the level of measurement of the variable: Scale, Ordinal or Nominal. (Really important).

Table 1. Define variables from the Variable View.

A few tips on defining variables:

Type: Remember that SPSS is quantitative analysis software. That means you need to give

categorical data numerical codes. SPSS will allow you to leave nominal variables as string,

but it is good practice to code them anyway; ALL ordinal data must be coded. (How do I

know if a variable is nominal or ordinal?)

Label: Keep the variable names short and then write out more detail in the label. For

example, if I had a variable measuring how long people spent commuting on a Monday, I

would name the variable MonCommute and the label would be How long (in minutes) it

takes to commute to work on a Monday morning. If you take the time to make good

labels then you won’t need to re-label your output (tables, charts, etc…) later. Also, you

won’t forget what the variable is or what your output shows (it’s easier to forget these

things than you may think!).

Missing values: You can either choose to define one, two or three discrete numbers (i.e.,

whole numbers and integers) which you have coded to represent missing values in the

data, or you can specify a range of values. Most of the time you will just have one number

Page 4: Enter and define variables in SPSS

Created by ASK (2012) Page 4 of 5

to represent missing values (that is, if you choose to code them instead of leaving them

blank). However, you may want to have more than one code for missing values if you want

to distinguish between different reasons that the data is missing (I want to know more

about coding, replacing and defining missing values). When SPSS conducts any analysis, it

will NOT include these missing values. You may choose to assign labels to your missing

values so you remember what they represent. IMPORTANT: You must replace missing

values with the chosen code from the Data View, SPSS will NOT do this for you.

Measure: By default new variables are defined as Scale. If your variable is nominal or

ordinal it is important that you change the Measure from Scale to the correct one. The

type of descriptives and analysis you choose should be dependent, in part, by the level of

measurement, so it is important to get this right. (How do I know what the level of

measurement should be?)

Page 5: Enter and define variables in SPSS

Created by ASK (2012) Page 5 of 5

Additional Resources

In the Getting Started folder under the SPSS resources section, you may be interested in the

following:

1. How to identify variables in your dataset

2. How to code categorical variables (check this out if you have data from a questionnaire)

3. How to create value labels for categorical variables

4. Levels of measurement (nominal, ordinal and scale variables)

5. How to enter your data into SPSS

6. How to code, replace and define missing values in SPSS

* If you are unsure about which variables are categorical, have a look at the Levels of

Measurement guide mentioned above.

Return to:

1.1 Naming and Entering Variables

The Variable View

The Data View

1.2 Defining Variables

The Variable View

A few tips on defining variables