Getting Data Into SPSS 16.

26
Getting Data Into SPSS 16. Jean Russell Bob Booth April 2010 AP-SPSS4 University of Sheffield

Transcript of Getting Data Into SPSS 16.

Page 1: Getting Data Into SPSS 16.

Getting Data Into SPSS 16.

Jean Russell

Bob Booth

April 2010

AP-SPSS4

University of Sheffield

Page 2: Getting Data Into SPSS 16.

Jean Russell, Bob Booth Getting Data into SPSS 16

2

Contents

1. INTRODUCTION ............................................................................................................................ 3

1.1 UNITS .................................................................................................................................................. 3 1.2 VARIABLES .......................................................................................................................................... 4

2. STARTING SPSS ........................................................................................................................... 5

2.1 THE HELP AVAILABLE IN SPSS ........................................................................................................... 6 2.2 EXERCISE ............................................................................................................................................ 7

3. ENTERING DATA INTO SPSS ...................................................................................................... 8

3.1 TYPING DATA INTO SPSS .................................................................................................................... 8 3.2 SAVING AND LOADING SPSS DATA ................................................................................................... 12 3.3 STRAIGHT DATA ENTRY – EXERCISES. .............................................................................................. 14

4. ENTERING DATA FROM OTHER PACKAGES .......................................................................... 16

4.1 ENTERING DATA FROM AN EXCEL SPREADSHEET .............................................................................. 16 4.2 IMPORTING DATA FROM A TEXT FILE ................................................................................................ 17 4.3 IMPORTING DATA FROM A DATABASE ............................................................................................... 18

5. TRANSFORMING VARIABLES ................................................................................................... 21

5.1 COMPUTING VARIABLES .................................................................................................................... 21 5.2 RECODING VARIABLES ...................................................................................................................... 22 5.3 EXERCISES ON ENTERING DATA FROM OTHER PACKAGES ................................................................. 23

6. FURTHER READING ................................................................................................................... 26

Page 3: Getting Data Into SPSS 16.

Jean Russell, Bob Booth Getting Data into SPSS 16

3

1. Introduction

This document introduces you to the statistical software SPSS, version 16,

which is available on the Managed XP Service, and can be installed on

personal Windows Vista, XP computers or Macs with OS prior to Snow

Leopard. For Windows 7 PCs and Macs with Snow Leopard PASW 18 is

available.

The document deals with getting data into SPSS and simple data management.

There are no statistical techniques taught in this document, however the way

data entry works in SPSS uses a couple of statistical concepts. These are Units

and Variables.

1.1 Units

A Unit is an entity that is the subject of your investigation and has associated

characteristics. It could be a person, a mouse, a field, a rock specimen or a

family, for example. Consider the following studies and determine the

appropriate unit for each study.

Voting patterns of 18 year olds.

Lung functions of people who have been cured of childhood cancer.

Family income in inner city areas.

Working lives of light bulbs.

The strength of a piece of plastic tube made by a new process.

The effect of nitrogen on the amount of wheat produced.

In SPSS units are referred to as cases, other software packages use different

names.

Page 4: Getting Data Into SPSS 16.

Jean Russell, Bob Booth Getting Data into SPSS 16

4

1.2 Variables

Variables are the characteristics of units, for example the weight of a person,

the colour of a person's eyes, the drug that a person is given, or the amount of

glass fibre in a pipe. There are various categories of variables as seen below:

Variable Type Typical Values Examples

Binary/ Yes/No Variable Gender

Dichotomous

Nominal More than two categories Colour, Drink

Ordinal Has an order to it Military Rank

Counted Positive integers Number of children

Scaled Wider range of values Hads

Continuous Zero has significance Temperature

It is helpful to distinguish between three types of variable that you can get in

statistical analysis. The first type is Nominal. This is a value where the options

are qualified by a name only e.g. blood group, favourite pop-groups, colour,

group allocated to. When using these types of variables you should not be able

to say that one order of values is correct and another order of values is wrong.

A special case of this, statistically, is when there are only two possible answers

e.g. gender, drinks coffee. A good way to check is to see if you can re-phrase

the question so that a simple yes or no response would contain all the

information you are interested in. If you find that you want to ask more

questions, then your variable is NOT binary.

