Spss Tasks
Spss Tasks
SPSS v12
Using SPSS
Exercises
Contents
SPSS course exercises.......................................................................................1
Exercise 1: Defining variables and entering data.............................................1
Exercise 3: Missing data....................................................................................2
Exercise 4: Importing an Excel file..................................................................3
Exercise 5: Sort Cases and Select Cases...........................................................3
Exercise 6: Recoding variables..........................................................................3
Exercise 7: Computing variables.......................................................................4
Exercise 8: Creating and saving output............................................................4
Exercise 9: Frequencies command....................................................................5
Exercise 10: Descriptives command..................................................................5
Exercise 11: Crosstabulations command...........................................................5
Exercise 12: Means command...........................................................................6
Exercise 13: T Tests...........................................................................................6
Exercise 14: Correlation....................................................................................6
Exercise 15: Regression....................................................................................7
Exercise 16: Graphical plots..............................................................................7
Data type
Categorical (categories are Female and Male)
Continuous
Continuous
Categorical (categories are Smoker and Nonsmoker)
Continuous
Continuous
Hbefore
Hafter
2. The table below shows the data which you have collected from five
patients who took part in a pilot study for the clinical trial. Switch to the
Data Editor and enter the data on these five patients. Remember to use
numeric codes where necessary.
Surname
ROBBINS
Gender
Female
Age
32
Income
46000
MCGREG
OR
KUMAR
Male
33
58000
Male
38
47000
ALLINSO
N-HENRY
OLDER
Female
51
55000
Male
44
28000
Smoker
Nonsmoker
Nonsmoker
Smoker
Hbefore
94.58
Hafter
88.79
106.12
78.25
88.11
Nonsmoker
Nonsmoker
83.62
102.4
5
63.82
72.31
77.50
Household income
smoker
Smoker or non-smoker
hbefore
hafter
2 = Male
We need to recode some of the data in medicaltrialX.sav (or fixed.sav). The information
in the smoker column is coded as text (Y and N). It would be better to code it as
numeric data (e.g. 1 and 0), and to use labels to indicate the meaning of these
numbers.
1. Use Recode to convert the smoker information into a new variable called
smoker1, so that 'Y' becomes 1 and 'N' becomes 0. (Define the label for
this new variable as "Smoker or non-smoker")
2. Create value labels for the smoker1 variable so that 1 is displayed as
'Smoker', and 0 is displayed as 'Non-smoker'.
3. Check that the recode has worked properly. If it has, then delete the old
variable smoker from your data sheet.
4. Using Recode, create a new variable incband (with label "Income band")
to categorise the household income: up to $25,000 as band 1, between
$25,000 and $40,000 as band 2, and more than $40,000 as band 3.
5. Save the data file if you are happy with the results of this exercise.
2. We wish to compute the average (mean) mark over the three tests for
each student. Compute a new variable, average, calculating this
information.
3. Save the file.
This exercise uses the incband column as defined earlier. If you do not have this
variable in your data, you can load the data file medicaltrialX-part2.sav.
1. Run a Crosstabs command for the variables incband and gender,
including the following information:
Each cell of the table should list the observed values,
the expected values, and the unstandardised
residuals.
Also run the chi-square test.
2. Run a second Crosstabs command for the same variables. This time do
not run the chi-square test, but include the following within each cell of
the table:
The row, column and total percentages.
Use the medicaltrialX data you have been working on - or you may wish to load the
data file medicaltrialX-part2.sav.
1. Perform a T Test to show whether there is a significant difference in the
inital hormone levels (hbefore) between men and women. Is there?
2. Perform a T Test across all the cases, to decide whether there is a
significant difference in the mean hormone concentrations before and
after the treatment.
3. Now use the Select cases function to select only the women in the study,
and repeat step (2). What do you find?
If you have time, repeat the test, selecting men instead of women.
10