You are on page 1of 68

Dr. Christine Pereira Academic Skills Adviser ask@brunel.ac.

uk

Purpose and use of SPSS Open SPSS What is a Variable? Defining variables in SPSS Entering Data Open and save data files Import data from Excel Handling missing data

PURPOSE & USE OF SPSS


SPSS is a Statistical Software Package SPSS is a tool It only does what its told to do. It does not think for you It is not a black box You need to know the correct statistics for your research BEFORE using SPSS. If you understand the statistics, then you are ready to do analysis in SPSS.

Select SPSS 18 from the list

Type SPSS 18 into the search box

Click on the Windows Start Icon

Open NEW data file

Always open SPSS first, then open or type in data.

DEFINE VARIABLES

Enter variable names in the first column. We will look at all the columns in more detail shortly.

ENTER DATA

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

Enter the data for each variable from the Data View. We will also look at entering data in more detail shortly.

W H AT HOW

I S A VA R I A B L E ?

D O W E D E F I N E VA R I A B L E S I N S P S S ?

WHAT IS A VARIABLE?
A measurement:
A characteristic (e.g., Gender, Age, Height, Weight) Time points (e.g., pre-test, post-test, T0, T1, T2)

Experimental Condition (e.g., Condition,


Experimental grp) respondents level of agreement with a statement)