The next type is Ordinal. In this you still have distinct options, but these

options have an order. The most common example is social class but it also

covers military rank (or rank in any organisation). Most questions where

people are asked how much they like something are ordinal, as are most Likert

scales.

Finally there are Scale variables. These not only have order like ordinal

variables but also the difference between values has meaning. It is fairly

evident that the relationship between an archbishop and a bishop is not the

same as the relationship between a curate and a vicar yet these would both be

next to each other on a scale. However, the difference between having 2

children instead of 1 child is exactly the same as having 5 children instead of

4. The scale variables are what most people think of as variables.

This may seem trivial, but all analyses require an understanding of the nature

of the variables.

Page 5: Getting Data Into SPSS 16.

Jean Russell, Bob Booth Getting Data into SPSS 16

5

2. Starting SPSS

SPSS 16 can be installed on Windows XP Vista and older Mac machines.

After installation the software will be available from the Start menu, under

Programs. On the Managed XP Service, SPSS is also available from the

Programs menu.

When SPSS starts you will see the following dialogue box.

Page 6: Getting Data Into SPSS 16.

Jean Russell, Bob Booth Getting Data into SPSS 16

6

There are five options and you are most likely to either type data into SPSS or

open an existing data file. These are covered in the following two sections.

You can choose not to load this initial dialogue box, in which case starting

SPSS will automatically place you in the Type in data mode.

2.1 The Help Available in SPSS

SPSS has a collection of help tools from the Help menu. Topics leads to the

normal help files that you find in all packages, containing information on how

to perform specific tasks, for example, how to declare a missing value.

However SPSS has several other forms of help available from the Help menu.

It has a Tutorial that is a basic introduction to SPSS, and covers very much the

same areas as the course. More advanced tutorials can be obtained, but they

are not part of the site license we have at Sheffield.

It also contains tools, called coaches, these require Internet Explorer. The

Statistics Coach will help you select the statistics to perform. Be wary of this

tool, as it may encourage type 3 errors (the correct answer to the wrong

question). The algorithm used is fairly simple. It will not consider all the

information known about the data prior to analysis, nor does it directly

consider the actual question you are asking. Therefore, it may suggest a variety

of analyses, no analysis, or even suggest an inappropriate analysis. Although it

can be useful, the Statistics Coach is no substitute for understanding statistical

tests or reading a textbook.

The Results Coach is more satisfactory. It is only available when you are

editing an output object, and will help you interpret the analysis. However, it

will take one line for interpretation when there are often a variety in the

literature. You will need the line that is commonly used in your subject.

There is also a Syntax Coach. This is different from the other coaches in that

it does not depend on Internet Explorer. It gives the command syntax for

SPSS. At present I recommend you ignore this option, though for the more

experience user, it is likely to be the part of the Help system that you use most

often.

Finally, if you select part of an output object and click the right mouse button,

a pop-up menu will appear. One of the options will be What is this? This will

give a definition of the item selected.

Page 7: Getting Data Into SPSS 16.

Jean Russell, Bob Booth Getting Data into SPSS 16

7

2.2 Exercise

Start SPSS, in Type in Data mode, then go to the Help menu.

Basic

1. Lookup how to carry out an independent sample t-test

2. Lookup the following terms

Chi-squared;

Pearsons Correlation;

Harmonic Mean.

Follow on

1. Have a look at the tutorial given under SPSS Help menu.

Close help, then go to the Variable View of the data sheet.

Page 8: Getting Data Into SPSS 16.

Jean Russell, Bob Booth Getting Data into SPSS 16

8

3. Entering Data into SPSS

3.1 Typing Data into SPSS

To type data into SPSS select the Type in data option. You will see the

following window:

Defining a Variable

However, before you begin to input your data, you need to define your

variables. Click the Variable View tab to display the following window:

Give the first variable a meaningful name by typing text into row 1 under the

Name column. Variable Names can now be of any length but must not contain

Page 9: Getting Data Into SPSS 16.

Jean Russell, Bob Booth Getting Data into SPSS 16

9

spaces or mathematical symbols such as “-“. They also may not start with a

number. The variable names are not case sensitive but will maintain the case

as you first enter them.

Select the cell under Type and click the button to define the variable type.

