Lecture 1 : Tutorial Session
Introduction to SPSS
Lecturer of Biostatistics & Assistant Director
Department of Research
Dow University of Health Sciences
[email protected]
Introduction to
SPSS
Object of the Course
• About SPSS
• The basics of managing data files
• Data analysis in SPSS
Introduction: What is SPSS?
• Originally it is an acronym of Statistical
Package for the Social Science
• One of the most popular statistical
packages which can perform highly
complex data manipulation and analysis
with simple instructions
The Three Windows:
Data editor (File Extension “.sav”)
Output viewer (File Extension “.spv”)
Syntax editor (File Extension “.sps”)
The First Window: Data Editor
• Data Editor
Spreadsheet-like system for defining, entering, editing,
and displaying data. Extension of the saved file will be
“sav.”
The Second Window: Output Viewer
• Output Viewer
Displays output and errors. Extension of the saved file will
be “spv.”
The Third Window: Syntax editor
• Syntax Editor
Text editor for syntax composition. Extension of the
saved file will be “sps.”
The Basics of Managing
Data Files
Opening SPSS
• The default window will have the data editor
• There are two sheets in the window:
1. Data view 2. Variable view
Data View Window
• The Data View window
This sheet is visible when you first open the Data Editor
and this sheet contains the data
• Click on the tab labeled Variable View
Click
Variable View Window
• This sheet contains information about the data set that is stored
with the dataset
• Name
– The first character of the variable name must be alphabetic
– Variable names must be unique, and have to be less than 64
characters.
– Spaces are NOT allowed.
– For separating two names use “_” , “$” , “ .”
Variable View Window: Type
• Type
– Click on the ‘type’ box. The two basic types of variables
that you will use are numeric and string. This column
enables you to specify the type of variable.
Variable View window: Width
• Width
– Width allows you to determine the number of
characters SPSS will allow to be entered for the
Variable in a single cell
Variable View window: Decimals
• Decimals
– Number of decimals
– It has to be less than or equal to 16
3.14159265
Variable View window: Label
• Label
– You can specify the details of the variable
– You can write characters with spaces up to 256
characters
Variable View window: Values
• Values
– This is used and to suggest which
numbers represent which categories when
the variable represents a category
Defining the value labels
• Click the cell in the values column as shown below
• For the value, and the label, you can put up to 60
characters.
• After defining the values click add and then click OK.
Click
Practice 1
• How would you put the following information into
SPSS?
N am e G ender H e ig h t
J A U N ITA 2 5 .4
SALLY 2 5 .3
D ONNA 2 5 .6
S A B R IN A 2 5 .7
J OHN 1 5 .7
M ARK 1 6
E RIC 1 6 .4
B RUC E 1 5 .9
Value = 1 represents Male and Value = 2 represents Female
SPSS File: Data Entry Practice.sav
Practice 1 (Solution Sample)
Click
SPSS File: Data Entry Practice.sav
SPSS File: Data Entry Practice.sav
Saving the data
• To save the data file you created simply click ‘file’ and
click ‘save as.’ You can save the file in different forms
by clicking “Save as type.”
SPSS File: Data Entry Practice.sav
Generate a Serial Number (ID)
SPSS cannot create a variable of serial number
until it has some data sets.
For generate a variable of serial number we
need to create a new variable.
If you are interested first to have a variable of serial
number without any data set you need to make in MS
Excel and paste in SPSS.
SPSS File: Data Entry Practice.sav
Serial Number (ID)
SPSS File: Data Entry Practice.sav
Serial Number (ID)
You can modify its structure.
SPSS File: Data Entry Practice.sav
Sorting the data
• Right Click on Variable “Names” and click Sort Ascending Cases
or Sort Descending Cases.
SPSS File: Data Entry Practice.sav
Practice 2
• How would you sort the data by the
‘Height’ of students in ascending order?
SPSS File: Data Entry Practice.sav
Transforming data
• Click ‘Transform’ and then click ‘Compute Variable…’
SPSS File: Data Entry Practice.sav
Transforming data (cont’d)
• Example: Adding a new variable named ‘Sqheight’ which is
the square of height
– Type in sqheight in the ‘Target Variable’ box. Then type in
‘(sqheight) in the ‘Numeric Expression’ box. Click OK
Click
SPSS File: Data Entry Practice.sav
Transforming data (cont’d)
• A new variable ‘sqheight’ is added to the data
SPSS File: Data Entry Practice.sav
Practice 3
• Create a new variable named “sqrtheight”
which is the square root of height.
SPSS File: Data Entry Practice.sav
Practice 3
• A new variable ‘sqrtheight’ is added to the data
SPSS File: Data Entry Practice.sav
Practice 4
Removing a Variable
“Gender” by right click
on it and select
“Clear”.
Adding a Variable
before Height by right
click on it and select
“Insert Variable”.
SPSS File: Data Entry Practice.sav
Practice 5
Removing a
Case/Observation “5”
from the data by
clicking right on it and
select “Clear”.
Adding a
Case/Observation
before “3” from the
data by clicking right
on it and select
“Insert Cases”.
SPSS File: Data Entry Practice.sav
Practice 6
Addition of the Two new variables having same
options. Let say we want to add “Back Pain” and
“Headache” with “Yes” or “No” option.
SPSS File: Data Entry Practice.sav
Practice 6
For adding another variable with the same structure
we just copy and paste in below row.
SPSS File: Data Entry Practice.sav
Practice 6
Change the name and label for the new variable.