Opinion/belief (e.g., A survey question which asks for a

Etc

Variables go in Columns

What is your gender?

Male or Female

Variables go in Columns

How long does it take, on average, to commute into Uni?

Variables go in Columns

What is your main mode of transport to Uni?

Variables go in Columns

Indicate your level of agreement with the following statement: Most days, my commute causes me to feel stressed when I arrive at university.

IDENTIFYING VARIABLES
Questionnaire Responses Random sample of 200 residents of Uxbridge of varying genders, ages and political affiliations. Asked respondents their view on stem cell research using a 3 pt. Likert Scale (Disagree, No Opinion, Agree). Asked respondents if they believed global warming was an important issue using a 5 pt. Likert Scale (Strongly Disagree to Strongly Agree).

Variables go in Columns

Experimental Condition
Cond 1 and 2 are independent, NOT repeated measures.

Variables go in Columns

Score on a test

IDENTIFYING VARIABLES
CAFFEINE AND SLEEP 30 participants were used to investigate the effect of caffeine on their ability to sleep. The 30 participants were randomly assigned to one of 2 conditions: No caffeine (control) or one dose of caffeine every 3 hours from 9am-6pm. The study measured participants ability to sleep by taking the average number of hours slept per night over a 2 week period.

Variables go in Columns

Status at entrance to care facility

Variables go in Columns

Anxiety level measured at 3 time points for each participant

Variables go in Columns

Why not enter like we did for

IDENTIFYING VARIABLES

Fitness regime 50 participants of varying fitness levels were used to investigate whether personal trainers make a significant difference in ones fitness. Participants were randomly assigned to one of two training groups: self training or professional trainer. Each participants 1 mile time (in mins) was recorded 2 days prior to the start of the study. Each group then followed a specific training regime for 30 days and their 1 mile time (in mins) recorded again.

Identify the variables for this problem


*Hint, there are 4 of them

IDENTIFYING VARIABLES

Fitness regime 50 participants of varying fitness levels were used to investigate whether personal trainers make a significant difference in ones fitness. Participants were randomly assigned to one of two training groups: self training or professional trainer. Each participants 1 mile time (in mins) was recorded 2 days prior to the start of the study. Each group then followed a specific training regime for 30 days and their 1 mile time (in mins) recorded again.

How would we enter the data in a table?


Write down column headings Record hypothetical data for 2 participants

LEVELS OF MEASUREMENT
Variables

Categorical
Qualitative

Scale
Quantitative

Nominal
(Unranked categories)

Ordinal
(Ranked categories)

Not grouped

Marital Status Political Party Eye Color

Satisfaction level Level of agreement

Height Weight Age No. of cars No. of students

In SPSS, data is either Nominal, Ordinal or Scale. It is essential to classify data correctly.
- Incorrect classification may result in incorrect analyses.

CODING

C AT E G O R I C A L VA R I A B L E S

OPEN SPSS E N T E R D ATA S AV E F I L E S

Coding Categorical Variables

Level of Measurement?

Categorical variables need to be coded Scale variables do not need to be coded

Coding Categorical Variables

0 0 1 0 1 1 0 1 0 1

Level of Measurement?

0 = Male 1 = Female

Coding Categorical Variables

Level of Measurement?

Scale, does not need to be coded

Coding Categorical Variables

Level of Measurement?

1 2 1 1 1 3 4 1 2

1 = tfl (i.e. public transport) 2 = Car 3 = Cycle 4 = Walk

Coding Categorical Variables

Indicate your level of agreement with the following statement: Most days, my commute causes me to feel stressed when I arrive at university.

Coding Categorical Variables

Level of Measurement?

2 4 5 5 4 2 1 3 2

1 = Strongly Disagree 2 = Disagree 3 = I dont know 4 = Agree 5 = Strongly Agree

Coding Categorical Variables

Data has been coded Now were ready to enter it in SPSS

Entering Data
1. Enter & define variables from Variable View.

Variable names
Must begin with a letter No spaces and no special characters (except _ )

Entering Data
1. Enter & define variables from Variable View.

Type
Should (almost) always be numeric SPSS cannot analyse non-numeric data

Entering Data
1. Enter & define variables from Variable View.

Decimals
How many decimal places do you want to see in the Data View?

Entering Data
1. Enter & define variables from Variable View.

Label
IMPORTANT!!! Make good labels! Short description of the variable This is what will be written on all graphs & tables

Entering Data
1. Enter & define variables from Variable View.

Values (i.e., Value labels)


IMPORTANT!!! - Tell SPSS what all the codes represent! This is what is written on all graphs & tables

Entering Data
1. Enter & define variables from Variable View.

Entering Data
1. Enter & define variables from Variable View.

Missing
We will come back to this one shortly.

Entering Data
1. Enter & define variables from Variable View.

-1

Measure
Level of Measurement (Nominal, Ordinal, Scale) By default ALL new variables are scale YOU must choose the appropriate measure

Entering Data
2. Enter data from Data View.

Variable names
Will become column headings in Data View.

Entering Data
2. Enter data from Data View.

Rows
Subject entries For example, participant responses to survey questions. Row 1 is participant 1, etc

Entering Data

Now, lets enter some data

SAVING YOUR SPSS FILES

SAVING YOUR SPSS FILES


Locate a folder to save it in:
On your H drive OR On your pen drive

Name it appropriately Extension .sav

OUTPUT FILE
Shows output for ALL analysis run in SPSS Keeps a log of all activity of open data files Saved with the extension .spv

Everything done in SPSS is shown here, in outline form.

A data file was saved as SPSS_Part1_Ex7.sav. This was recorded in the log here.

CREATING A NEW SPSS FILE New data file New output file

OPEN AN EXISTING SPSS FILE Existing data file Existing output file ALWAYS open SPSS first! If you try opening a data file from a folder, SPSS will NOT work

FROM EXCEL

THE EXCEL FILE


Log onto U-Link. Go to the ASK section. Academic Skills Resources Statistics and SPSS Stats Workshops 2011-12 Basics of SPSS Workshop Download the Excel File: CommutingSurvey.xlsx

FOR EXAMPLE.
Filename
(.xlsx)

IMPORTING DATA FROM EXCEL.

Variable names
(Row 1)

Sheet1 contains the dataset

IMPORTING AN EXCEL FILE


Can be .xls OR .xlsx

Variable names CAN be imported too


Must be in row 1 of the worksheet

Data will appear in SPSS Data View

IMPORTING DATA INTO SPSS 18

Existing data file

FOR EXAMPLE.
3

IMPORTING DATA FROM EXCEL.

Select the Excel file

Find the folder where you saved the file

Choose Excel file type to see your .xlsx

FOR EXAMPLE.

IMPORTING DATA FROM EXCEL.

Is this range correct?

If NOT
Enter correct range here

FOR EXAMPLE.
Variable Names
(from Row 1)

IMPORTING DATA FROM EXCEL.

View all data

FOR EXAMPLE.

IMPORTING DATA FROM EXCEL.

View and Define variables


This variable name from Excel could not be used. SPSS made it a label and created a new variable name

H O W T O H A N D L E M I S S I N G D ATA

REPLACE MISSING VALUES

There are 3 missing values for TravelTimemin

Replace missing values with a code Use a code that will not occur for the variable Lets use -1, as negative time is not possible

REPLACE MISSING VALUES

REPLACE MISSING VALUES


Select the variable you want to recode Click here to recode the variable

REPLACE MISSING VALUES


Enter the code as the new value
5

Click Add. MISSING -> -1 will appear here

Click Continue then Click OK

REPLACE MISSING VALUES

Missing values have been replaced with -1 for TravelTimemin

CODE MISSING VALUES

Remember From Variable View Define the missing values

CODE MISSING VALUES

Missing
Missing data must be coded too! Chose a number not in the data, like 99 or 999 Replace all missing values in your data with this code first

CODE MISSING VALUES

This is only a code it tells SPSS what values represent missing values. It does not replace missing values with the code for you!

SPSS Course: University of Colorado at Colorado Springs:


http://www.uccs.edu/~faculty/lbecker/SPSS/content.htm

SPSS Tutorials (lots of links on this site):


http://www.uccs.edu/~faculty/lbecker/SPSS/content.htm

SPSS On-Line Training Workshops (tutorials & videos):


http://calcnet.mth.cmich.edu/org/spss/toc.htm

SPSS Survival Manual, 4th Edition (2010) by Julie Pallant.


(For SPSS Version 15 or later)

Discovering Statistics Using SPSS, 3rd Edition (2009) by Andy Field.


(For SPSS Version 15 or later)