Historically, SPSS had only the Numeric and String variable types, but now

many formats are available. The top four formats are various numeric formats.

Selecting Date will produce a menu containing about thirty date formats, so

that you can choose how you want the dates to be displayed. Although there

are a vast variety of styles in which dates can be displayed in the actual data

file they are stored in a single form. Dates are stored as the number of seconds

since midnight on 14th

October 1582, the start of the Julian Calendar.

Therefore dates are very large numbers when viewed without an output

format. The difference between one day and the next day is 86,400 seconds, so

to find the number of days between any two dates take one from the other and

divide by 86,400.

String deals with all alphanumerics that do not fit into any of the above

criteria. However, there are many ways of spelling, for example, male.

Without going into abbreviations, wrong spellings, unusual capitalisation or

spaces in the middle of the word, there are still at least nine different character

strings that are six characters long (6 is the shortest string one can use for a

gender variable, because female is 6 characters long). There are three basic

capitalisations (male, Male & MALE) and three ways of placing blanks (0, 1,

or 2 blanks before male and the rest afterwards). This gives us nine different

spellings. It is far easier to remember 1=male and 2=female than to be

consistent in your spelling when entering data. Secondly, if the variable is

actually ordinal rather than nominal, then string variables are ordered

alphanumerically, which is often not the order you require. Thirdly, some

techniques in SPSS are not able to use string variables, even when the

technique requires that the variable is theoretically nominal.

Page 10: Getting Data Into SPSS 16.

Jean Russell, Bob Booth Getting Data into SPSS 16

10

Unfortunately, when you are dealing with currency, you have to select the

Dollar variable type, as Custom currency is even less helpful. However, the

standard numeric (width 8, decimal places 2) works for currency if you are

happy to work without a currency symbol.

In the Labels column, you can supply a label for the variable.

This was introduced as an aid to memory. Variable labels do

not have the limitations of variable names and you can put any

text you want into it although it does not have subscripts or superscripts. You

can therefore store quite a long memo on what the variable is here. This

description will often appear when carrying out an analysis, and will be the

label on the appropriate axis for a graph.

Select the cell under Values and click the button to assign

labels to specific values of the variable, for example 0=no,

1=yes.

Enter the value and the corresponding label, then click the Add button. Repeat

for each label required. When you return to the Data sheet you can choose to

display either the values or the labels using the Value Labels button.

Page 11: Getting Data Into SPSS 16.

Jean Russell, Bob Booth Getting Data into SPSS 16

11

You can define how SPSS handles missing data by selecting

the cell in the Missing column, then clicking the button to get

the following dialogue box.

For a variety of reasons you may not always know the value for a specific case

of a variable. Test results may go missing or off the measurable scale. A

variable may not relate to that case e.g. asking whether a man has had a

hysterectomy. A respondent may refuse to provide the information. SPSS has a

system to deal with missing values for numeric variables, which it uses if a cell

is left blank. This value is represented by the ˈ.ˈ character. This case would be

dropped from any technique that uses that variable. It is possible to use this

solely for your missing values, but as you get missing ones for different

reasons you may want to distinguish as to why a value is missing. To do so

you need to tell SPSS which values are to be treated as missing. It is also

useful to have value labels for these variables.

There is a variety of missing value conventions. Clearly, the values assigned to

missing codes must be distinct from the values that are likely to occur if you

have a genuine response. One convention used is listed below:

If the variable is categorical (either nominal or ordinal) with a few

categories (5 or less), then the first missing code is normally assigned to 9.

If there is more than one type of missing code, 8 and 7 are used.

If a variable can only take positive numbers then –1 is used as the first

missing code with –2, -3 etc used for further codes.

Otherwise a large negative number is commonly used. It starts with

–999.99, then –888.88 and –777.77 are used for further codes. However,

you could equally well choose different numbers.

This allows you to vary the column width that the data displays

in. Before we had dragging with a mouse this was useful and

important information. Today this is far more easily altered

using the mouse than by typing in numbers into this space. Basically, columns

is the number of characters that are displayed for that variable in the data view.

An integer is thus required and by default would give eight. Normally I leave

this as it is. However in the case of a variable being likely to take a really large

Page 12: Getting Data Into SPSS 16.

