L2 - IntrotoSPSSandMS Excel
L2 - IntrotoSPSSandMS Excel
I N T R O D U C T I O N T O S P S S AN D M S E X C E L
Dr. Muhammad Zaly Shah B. Muhammad Hussein1
Department of Urban and Regional Planning
Faculty of Built Environment
2.1 Introduction
1
Email: [email protected], Office: B11-307, Ph: (07) 5537348, HP: (013) 7426251
© 2003-2007 Muhammad Zaly Shah
MBT1033 Introduction to SPSS and MS Excel
2 . 2 S t a t i s t i c a l An a l y s i s w i t h S P S S
Let’s look how we perform each step in SPSS. But first we need to start
SPSS. Once you have started SPSS, you will be greeted by the following
screen (Figure 2-1):
2
MBT1033 Introduction to SPSS and MS Excel
In Figure 2-1, you are presented with several choices on how you can start
your SPSS session. Most common actions are:
Click on the appropriate radio button. The default selection is for you open an Creating a
existing data source, i.e. SPSS file that you have entered data into it. In this new, blank
data editor
tutorial, we will start with a blank data sheet to enter a fresh set of data. So,
click CANCEL.
Tips To enter a fresh new set of data, you can select the
‘Type in data’ radio button and click OK. An easier
approach, however, is just to click CANCEL.
In Figure 2-2, you will notice several important components of SPSS that you
must know in order to move around and operate SPSS effectively. These
components are:
3
MBT1033 Introduction to SPSS and MS Excel
1. The title bar – showing the name of the current active file. In this
instance we have not named our data file, so SPSS simply denotes
our current file as ‘Untitled’. The title bar also shows that we are
currently in the ‘SPSS Data Editor’ and not, for example, in
‘Viewer’.
2. The menu bar – provide the various processes that can be performed
in SPSS. Examples of these processes are data processing (‘Data’),
analyzing data (‘Analyze’), charting data (‘Graphs’), etc.
Once you are in the data editor, you can enter your data. The data in SPSS are
arranged in row-column format. The row represents the observation while the
column represents the variable.
In Figure 2-3, we can see that the cursor is at row 6 and column 2, with the
cell having the value of 2.45.
4
MBT1033 Introduction to SPSS and MS Excel
5
MBT1033 Introduction to SPSS and MS Excel
For our data in Figure 2-3, let’s name our var00001 data as weight and
var00002 as cpa which stands for ‘cumulative grade point average’. The variable
weight, then, is numeric with a width of 4 with 1 decimal place. The variable
cpa is also numeric but with a width of 3 with 2 decimal places. The results
after all the changes are shown in Figure 2-5 and Figure 2-6.
6
MBT1033 Introduction to SPSS and MS Excel
Now, once we are done entering and specifying our data, let’s save our data Saving a
file
so that we do not lose it in the event of some unfortunate accident such as
power failure.
To save our data, click the menu File > Save (Figure 2-7) or click the
button on the tool bar.
Once you have done the above, the ‘Save Data As’ dialog box will appear
prompting you to specify the location, the name and type of the file you want
to save (see Figure 2-8).
7
MBT1033 Introduction to SPSS and MS Excel
Let’s name our file ‘Data1.sav’ (note that the file extension ‘.sav’ is the native
file extension for SPSS data file).
Once we have successfully saved our file, you will notice that the ‘Untitled’
file name given previously by SPSS has changed to ‘Data1’ in the title bar.
This is shown in Figure 2-9.
Once we have successfully created (and, save) our data, we are now ready for
the next process which is telling SPSS what we want to do with the data. To
most statisticians, this is the most interesting phase as finally they are able to
see, test and analyse their data. To them, this is ‘play’ time.
In this tutorial, it is not possible to cover every single statistical operation that
SPSS can perform. Rather, we will just select one simple activity that will
roughly show how easy it is to conduct statistical analysis using SPSS.
Using our ‘Data1’ data, we will conduct a descriptive statistical analysis. In Performing
statistical
descriptive analysis, we will try to explain the characteristic of our data. analysis
8
MBT1033 Introduction to SPSS and MS Excel
In SPSS, almost all statistical analysis that you want to perform are located in
the Analyze menu. The same goes to the descriptive statistical analysis that
we want to conduct.
To proceed with our descriptive statistical analysis, select the menu Analyze >
Descriptive Statistics > Descriptives … as shown in Figure 2-10.
Once you have done this, the following dialog box, as in Figure 2-11, will
appear as SPSS requires additional information before it can process your
request.
9
MBT1033 Introduction to SPSS and MS Excel
First, once the dialog box in Figure 2-11 appears, is to select the variable that
you want SPSS to conduct descriptive analysis on. Note that SPSS can only
conduct descriptive statistical analysis on only one variable at a time. In this
case, SPSS is asking you which of the two variables that you want to perform
the descriptive statistical analysis on. For our example, select the variable
weight which is shown as Step 1 in Figure 2-11.
Next, bring the selected variable, i.e. weight, to the area on the right under the
title ‘Variable(s)’. This is done simply by clicking the ‘arrow box’ shown in
Step 2. The result is shown in Figure 2-12 and clicking the OK button will
automatically make SPSS perform the descriptive statistical analysis.
Figure 2-12: The dialog box once selection has been made
10
MBT1033 Introduction to SPSS and MS Excel
Note that SPSS will automatically name the result with Output1 for the first Saving an
statistical output that it produces for the current working session. Of course output file
you could name your output to something that you like. And, this can be done
once you save the output result. To save the output, select the menu File >
Save or alternatively click the button on the tool bar.
The ‘play’ time is over once you got your result. From here on, it is serious
business as this is arguably the most important step in any statistical analysis.
11
MBT1033 Introduction to SPSS and MS Excel
Depending on the version that you use and the amount of customisation been
made on your copy of MS Excel, your MS Excel screen might be slight
different. A screenshot of a MS Excel workbook is shown in Figure 2-14.
Nonetheless, you will notice that MS Excel, or more commonly known as
Excel, shares many common features with SPSS.
One of the most striking similarities that Excel has with SPSS is that they
both operate using the cell paradigm apart from the fact they also have title
bar, menu and tool bar.
In Excel, the columns are represented by letters (A, B, C, …) while the rows Columns
and rows
are denoted with Arabic numbers (1, 2, 3, …). Therefore, you have for in Excel
example cell A1 which refers to the cell in column A, row 1.
An Excel feature that is not available in SPSS is that Excel uses the workbook
paradigm where a single workbook can contain many data sheets. Figure 2-15
shows an example of a workbook which contains several data sheets, each
having its own set of data. Also, Figure 2-15 illustrates the many things that
you can do with Excel and you are not confined to performing just statistical
analysis as with SPSS.
12
MBT1033 Introduction to SPSS and MS Excel
As with SPSS, the first step in our work is to enter the data into Excel. To
illustrate, we are going to use some actual data. The data that we are going to
create is an excerpt from a study by the Economic Planning Unit, Prime
Minister’s Department on the Malaysian Quality of Life (EPU, 1999, p.
112)2. The data shows a comparison between several countries in the world
on the number of cellular phone users per 1000 population and the number of
telephone lines per 1000 population in the year 1997. The Excel sheets that
contain these statistics are shown in Figure 2-16 below:
2
EPU (1999). Kualiti Hidup Malaysia 1999. Kuala Lumpur: Economic Planning Unit, Prime
Minister’s Department, Malaysia.
13
MBT1033 Introduction to SPSS and MS Excel
To insert a new row in Excel, first right-click on the row number, above Inserting a
row in
which you want to insert a new row. Therefore, if you want to insert a new Excel
row on top of row 1, then right-click on the number 1 that signifies row no. 1.
Upon right-clicking row 1, the entire row will be highlighted and a pop-up
menu will be displayed (Figure 2-17). Among the options available in this
pop-up menu is one called ‘Insert’. Click Insert and a new row is
automatically inserted on-top of row 1. Now, our previous row 1 has been
renumbered to become row 2. And so do the other rows.
Go ahead and enter the following info, shown in Figure 2-18, so that the
blank new row (i.e. row 1) will now be our column header.
14
MBT1033 Introduction to SPSS and MS Excel
You will notice that the some of the header text is hidden as in the header of Adjusting
column B which is partially covered by the header of column C. The reason column
why this happens is because the header text of column B is wider that the width
width of column B itself. We can solve this problem by double-clicking on
the column border. We can do this for all our columns. Double-clicking the
column border will increase the width of the column to fit the widest of the
text in that column. If we do this, we will have the following result as shown
in Figure 2-19.
15
MBT1033 Introduction to SPSS and MS Excel
In fact, in Figure 2-19, we have also do other cosmetic changes to the data
sheet e.g. setting bold typeface for the header and to have the values in
columns B and C centred.
Once we have done this, let’s save our data. You can do this by selecting the Saving
Excel
menu File > Save or by clicking the button. Immediately, the following workbook
‘Save As’ dialog box, as in Figure 2-20, will appear. Let’s name our
workbook ‘Quality1997.xls’ (note that Excel’s native file extension is ‘.xls’).
If you have successfully saved your Excel workbook, your filename will
appear on the title bar (see Figure 2-21).
16
MBT1033 Introduction to SPSS and MS Excel
To rename your data sheet, you only need to double-click the sheet tab as Renaming
shown in Figure 2-21. Then, go ahead and rename your data sheet as data sheet
‘Phones’, and press Enter to effect the changes on the data sheet. The result
should be similar to Figure 2-22.
There are infinite possibilities that you can achieve with Excel. And, similar
to SPSS it is impossible to cover every single one of them. In this lecture
note, we will try to cover some operations that are pertinent to our goal of
performing quantitative analysis or data manipulation.
A. Arithmetic Operations
17
MBT1033 Introduction to SPSS and MS Excel
Figure 2-23 shows the formula for the addition between constants in the
formula box while the result is shown in cell E2.
Using this reference format, i.e. referring to the cell rather than its value, will
make the computation dynamic. In this sense, whenever, the value in cell B2
change, for example, the result in cell F2 will also change correspondingly.
18
MBT1033 Introduction to SPSS and MS Excel
Finally, you can also add values in two or more different cells. Figure 2-25
shows an example where values in two cells are added together. The result of
the addition operation is shown in cell G2.
19
MBT1033 Introduction to SPSS and MS Excel
The three mode of operations, i.e. between constants, between cell value and
constant, and between cell values, can also be performed on other
mathematical operations e.g. subtraction, multiplication, etc.
B. Summation
1. First, click on the cell where you want you summation result to
appear. For this example, we will select cell B13 to display our
summation result. Why? Because we want to sum all the values in
column B.
=sum(B2:B12)
20
MBT1033 Introduction to SPSS and MS Excel
You will see that (refer to Figure 2-27) using the icon, Excel will
automatically predict that you want to sum all the values above it.
21
MBT1033 Introduction to SPSS and MS Excel
However, before you proceed with the summation, check the range of the
cells that Excel will use. If this is correct, press Enter, and the result is
displayed in cell C13 (see Figure 2-28).
C. Naming a Cell
If you use a value located in a particular cell a lot, it is good that you provide
a name for that particular cell. In this way, you avoid retyping the value
repeatedly.
22
MBT1033 Introduction to SPSS and MS Excel
‘TotalCellPhone’ in the name box (see Figure 2-29). The process and its
result are shown in Figure 2-30.
Key Terms
23
MBT1033 Introduction to SPSS and MS Excel
Exercise
You are given the following data:
Source: EPU (1999). Kualiti Hidup Malaysia. Kuala Lumpur: Economic Planning Unit, Prime
Minister’s Department, Malaysia. p. 113.
The above data represents the comparison between selected countries in the
world on two important statistics on the quality of health facilities:
Do the following:
1. Enter the data in the ‘Quality1997.xls’ file created earlier. Use a new
data sheet and name it ‘Health’.
2. Give appropriate name for the columns.
3. Calculate the total of ‘People per Doctor’ and the total of ‘People per
Hospital Beds’.
4. Name the cells having the sum of ‘People per Doctor’ as ‘SumDr’
and the sum of ‘People per Hospital Beds’ as ‘SumBed’.
5. Insert the following row between Korea and Philippines:
24
MBT1033 Introduction to SPSS and MS Excel
Variance =
∑ (x − x ) 2
n −1
25
MBT1033 Introduction to SPSS and MS Excel
Answer
If you have done the exercise correctly, you should obtain results similar to
Figure 2-31:
26