spss16 t2
spss16 t2
Practical workbook
Document information
Related documentation
Other related documents are available from the web at:
Introduction
SPSS provides facilities for analysing and displaying information using a variety of techniques.
This document uses version 16 of SPSS for Windows.
Prerequisites
Basic familiarity with Windows and at least an elementary knowledge of simple statistics
(statistical theory is not taught on this course).
Introduction to SPSS (version 16) for Windows (spss16-t2)
Contents
Document information
Task 24 Saving output from SPSS into word processor documents e.g.
Microsoft Word ..................................................................................................... 52
Appendix A References..................................................................................... 54
Introduction to SPSS (version 16) for Windows (spss16-t2)
Ø Select Cancel or Type in data to this query window. The query window then
closes.
1
Introduction to SPSS (version 16) for Windows (spss16-t2)
2.1 Imagine that you interviewed some people on their smoking habits using the
questions shown below:
Reference number
Smoking Questionnaire
1. How old were you on your last birthday?
2
Introduction to SPSS (version 16) for Windows (spss16-t2)
For Sex, M and F are used to denote male and female, rather than using numeric
codes. All the information about a single person makes up one observation.
Ref Age Sex Smoke Smoke How Pipe Cigars Give Tax Health Cinema
Number Cigs many Up
1 27 F 1 1 10 2 2 1 3 3 3
2 31 M 2 4 2 1
3 35 M 2 4 1 1
4 58 M 2 3 1 2
5 56 M 2 4 3 2
6 25 F 1 1 20 2 2 2 3 4 4
7 41 F 1 1 30 2 1 1 3 1 3
8 38 F 1 1 999 2 2 1 4 4 4
9 43 F 1 2 2 1 1 4 2 2
10 29 M 1 1 40 2 2 2 2 4 4
From this dataset you can see that the reference number of the first subject is 1, she
is 27 and is female. She smokes, and smokes cigarettes, on average 10 per day.
She doesn't smoke a pipe or cigars and has tried to give up. She agrees that tax on
tobacco is too high and that smoking is dangerous to your health and that smoking
should be banned from cinemas.
Later you will be asked to enter these values but first you are asked to consider how
variables are defined and what attributes they can have.
Each variable needs to be given a variable name that is used in describing the
variable to SPSS. Table 2 lists the names that are to be used in the example and
specifies the order in which they are to be given to SPSS. It also suggests suitable
labels that can later be associated with the variables to clarify output.
3
Introduction to SPSS (version 16) for Windows (spss16-t2)
You should now have all the information necessary to start creating the example
dataset in SPSS. First you will use the Variable View of the Data Editor window to
specify the variable names and their attributes.
You should note that this data was collected in 1995 before any of the present day
legislation on smoking in public had be introduced.
4
Introduction to SPSS (version 16) for Windows (spss16-t2)
The Data Editor is a worksheet used for entering and editing data. It has two panes,
the Data View and the Variable View. You switch between each by clicking on the
tab at the bottom left of the Data Editor window.
In general, to enter data in a cell in the worksheet you can use the cursor to click on
the desired cell, type in the entry and finish by using the <Enter> key. If you make a
mistake you can overtype all the contents of a cell by a similar process.
If you want to correct just part of a cell then double-click on the cell, then use the
direction keys to locate the part you want to change. Correct the error using the
<Backspace> key and type the correction, and then use the <Enter> key to
complete the edit. Some cells in the Variable View window are limited to specific
values. When you click on such a cell a square grey icon appears on the right of the
cell. Clicking on this brings up a window that allows values to be entered and
changed from a predefined list.
5
Introduction to SPSS (version 16) for Windows (spss16-t2)
Note This window already has a defined structure. There are ten columns headed: -
Name, Type, Width, Decimals, Label, Values, Missing, Columns, Align and
Measure.
Each of these headings is used to indicate some facet of the definition of each
variable. Their use is described as we proceed to develop our sample dataset.
Variable names
The rules for names are:
• the name must begin with a letter. The remaining characters can be any letter,
any digit, a period, or the symbols @, #, _, or $;
• variable names cannot end with a period;
• variable names that end with an underscore should be avoided;
6
Introduction to SPSS (version 16) for Windows (spss16-t2)
• the length of the name cannot exceed 64 bytes. Sixty-four bytes typically means
64 characters in single-byte languages (eg, English, French, German) and 32
characters in double-byte languages (eg, Japanese, Chinese, Korean);
• spaces and special characters (eg !, ?, ', and *) cannot be used;
• each variable name must be unique; duplication is not allowed;
• the underscore character is frequently used where a space is desired in names;
• Reserved keywords cannot be used as variable names – these are ALL, AND,
BY, EQ, GE, GT, LE, LT, NE, NOT, OR, TO and WITH;
• A mixture of uppercase and lowercase characters, and case is preserved for
display.
4.2 Point and click on the cell in row 1 and column 1. Type ref_no in this cell. Use the
down arrow to move to row 2 column 1.
Ø Type age in this cell. Use the down arrow to move to row 3 column 1.
Ø Continue with this process until all 12 variable names from Table 2 are entered in
this first column. Your screen should then look like Figure 3.
Note When the down arrow is pressed, the 9 columns to the right of the first column fill
with values (default values). We can examine these nine columns and if necessary
change values in specific cells to reflect properties of our example dataset.
7
Introduction to SPSS (version 16) for Windows (spss16-t2)
Variable types
The Type column is showing Numeric for all rows. This means that numeric
(number) values will be expected in the dataset relating to these variables. This is
correct for all the variables except sex where we have collected data in the form of F
for female and M for male.
4.3 To enter the data as M or F, change the variable type:
Ø Point and click on the grey box on the right of the cell giving Type for the variable
sex.
A dropdown menu appears offering eight data types (Figure 4). The common items
are Numeric, Date, Custom currency and String. For a full description of each of
the variable types, click on the Help button.
4.4 To enter alpha characters into the variable sex, select data type String by clicking
on its selection button. Notice that a string of 8 characters is the default. Whilst this
would cause no problem, it is more efficient to reduce it to the actual number of
characters you are going to input. Therefore change the default of 8 in the box to 1.
Ø Click OK to return to the Variable View window.
8
Introduction to SPSS (version 16) for Windows (spss16-t2)
Variable labels
The next column is headed Label and is used to inform SPSS about the details
associated with each variable name. The maximum length of any label is 255
characters and there are no restrictions on what may appear. Spaces are entered
just as typed. If you want to specify where a new line appears in a label, type \n
within the text and SPSS will wrap the label at this point.
4.6 Moving to the first row, fifth column, click on the cell and type in the words:
Reference number. The width of the column can be expanded to allow for the
number of characters in the label. To do this, place the cursor on the divide between
Label and Values in the table headings, where it will change to a two headed
horizontal arrow, and then drag to the right as required.
Ø Move down to row 2, column 5 and type Age last birthday.
Ø Continue entering the labels for all the other variables as given in table 2.
Ø To correct any existing labels, double-click on the entry and edit as you would in a
word processor.
Value labels
4.7 The next task is to enter Value Labels for each variable if appropriate. These will
appear in the Values column. For our first two variables (ref_no and age) there are
no Value Labels, so the default entry of None can remain. For sex you can indicate
that M is male and F is female.
9
Introduction to SPSS (version 16) for Windows (spss16-t2)
Ø Move to row 3 column 6 and click on the grey box on the right of the cell. A
dropdown menu appears so you can provide Value Label information (Figure 5).
Ø In the box by the word Value type F. In the box by the word Label type Female.
Ø Click on Add and watch the value and its label move to the bottom box.
Ø In the box by the word Value now type M and the word Male in the Label box.
Ø Click on Add. Now that all the Value Labels for this variable are complete (your
screen should look like Figure 6), click on OK to return to the Variable View
window.
Note The first part of the Value Label that you entered appears in the appropriate cell.
4.8 The next variable needing a Value Label is smoker:
Ø Click on row 4 column 6 and its grey box. Enter the value 1 and label Yes in the
dropdown menu box and click Add. Enter the Value 2 and Label No and click on
Add. Click on OK.
10
Introduction to SPSS (version 16) for Windows (spss16-t2)
4.9 The variables cigs, pipe, cigars and give_up all need the same Value Labels as
smoker. Either you can repeat the above instructions for each variable in turn or
take advantage of a useful shortcut:
Ø Click in the cell containing the values for smoker. Copy this cell by using either Edit
/ Copy from the main menu or by clicking the right mouse button and selecting
Copy, or by pressing <Ctrl + C>. Point at the cell for Value for variable cigs and
paste the current clip board using either Edit / Paste or use the right mouse button
and choose Paste, or use <Ctrl + V>. Repeat this process for pipe, cigars and
give-up values.
4.10 Finally for the variables tax, danger and cinemas, you will need to provide four
value labels for each.
Ø Use the basic method to enter this information for the variable tax:
• Value 1 has the label Strongly disagree.
• Value 2 has the label Disagree.
• Value 3 has the label Agree.
• Value 4 has the label Strongly agree.
Ø Now copy and paste for the other two variables danger and cinemas.
Missing values
The next column of the Variable View sheet is Missing Values. In the statistical
analysis of any dataset it is sometimes necessary to exclude cases where the
information is not known or not appropriate. An example of this occurs in the
variable num_cigs in this dataset. The information is missing in two situations; for
non-smokers it is not appropriate and in the data the appropriate cell has been left
blank; for one interview, ref_no 8, the respondent failed to give an answer to this
question (no he did not smoke 999 cigarettes per day!) A number that could not be
expected as a genuine response is selected to represent this circumstance.
However in any analysis, it should not be considered as it would seriously distort
many statistical procedures.
Within SPSS there are two types of missing value - system-missing values and
user-defined missing values. By default, for non-string variables, an empty cell is
defined as a system missing value and does not need to be further declared. For
user-defined missing values this column of the Variable View has to be used.
11
Introduction to SPSS (version 16) for Windows (spss16-t2)
Ø Click on row 6, column 7 and then the small grey box at the right of the cell to
produce the Missing Values dropdown menu (Figure 7).
Ø Select the Discrete missing values button and enter 999 in the first cell.
Ø Click on OK and return to the Variable View window. Notice that the value 999 now
appears in the missing column for the variable num_cigs.
If entering missing values for string variables, the required discrete value should be
entered as characters e.g. X to represent the letter X, a space to represent an empty
cell.
Data display
The next two columns (Columns and Align) are concerned with the display of data
in the Data View window. For the purposes of this example dataset, the default
values of a column 8 characters wide and the values right aligned for numeric
variables and left aligned for string variables are fine. When you have entered your
data as instructed below, return to the Variable View window and change one or
more of these values. Then flip to the Data View window and see the effect your
choice has made.
You should be able to recognise that in the example dataset, there are:
• 6 nominal measures - sex, smoker, cigs, pipe, cigars and give up.
• 3 ordinal measures - tax, danger and cinemas.
• 3 scale measures - ref_no, age and num_cigs (ref_num could be nominal,
ordinal or scale!)
4.11 Starting with ref_no in row 1, column 10, click on the cell and choose the
appropriate measure. (You should not have to change this from the default).
Ø Move down the column making the appropriate choice in each case. The first
change is for the variable smoker, which will need to be changed to nominal.
You have now defined all the information that SPSS needs to know about the
characteristics of your specific dataset. Your variable view pane should look like
Figure 8.
12
Introduction to SPSS (version 16) for Windows (spss16-t2)
You may return to the Variable View window at any time if further changes are
needed.
13
Introduction to SPSS (version 16) for Windows (spss16-t2)
The Data View pane of the Data Editor window is used to enter the data.
Displayed initially is an empty spreadsheet with the variable names you have
defined appearing as the column headings.
The data that you need to enter is given in Task 2, but for your convenience the
data table is reproduced here.
Number
Cinema
Smoke
Smoke
Health
Cigars
many
Give
How
Pipe
Cigs
Age
Sex
Tax
Ref
Up
1 27 F 1 1 10 2 2 1 3 3 3
2 31 M 2 4 2 1
3 35 M 2 4 1 1
4 58 M 2 3 1 2
5 56 M 2 4 3 2
6 25 F 1 1 20 2 2 2 3 4 4
7 41 F 1 1 30 2 1 1 3 1 3
8 38 F 1 1 999 2 2 1 4 4 4
9 43 F 1 2 2 1 1 4 2 2
10 29 M 1 1 40 2 2 2 2 4 4
5.1 Click on the Data View tab of the Data Editor Window
Ø To enter the first person’s data, click the first cell of ref_no.
Ø Type 1.
Ø Press the <Tab> key or right arrow once and the heavy outline moves to the next
column.
Ø Type in 27 and press the <Tab> key.
Ø Type in F and press the <Tab> key.
Ø Type in 1 and press the <Tab> key.
Ø Follow the same procedure along the first row until all twelve data values are
entered.
5.2 Move back to row 2, column 1 and start to enter the values for interview 2. Press
the <Tab> key twice to skip over a column. Notice that a dot appears in the cell.
This is the system-missing value (see Figure 9).
14
Introduction to SPSS (version 16) for Windows (spss16-t2)
Figure 9 - Data Editor window with the first and part of the second interview entered
5.3 Continue the process until the data from all ten interviews are entered. Your Data
Editor screen should now look like Figure 10 below. Some people find it easier to
enter data by column rather than by row. The method is similar except that you use
the down arrow key instead of the <Tab> key. The <Home> and <End> keys take
the cursor to the first or last column of a particular case. <Ctrl + Home> will take
you to row 1, column 1, and <Ctrl + End> to the last used cell.
15
Introduction to SPSS (version 16) for Windows (spss16-t2)
Figure 10 - the data editor window with all interview data entered
16
Introduction to SPSS (version 16) for Windows (spss16-t2)
More information about SPSS may be found in the on-line help facility. To access
on-line help:
Ø Click Help from the main menu.
A menu appears from which you can choose further topics.
Ø Click Topics and an output screen similar to the one shown in Figure 11 should
open in a new window.
17
Introduction to SPSS (version 16) for Windows (spss16-t2)
7.1 If you want to know the number of males and females in this sample, you need to
see the distribution of the variable sex, by using the Frequencies procedure:
Ø In the Data Editor window select Analyze.
Ø From the Analyze menu select Descriptive Statistics.
Figure 12 - the window with drop down menus from the Analyze command
18
Introduction to SPSS (version 16) for Windows (spss16-t2)
19
Introduction to SPSS (version 16) for Windows (spss16-t2)
The SPSS Viewer window has two panes, each with its own bottom and right scroll
bars. The left pane contains an outline (index) of the results so far. The right pane
contains the detailed tables, graphs and text output. Clicking on the + and -
symbols in the left pane controls what output is displayed in the right pane. Clicking
on the other section names in the left pane moves the focus of the right pane display
so it starts the display at the selected item.
You can use the Window command to select which window you want to be in at any
particular time.
7.2 Click Window.
Note that there are currently 2 types of window:
• Untitled [Dataset0] - SPSS Data Editor
• Output1 [Document 1] - SPSS Viewer
Ø Click SPSS Data Editor.
20
Introduction to SPSS (version 16) for Windows (spss16-t2)
SPSS saves the file as smoking.sav in the specified directory. Normal Windows
rules apply to file names.
21
Introduction to SPSS (version 16) for Windows (spss16-t2)
The saved output from SPSS appears in the file smoking.spv. This is the output
produced by the various procedures, eg tables, means, plots. It does NOT contain
all the values of the dataset variables nor all the label information so cannot be used
like an SPSS data file for future analysis purposes. It is known as the spool file.
Note This file is not a text file - you must inspect such files by opening them via the File
option in the SPSS Viewer window. To get other formats eg, text, you must select
the desired items in the Viewer outline and use the File Export option (see Task
24 at the end of this document).
22
Introduction to SPSS (version 16) for Windows (spss16-t2)
23
Introduction to SPSS (version 16) for Windows (spss16-t2)
Ø Select smoking.
Ø Click Open.
24
Introduction to SPSS (version 16) for Windows (spss16-t2)
SPSS provides a number of useful commands for directing your output in a specific
fashion. You can experiment with most of them in your own time. However, there
are a few minor changes that would help the remainder of this practical.
11.1 From the main menu click on Edit.
Ø Click on Options in the submenu.
A dropdown menu of some complexity appears as in Figure 18.
25
Introduction to SPSS (version 16) for Windows (spss16-t2)
At the foot of the first column (Initial Output State) is a tick box labelled Display
commands in the log. It is very helpful in any discussion of your output to have
this command log available. If necessary tick the box by clicking on it. When you
now run any SPSS command, your output file will include a representation of the
choices you made from any drop-down menu. This takes the form of the commands
generated in SPSS’s own language. You can see this in Figure 20 on the following
page where the first two lines in the right hand frame are the log generated by the
particular request for a Frequencies count. This SPSS language is referred to as
syntax and is a very powerful tool in the advanced use of the program, but is
beyond the scope of this session.
The right hand frames of this screen allow you to change the default fonts used by
SPSS in the production of output.
If you make any changes to this Viewer tab, click the Apply button before moving
on. This practical does not intend to investigate any further tabs in the Options
menu, so press OK to exit this section. (Remember to restart SPSS if you have
been told it is necessary.)
26
Introduction to SPSS (version 16) for Windows (spss16-t2)
27
Introduction to SPSS (version 16) for Windows (spss16-t2)
28
Introduction to SPSS (version 16) for Windows (spss16-t2)
With continuous variables, frequency tables are not always the best method of
summarising. A better option would be to use a selection of summary statistics in
place of a frequency table. Frequencies and crosstabulations are useful mainly for
categorical variables, ie where the values represent categories such as
male/female, nationality, class of university degree. However, variables like age and
num_cigs have many values and for these continuous variables, statistics like the
mean and standard deviation are sometimes useful.
13.1 In the Viewer or Data Editor window select Analyze.
Ø From the Analyze menu, select Descriptive Statistics.
Ø From the Descriptive Statistics submenu, select Descriptives.
Ø Select the variable Age last birthday [age] (see Figure 21).
29
Introduction to SPSS (version 16) for Windows (spss16-t2)
30
Introduction to SPSS (version 16) for Windows (spss16-t2)
14.1 To create a bar chart for sex using the Frequencies box:
Ø In the Viewer or Data Editor window click Analyze.
Ø From the Analyze menu, click Descriptive Statistics.
Ø From the Descriptive Statistics submenu, click Frequencies.
Ø Click Reset.
Ø Select Sex of respondent [Sex] and then click Ê (Figure 24).
31
Introduction to SPSS (version 16) for Windows (spss16-t2)
Ø Click Display Frequency Tables to suppress the display of the frequency table.
Ø Click OK.
SPSS draws the chart and shows it in the Output Viewer window (Figure 26). (You
may need to scroll down to see the complete chart.)
Figure 26 - SPSS viewer output produced using the Bar Chart option from the
Frequencies procedure
To display the chart in a full screen window, double-click on the chart in the Viewer
pane (this takes you into the SPSS Chart Editor window where the chart may be
amended to suit personal preferences e.g. colour choice, labels, etc) (Figure 27).
32
Introduction to SPSS (version 16) for Windows (spss16-t2)
33
Introduction to SPSS (version 16) for Windows (spss16-t2)
Figure 28 - SPSS viewer output produced using the histogram option from the
Frequencies procedure
34
Introduction to SPSS (version 16) for Windows (spss16-t2)
Task 16 Crosstabulation
The data may be broken down further with crosstabulation (multi-way) tables, which
show the joint distribution of two variables’ values. If you want to know how many
women are smokers, the two numerical variables, sex and smoker are used in
Crosstabs.
16.1 To get a crosstabulation:
Ø Select Analyze.
Ø Select Descriptive Statistics.
Ø Select Crosstabs.
Ø Select Do you smoke? [smoker] from the source variable list.
Ø Click Ê adjacent to the Row(s) text box.
Ø From the source variable list select Sex of respondent [sex].
Ø Click Ê adjacent to the Column(s) text box.
Ø To see the crosstabulation click OK.
SPSS produces a crosstabulation of smoker by sex. The cells of the table show the
Counts. You should find that all five women are smokers and only one man is a
smoker.
16.3 Modify the Crosstabs table to request statistics and include the options Row,
Column, Total and Expected as follows:
Ø Click the Cells button.
Ø Select the additional options Expected, Row Percentages, Column Percentages
and Total Percentages.
Ø Click Continue.
The Statistics button in the Crosstabs window requests statistics.
Ø Click the Statistics button.
Chi-square requests a Chi-Square (χ 2) test of independence and a Fisher's Exact
test when there are fewer than 20 cases in a 2 x 2 table.
Ø Select the Chi-square option.
Ø Click Continue.
35
Introduction to SPSS (version 16) for Windows (spss16-t2)
Figure 29 - SPSS viewer output from Crosstabs procedure (with Chi-squared tests)
Suppose that you wish to test the hypothesis: 'Men and women are not equally likely
to smoke' against the alternative: 'Men and women are equally likely to smoke'.
Since 100% of the cells have expected counts of less than 5, the Chi-Square test is
not valid. However, the Fisher's Exact test (p=0.048 - statistically quoted as p<0.05)
which is also given, lends support to the hypothesis that women and men in this
sample are not equally likely to smoke.
36
Introduction to SPSS (version 16) for Windows (spss16-t2)
17.1 A clustered bar chart can give a picture of the crosstabulation in Task 16:
Ø In the Viewer or Data Editor window select Graphs.
Ø Select Legacy Dialogs.
Ø Select Bar (for bar charts).
Ø To see the number of people who smoke or not, with separate bars for men and
women click Clustered in the Bar Charts box.
Ø To see the counts of cases summarised in the bars click Define to specify the
variables in the chart (see Figure 30).
Figure 30 - the Define options window in the Clustered Bar Chart procedure
37
Introduction to SPSS (version 16) for Windows (spss16-t2)
38
Introduction to SPSS (version 16) for Windows (spss16-t2)
A procedure can produce analyses for separate subgroups rather than for all the
data if the Split File option is selected before a procedure is carried out. The
variable (or variables) that define the subset are given in the Split File command.
For example, you may want to run descriptives first for the women, and then for the
men and thus produce separate mean values of age for men and women.
39
Introduction to SPSS (version 16) for Windows (spss16-t2)
Once you have decided which variables to recode you need to specify the old and
new values.
19.3 Select the Old and New Values box (Figure 34).
To create a young (to be called 1) and an old category (to be called 2), recode the
values 0 through to 30 into the new value 1:
Ø Click on the Range, LOWEST through button.
40
Introduction to SPSS (version 16) for Windows (spss16-t2)
Figure 35 - SPSS Data Editor window with extra variable ‘agecat’ added
41
Introduction to SPSS (version 16) for Windows (spss16-t2)
19.4 Use Frequencies to tabulate agecat and check the results. You should find that 3
subjects are aged 30 or less and 7 subjects are age 31 or more.
42
Introduction to SPSS (version 16) for Windows (spss16-t2)
Next, in the Numeric Expression text box you need to give the instructions for
calculating the variable, in this case taking the log of age.
19.6 Initially you need to find the appropriate function. Log is an arithmetic function:
Ø Click on Arithmetic in the Function group window.
Ø Scroll down and click on Ln in the Functions and Special Variables window.
Ø Click the up arrow next to the Function group box.
Note A Function group must be highlighted as well as a Function otherwise the up
arrow alongside the functions group does not operate.)
Ø Select Age last birthday (age).
Ø Click Ê to move age to replace the ? in the function definition.
Now you have a compute statement: logage=LN(age).
Ø Click OK.
SPSS creates the new variable and places it in the next free column in the Data
Editor window. The newly created variable logage may now be used in SPSS
procedures.
43
Introduction to SPSS (version 16) for Windows (spss16-t2)
Task 20 Correlations
44
Introduction to SPSS (version 16) for Windows (spss16-t2)
Since the three variables in this correlation analysis are ordinal in measurement
scale, it would have been statistically more proper to use Spearman's Rank
correlation coefficients to measure the relationship.
20.2 Repeat the above analysis but this time select the Spearman correlation coefficient.
Note that the same relationship remains significant, although its value is slightly
lower than the Pearson correlation (Figure 39).
45
Introduction to SPSS (version 16) for Windows (spss16-t2)
A scatter plot graphs one variable against another, and often gives an idea of any
associations in the data. In this example, we will plot danger along the horizontal (X)
axis and cinemas along the vertical (Y) axis.
21.1 To use the Graphs menu to specify the scatter plot:
Ø Click Graphs and Legacy Dialogs.
Ø From the menu select Scatter/Dot.
Ø To specify the scatter plot click Simple Scatter.
Ø Click Define in the Simple Scatterplot dialog box (see Figure 40).
47
Introduction to SPSS (version 16) for Windows (spss16-t2)
In order to save your recoded information and computed variables permanently, you
must save the current copy of the data in the Data Editor window. For now, save
the file under a new name, smoking2. You can save the file under the same name
or a different name.
22.1 To save the file:
Ø Click File in the Data Editor window.
Ø From the File menu click Save As.
Ø Ensure the directory in the Save in box is correct. If you are using one of the
Computer Centre training rooms change the directory to C:\User\Stats.
Ø Type smoking2.sav in the File name box.
Ø Click Save.
An updated copy of the data is saved in smoking2.sav.
48
Introduction to SPSS (version 16) for Windows (spss16-t2)
When working the Computer Centre training rooms you will notice that in the
directory C:\User\Stats there is a file called Large Smoking Data.xls. This is an
Excel spreadsheet that has the same 12 variables as you have used so far in this
workbook, but with many more cases than you have entered.
23.1 Browse to C:\User\Stats
Ø Double click on the file name to enable Excel to open the file (Figure 42).
You will notice that the first row of the Excel spreadsheet contains the names of the
twelve variables exactly as you used them before. You will analyse this large file
using SPSS.
Ø Close the Excel file at this point.
Figure 42 - the first part of the Excel data file Large Smoking Data.xls
49
Introduction to SPSS (version 16) for Windows (spss16-t2)
Figure 43 - the SPSS Open File menu window showing an Excel file for input
Ø The next menu confirms that the Excel file has been recognised. You should check
that the box Read variable names from first row of data is ticked (Figure 44).
Ø Click Continue
You now have a data file in SPSS with all the additional cases. Unfortunately all the
information you entered into the Variable View part of your small original SPSS file
is missing. You could re-type this information as you did earlier, but you can get
SPSS to import the original.
23.3 In the Data Editor window click on Data.
Ø Click on Copy Data Properties (see Figure 45).
50
Introduction to SPSS (version 16) for Windows (spss16-t2)
You wish to use the properties of the file smoking.sav which you saved earlier in
C;\User\Stats.
Ø Select An external SPSS data file and either by direct entry or browsing insert into
the file name box C:\User\Stats\smoking.sav
Ø Click Finish. (If you were to click Next, you would have a number of alternatives
offered that would allow you to control more finely what properties are copied)
23.4 Using procedures you mastered earlier, answer the following:- (keep your SPSS
output for Task 24)
1. How many females answered the questionnaire? (Clue Task 12).
2. Show a histogram of respondent’s ages? (Clue Task 15).
3. Are men and women equally likely to smoke? (Clue Task 16).
4. What is Spearman’s rank correlation between danger and cinemas? (Clue
Task 20).
51
Introduction to SPSS (version 16) for Windows (spss16-t2)
The output file produced by SPSS can only be read by the SPSS program. However
most users would like to take all or parts of their SPSS output and insert them into
their usual word processor’s documents. We shall learn how this can be achieved by
moving output to a Microsoft Word document.
There are two ways of achieving this process. Let’s first consider allowing SPSS to
do most of the work.
24.1 Make sure you are in the SPSS Viewer window.
Ø From the File menu select Export.
Ø In the Objects to Export box, ensure that All Visible objects is selected
Ø Under Document Type select Word/RTF file (*.doc) from the drop down menu.
Ø In the File Name box type C:\User\Stats\wordoutput.
Ø Click OK.
24.2 Minimise SPSS Viewer and Data Editor windows and then browse to and open the
document wordoutput.doc. You will see that all your original output has been
transferred.
24.3 There is an alternative way of achieving the movement of small amounts of output
where you have much more control. Keep your wordoutput document open but
position your cursor at the end of the present file. Minimise the Word document and
maximise SPSS viewer file.
52
Introduction to SPSS (version 16) for Windows (spss16-t2)
Ø Point and click on any single table or chart in your output. You will notice that a
rectangular box appears around the table.
Ø Click on Edit and select Copy.
Ø Maximise your Word file and click on Edit and Paste.
This process will work for transferring all text, tabular or chart output from SPSS.
53
Introduction to SPSS (version 16) for Windows (spss16-t2)
Appendix A References
One of the reasons for using SPSS in the University is that it has a very comprehensive on-line
documentation facility. When the software is installed you should take a copy of the ‘Manuals’
disc. On this you will find a series of ‘pdf’ files that give full documentation in each area of SPSS.
Listed below are the titles of the important files.
Manuals relating to statistical issues:
• SPSS Brief Guide 16.0
• SPSS Base User’s Guide 16.0
• SPSS Tables 16.0
• SPSS Data Preparation 16.0
• SPSS Advanced Models 16.0
• SPSS Regression Models 16.0
• SPSS Trends 16.0
• SPSS Categories 16.0
• SPSS Classification Trees 16.0
• SPSS Complex Samples 16.0
• SPSS Conjoint 16.0
• SPSS Exact Tests
• SPSS Missing Value Analysis 16.0
54