Jean Russell, Bob Booth Getting Data into SPSS 16

12

number (or dates) then it is a good idea to make sure this width is wider than

the width required otherwise you see “**********” rather than the number.

This allows you to specify whether the data in this variable is

displayed with left, right or central alignment. There is no

ability to justify data in SPSS.

The measure is whether a variable is nominal, ordinal or continuous. When

this first came in there was not really any point to it apart from actually

deciding this in advance. Now however with the latest graphing it changes

how variables are treated. So for instance a nominal variable when used for

colour will be distinct colours while a nominal variable will alter the shading.

Also if you use the tables then you get frequencies for nominal variables and

means (or other statistics) for continuous. By default, numeric variables are

treated as continuous and string variables are treated as nominal.

Entering Data

Once you have defined all your variables you can proceed to type in your data,

as you would a spreadsheet. Place the cursor in the cell where you want to

enter data, then type the value you want and press the Enter key. This will

place the value in the cell and move down to the cell below. You can also

move from cell to cell using the arrow keys, the Tab key, or the mouse.

3.2 Saving and Loading SPSS Data

Once you have entered all your data into SPSS you should save it into a data

file. Ideally you should save your data many times before this, say after

defining your variables, then after inputting data for several units, and so on

until your data is complete.

To save your data file either click the File menu and select Save, or click the

usual Save button. You will see a typical Windows Save dialogue.

Page 13: Getting Data Into SPSS 16.

Jean Russell, Bob Booth Getting Data into SPSS 16

13

From here you can specify the name for your data file, and use the Save in

field to specify the drive and folder in which to save the file. You can even use

the New Folder button to create a new folder in which to save your data

file.

SPSS data files are usually saved with the extension .sav, but in the Save as

type field you can see some other formats for SPSS data. Data can be saved in

text files with the extension .txt or .dat, or as Excel data with the extension

.xls. You can also save data in other, less common, formats.

When you return to SPSS you can load existing SPSS data files using Open

from the File menu, or by using the usual Open button from the Toolbar. All

the data files ending in .sav will be available, and you can load any data file by

selecting it, then clicking the Open button. In addition you can load data from

other applications, as described in the following sections.

WARNING if you save the data file to the name of a file that already exists or

even just save data, it overwrites the original file and there is no way to undo

the changes. Therefore when you make significant changes to a data file it is a

good idea to save it as a new name.

An even better idea is to document your changes by going to the Utilities

menu and then onto the Data Files Comments which will bring up the

following window where you can write down what changes you have made

Then save the file under a new name.

Page 14: Getting Data Into SPSS 16.

Jean Russell, Bob Booth Getting Data into SPSS 16

14

3.3 Straight Data Entry – Exercises.

1. Create a variable for the identifier for a case with variable name „IDNO‟

and type string of length 3.

2. Create a variable named „GENDER‟, whose type is a numeric of length 1

with no decimal places.

3. Give the Gender variable the variable label of “Sex of Respondent”

4. Give the Gender variable value labels so as typing in 1 indicates the

respondent is male and typing in 2 indicates the respondent is female.

5. Set the Gender variable so as it has a missing value of 9.

6. The measurement level is „nominal‟

7. Create a variable named „SEASON‟, whose type is numeric of length 1

with no decimal places.

8. Give the Season variable the variable label “Season Born in”.

9. Give the Season variable value labels such that typing 1 indicates spring, 2

indicates summer, 3 indicates autumn and 4 indicates winter.

10. The measurement level for this is „ordinal‟.

11. Set up the following Numeric variables:

Name Width Decimal

Places

Variable

Label

Value Labels Missing

Value

measure

UKBIRTH 1 0 Born in the U.K. 0=no 1=yes

9 Nominal

SWEET 1 0 Favourite food is sweet 0=no 1=yes

9 Nominal

CONSUME 1 0 Method of consumption 1=eat 2=drink

9 Nominal

TIMES 3 0 Times consumed in last year -1 Continuous

COST 6 2 Cost of average serving -1 Continuous

SALTY 1 0 Food is salty 0=no 1=yes

9 Nominal

CHOC 1 0 Food contains chocolate 0=no 1=yes

9 Nominal

TYPE 1 0 Type of food 1=snack 2=savoury 3=dessert 4=drink

9 Nominal

12. Switch to Data View and enter the following already coded data: IDNO GENDER SEASON UKBIRTH SWEET CONSUME TIMES COST SALTY CHOC TYPE

R01 1 4 1 0 1 40 .50 1 0 2

R02 1 2 1 0 1 5 3.00 0 0 2

R03 1 3 1 1 1 503 .15 0 0 1

R04 1 3 1 0 1 159 .07 0 0 2

R05 1 3 1 0 1 10 33.00 0 0 9

R06 2 1 1 0 1 15 .58 1 0 2

R08 1 3 1 1 1 5 1.95 0 0 3

R09 1 3 1 1 1 47 .24 0 0 1

R10 1 3 1 0 1 325 .30 1 0 1

R11 2 4 1 0 1 12 1.10 0 0 2

R12 2 4 0 0 1 12 1.80 0 0 2

R13 2 3 1 0 1 50 .89 0 0 2

R14 1 3 1 1 1 1 .50 1 0 3

R15 1 4 1 0 1 -1 4.95 9 0 2

R16 2 1 1 0 1 20 .30 0 0 1

R17 1 1 1 0 1 100 31.00 0 0 9

R18 2 2 1 0 1 6 .75 1 0 1

R19 2 3 0 1 1 1 .80 0 0 3

Page 15: Getting Data Into SPSS 16.

Jean Russell, Bob Booth Getting Data into SPSS 16

15

R21 1 1 1 0 1 200 .05 0 0 1

13. Save the data to a file called „Real Data.sav‟.

Follow on

1. Switch the value labels display on and off.

2. Trying entering the following un-encoded questionnaires.

Favourite Food

Are you male or female? M

Which season of the year does your birthday fall? Autumn

Were you born in the U.K.? Yes.

Is your favourite food sweet? No.

Do you eat or drink your favourite food? Eat.

How often have you had your favourite food in the last year? 300-350 times.

How much approximately does your favourite food cost per serving? 30p

Does your favourite food salty? Yes.

Does your favourite food contain chocolate? No.

Would you normally have your favourite food as a snack or savoury or dessert or drink?

Snack.

Favourite Food

Are you male or female? M

Which season of the year does your birthday fall? Winter

Were you born in the U.K.? Y

Is your favourite food sweet? Y

Do you eat or drink your favourite food? E

How often have you had your favourite food in the last year? 90

How much approximately does your favourite food cost per serving? £0.5

Does your favourite food salty? N

Does your favourite food contain chocolate? N

Would you normally have your favourite food as a snack or savoury or dessert or drink?

Breakfast

Favourite Food

Are you male or female? In transition

Which season of the year does your birthday fall? Bed of pepper

Were you born in the U.K.? Oui

Is your favourite food sweet? No it is main course

Do you eat or drink your favourite food?

How often have you had your favourite food in the last year?

35 million, one hundred and forty five thousand six hundred and twenty-one times, not

that I am counting.

How much approximately does your favourite food cost per serving? 20p

Does your favourite food salty? Only when I put salt on it.

Does your favourite food contain chocolate? No

Would you normally have your favourite food as a snack or savoury or desert or drink?

Savoury

Page 16: Getting Data Into SPSS 16.

Jean Russell, Bob Booth Getting Data into SPSS 16

16

4. Entering Data from Other Packages

4.1 Entering data from an Excel Spreadsheet

To load data that is contained in an Excel spreadsheet into SPSS, click the File

menu, select Open, then from the sub-menu select Data to load the usual

dialogue box. In the Files of type field select Excel (*.xls) as below.

Locate the Excel file in the usual way, then select it and click the Open button.

You will see the following dialogue box.

Here you can ask SPSS to take variable names from the data headings in the

spreadsheet, and, if you only wish to import part of the data, you can also

specify a range. If your Excel file contains multiple worksheets you should

specify the sheet that contains the relevant data. Having done this, click the

OK button.

Page 17: Getting Data Into SPSS 16.

Jean Russell, Bob Booth Getting Data into SPSS 16

17

SPSS will then attempt to load the data, and will produce a report log of its

progress. If it succeeds the data window will fill with the Excel data. This

process works well for raw data and for simple formulae, but inevitably you

may encounter problems with more sophisticated worksheets.

4.2 Importing Data from a Text File

Importing data from a text file is more complex than importing it from Excel,

because text files can be much more varied in their data structure. To load a

text file click the File menu, but then select Read Text Data. This will

produce an ordinary looking dialogue box as below.

Select the data file as usual, then click on the Open button to start a Text

Import Wizard, which will ask you a series of questions about the data before

importing it.

Page 18: Getting Data Into SPSS 16.

Jean Russell, Bob Booth Getting Data into SPSS 16

18

The questions are mostly straightforward, although you might need several

attempts to successfully import your first text file. Once you have answered the

questions on the first screen, select the Next button to proceed to more

questions. It is worth mentioning that screen five displays your variables,

allows you to select each one, and then defines properties for that variable. On

the last screen, screen six, the Finish button becomes available. Click this to

load the data into your data screen. The process may seem daunting, but it

works very well so don't be afraid to try it.

4.3 Importing Data from a Database

SPSS is able to import data from databases such as Microsoft Access. To

import data from a database, you use a wizard, similar to the text import

wizard. Click the File menu and select Open Database, then from the sub-

menu select New query.

First you need to define your database as a data source. Click the Add ODBC

Data Source button.

Page 19: Getting Data Into SPSS 16.

Jean Russell, Bob Booth Getting Data into SPSS 16

19

Select the type of database then click the Add button. In the next window

select the file type again (Access, Excel, etc) then click the Finish button to

load the following window.

Give the database a meaningful name in the Data Source Name box, then

click the Select button to produce a File Open dialogue box in which you can

specify the file. Click three OK buttons in succession to return to the original

wizard. Your new data source will appear in the list, select it then click the

Next button.

The second screen will list the tables and queries from your database. To

import any table or query, drag it from the left window to the right. When you

have done this click the Next button.

Page 20: Getting Data Into SPSS 16.

Jean Russell, Bob Booth Getting Data into SPSS 16

20

In the third screen, specify the relationships between imported tables by

dragging links from one table field to another.

In the fourth screen, specify limits on the imported data fields by building

criteria.

In the fifth screen, specify variable names for all the imported fields.

The sixth screen shows the syntax for the operation. Click the Finish button to

import your data.

Page 21: Getting Data Into SPSS 16.

Jean Russell, Bob Booth Getting Data into SPSS 16

21

5. Transforming Variables

SPSS allows you to perform a vast range of calculations on your variables,

including mathematical formulae, logical calculations, occurrence rates,

standard string edits and string to number conversions. These are all available

from the Transform menu, and you can find details on their usage in the SPSS

Help system.

5.1 Computing Variables

The most common variable transformation is computation. To perform a

computation, click the Transform menu and select the Compute variable

option to see the following dialogue box.

Type the name of the variable that will contain the result of the calculation into

the Target Variable field, then build the expression in the Numeric

Expression field, using the buttons and functions beneath it if necessary. Use

the If button to define any conditions that apply to the computation, then when

the expression is complete click the OK button.

Page 22: Getting Data Into SPSS 16.

Jean Russell, Bob Booth Getting Data into SPSS 16

22

5.2 Recoding Variables

Sometimes you need to group continuous variables into discreet ranges.

Although it is possible to group a continuous variable into categories using

repeated transforms or complicated formulae, recoding offers a much neater

way of doing this. To carry out a recode, click the Transform menu, select

Recode into Different Variables. Do not recode into the same variables

unless you have never made a mistake in your life! You will see the following

dialogue box.

The left-hand column lists your variables. Select one with values that you wish

to group then click the little arrow button to place this variable in the Input

Variable -> Output Variable field. Then, in the Output Variable field, type in

the name of the new variable that will contain the group values, and click the

Change button.

Next click the Old and New Values button to get the following dialogue box.

Here you specify the values that will be grouped into the new groups. Press

Continue when you have finished. Then click the OK button in the previous

dialogue box to complete the recode.

Page 23: Getting Data Into SPSS 16.

Jean Russell, Bob Booth Getting Data into SPSS 16

23

5.3 Exercises on Entering Data from other Packages

Demonstration

1. Open the data from the Excel file “Favourit.xls”

2. Go to Menu Analyze Case Summaries List cases and take the variables

gender, season, ukbirth across and see if you can spot the data entry

problems:

Variable Case/unit problem

3. Set the variables labels for this data set and save as “excel data.sav”.

4. Using the Excel file you have just opened go to Transform Menu

Automatic recode … . Take the variable gender across and give it the new

name sex.code . How many sexes does this data set have?

5. Go to TransformRecode into different variable. Then take across recode

and code the terms into a sensible grouping of sexes.

Old

value

Old value label New

Value

New Value Label

6. Make notes on the changes made under UtilitiesData file comments

7. Open the dataset called Favourit.sav

8. Go to Transform Compute, on the box in the top Left hand corner type in

Ann.cost. In the box in the Right Hand side you need to get times * cost. Press

the OK button. How much does the tenth person spend per year?

Page 24: Getting Data Into SPSS 16.

Jean Russell, Bob Booth Getting Data into SPSS 16

24

9. Often used to „normalise‟ data that is counted is the log transformation. Do this

to the times a person has their favourite food in a year (times). Now calculate

the lg10 of the annual cost.

10. Create a ordinal variable from the cost of a serving (cost) into cheap, moderate,

expensive categories, where cheap is less than £1.00, moderate between £1:00

and £5:00, and expensive is greater than £5:00 using the Recode into option

under the Transform menu. Which group does the tenth person in the dataset

fall into

Less that £1:00

£1:00 to £5:00

More than £5:00

11. Document the calculations in the Data File Comments and then save the data.

Exercise

1. Open the file “Breast Cancer.sav”

2. Calculate age of diagnosis by subtracting the time (time in months since

diagnosis) from Age (age in years). Notice one is in months and one in years so

you will divide time (time in months since diagnosis) by 12!

3. Round the age diagnosed down to a whole number using the trunc() function.

How old was the thirtieth women in the data set when she was diagnosed?

4. Divide the women on whether they were pre or post fifty as an approximation

to pre or post menopause at the time of diagnosis!

5. What do the following functions do?

Mean()

Abs()

Any()

Time.days()

Homework or to do when you are bored:

1. Enter a dataset which is relevant to your work, labelling properly, setting

missing values and putting comments in the file.

Page 25: Getting Data Into SPSS 16.

Jean Russell, Bob Booth Getting Data into SPSS 16

25

2. Revise some basic statistics either by working through chapter 1 “Everything

you ever wanted to know about statistics (well sort of)” from Discovering

Statistics Using SPSS by Andy Field or using any other basic statistics text e.g.

Statistics without Tears by Derek Robinson, or The Cartoon Guide to

Statistics by Larry Goonick and Woollcott Smith or work through learning

package on the managed desktop Statistics for the Terrified

3. Read How to lie with Statistics by Darrell Huff.

4. Work through the tutorial on the SPSS help menu more carefully or work

through “Chapter 2 The SPSS Environment”

Page 26: Getting Data Into SPSS 16.

Jean Russell, Bob Booth Getting Data into SPSS 16

26

6. Further Reading

SPSS Books

Discovering Statistics Using SPSS, Andy Field, Sage Publications, ISBN 0-

7619-4452-4

This is a book that is both a statistics text and an SPSS primer. It covers a

large number of techniques (all introduced in this course and more) along with

the background theory of how they work. For those who want to go further, I

have referenced the relevant pages in Field for each statistical technique

covered in this user guide.

SPSS Made Simple, Kinnear & Grey, ISBN 0-8637-7350-8, £12.43 for v 15

A good introduction to SPSS, costing about half the price of a single manual.

It is written by academics in Aberdeen.

SPSS Guide to Data Analysis, Marya Norusis, ISBN 0-13-020399-8. £44.99

More than a manual, it details why and how to use SPSS for analysing your

data. It has become a classic, but costs about twice as much as Kinnear &

Grey. If you want a book from SPSS, this is preferable to a manual.

General Statistics Books

The Cartoon Guide to Statistics, ISBN 0-5062731025, £9.99

A basic introduction to statistical thinking.

How to Lie with Statistics, ISBN 0-393310728, £5.99

This book is a good read, even if the closest you get to statistics is reading

what someone else has done. It goes through the basic ways that research may

be reported to mislead.