1. College of Health Sciences
Department of Public Health
Leta Adugna (BSc, MPH/Epidemiology)
November 5, 2023 1
2. Objectives
• At the end of this lecture, students are expected to
• Identify the different windows in SPSS
• Define variables, enter, manipulate, and save data
• Manage and analyze data, produce graphs
• Interpret the results of data analysis using different assumptions
November 5, 2023 2
3. Introduction to SPSS
• SPSS was originally launched in 1968 by SPSS Inc., and was later
acquired by IBM in 2009.
• Distributed for data management and statistical analysis.
• The SPSS software package is continually being updated &
improved.
• The data from other software can be exported to SPSS for detailed
analysis.
November 5, 2023 3
4. Introduction to SPSS… Window name (Title bar)
Menu bar
Workflow tool bar
November 5, 2023 4
5. SPSS Windows
• There are three main and separate windows:
The Data Editor window
The Output (Viewer) window
The Syntax Editor window
November 5, 2023 5
6. 1. Data editor window
• It is the view where we see our data
• It is useful to see and manipulate the data
• It has *.sav extension
• It has two views: Data view and Variable view
• Views can be exchanged by clicking the view we desire at the left most
lower side of the data editor.
November 5, 2023 6
7. 1. Data editor window…
Variable view
Data view
November 5, 2023 7
8. 1. Data editor window…
1. Data view
• Simple observation of:
•Variables name
•Variables value
• We are able to edit directly the values of
variables.
• Data can be entered when SPSS is in data
view
• Data quality?
November 5, 2023 8
9. 1. Data editor window…
Data view…
Row (case)
• A horizontally recorded
Single study subject’s
information.
Column (variable)
• A vertically recorded
single Variable’s value
across all study subjects.
November 5, 2023 9
10. 1. Data editor window…
2. Variable view
• It is important to create
new variables in SPSS
• It is by writing name of
variable, type of variable,
its label and its value
November 5, 2023 10
11. 2. Variable view…
1. Name of variables
• Must be unique
• Must begin with a letter or one of the symbols @, #, or $
• Only letters, numbers, the period (.), underscore (_), and the $, #, and @ symbols can be
used within variable names
• Spaces are not allowed within variable names
• Name of variable should not start using number
• Example: Agegroup (correct) vs age group (incorrect)
p01age (correct) vs 01age (incorrect)
November 5, 2023 11
12. 2. Variable Type
1. Numeric: for countable (quantitative) only
accepting numerical (coding of categorical
variables is possible)
2. Date: characteristics it can use different
styles of dates
3. String: if we interested in words.
(alphanumeric variables or character
variables).
2. Variable view…
November 5, 2023 12
13. 2. Variable view…
3. Width
• Allow number of characters of
continuous variable.
• If numeric type of variable, it will
ask to choose number of widths
and decimals (as a default the
width comes 8 and decimals of 2).
• If date type of variable, it may ask
you to choose number of
characteristics of the type of date.
• If a categorical data with words, it
will ask you to choose number of
characteristics you wanted to add.
November 5, 2023 13
14. 2. Variable view…
4. Decimals
• Number of decimals
• It has to be ≤16
• If it is date or string
variable, it will not
request you decimals
14
15. 2. Variable view…
5. Label of the variables
• It’s detailed description of
the variable name
• You can write characters with
spaces up to 256 characters
November 5, 2023 15
16. 2. Variable view…
6. Values of the variable
• It’s is the description of
values of variables of
categorical variables coded
as quantitative.
• Eg. ‘Sex’ (1. male, 2.
female)
‘Residence’(1. urban,
2. rural)
• For continuous variables,
no value is needed to be
coded
November 5, 2023 16
17. • 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 click OK.
2. Variable view…
click
1. Write the value first
2. Write its meaning
3. Click “add” to pass
4. Click “ok” to finish
17
18. 2. Variable view…
7. Missing
• Specify what is to be
entered for a value that
is missing for a variable.
• Arise when no data
value is saved for the
variable in observation.
click
November 5, 2023 18
19. 2. Variable view…
8. Columns
• Determine the space of a column
of a variable
• Note that this is not the same as
the number of digits displayed for
each value.
• This simply refers to the width of
the actual column in the
spreadsheet.
November 5, 2023 19
20. 2. Variable view…
9. Align
• The alignment of content in
the cells of the SPSS Data
View spreadsheet.
• Options include
• Left-justified,
• Right-justified, or
• Center-justified.
November 5, 2023 20
21. 2. Variable view…
10. MEASURE
• The level of measurement for
the variable (e.g., nominal,
ordinal, or scale).
• Nominal for categorical,
ordinal for ordered type and
scale for numerical.
click
November 5, 2023 21
22. 2. Variable view…
11. ROLE
• The role that a variable will play in your analyses (i.e.,
independent variable, dependent variable, both indpt and
dpt).
• Input: The variable will be used as a independent
variable (the default assignment for variables).
• Target: The variable will be used as an dependent
variable.
• Both: The variable will be used as both indpt and dpt.
• None: The variable has no role.
• Partition: The variable will partition the data into
separate samples.
• Split: Used with the IBM® SPSS® Modeler (not IBM®
SPSS® Statistics).
click
November 5, 2023 22
23. Saving data file in SPSS
1. File 2. Save as
3. By clicking HERE you
can choose where to
save your file.
4. By typing HERE you can
give your file a name.
5. By clicking HERE you
can choose a type of your
data file. 6. Click
here to
save.
November 5, 2023 23
24. 2. The Viewer window
• The Viewer window displays
all
•Statistical results,
•Tables, and
•Charts
•Commands…etc.
•It has *.spv extension
November 5, 2023 24
25. 2. The Viewer window…
Output in detail
Output in outline
Title bar and
menu bar in
output window
November 5, 2023 25
26. 3. The Syntax Editor
• It is the window in which SPSS
commands can be typed and
submitted for processing.
• Commands saved in files can
be opened in a syntax Editor
• Window for processing.
• It has *.sps extension
November 5, 2023 26
27. 3. The Syntax Editor…
Program with a
command
Syntax menu
Clicking here will
execute a command
November 5, 2023 27
28. • Once a syntax is written, we are able to execute it.
• In excuting a syntax we are able to do the whole program as whole or by
selecting part of the syntax
• To do the whole syntax, select the ‘run’ from the pulldown menu of the syntax
and select ‘all’
• To excute part of the syntax, shade it and run the file
3. The Syntax Editor…
November 5, 2023 28
29. Opening an existing data file
• From already entered and saved data
file:
• In data editor window,
• Choose the file type, and then
browse and select your file so it
appears by file name.
File Open Data
November 5, 2023 29
30. Opening an existing data file…
By clicking the file type,
you are able to find the type of extension
By clicking the here,
you are able to find
where your file is.
you can search
your file name
by typing here.
November 5, 2023 30
31. Data
•Merge files
•Sort cases
•Split file
•Select cases
Transform
•Compute
•Recode
Analysis
•Descriptive Stat..
•Compare means
•Correlate
•Regression
•Survival
Graphs
•Bar
•Histogram
•Scatter plot
•Line
•Pie
•Box plot
SPSS Data Management and Interpretations
November 5, 2023 31
32. Data
• Merge files
• Sort cases
• Split files
• Select cases
November 5, 2023 32
33. 1. Merge files
• Two data files are merged (mixed) together
November 5, 2023 33
34. A. Merging to add cases (rows)
• Here two different data files will be merged
• To merge data the two files should have variables of the same characteristics on:
• Name of variable
• Type of variable
• Width and decimals the variable has
• Usually such merging is possible if we use similar template during data entry.
• If there is slight difference in characteristics of a variable then merging for that
variable will be difficult.
November 5, 2023 34
35. A. Merging to add cases (rows)…
Steps
1. Open one of the two files (the file that you
assume will be the first file)
2. From the pull down menu click “Data” and
go down to select “Merge files”
3. From the “Merge files” select “add cases”
Data Merge files Add cases
November 5, 2023 35
36. • Select the data file you wanted through the Browser to
merge and click the Continue
Select
here
2nd Click here,
to select file
November 5, 2023 36
37. A. Merging to add cases (rows)…
You will find two windows
1. Unpaired variables
• list of variables that are not matched thus could not be included in the new file
• If there is slight difference in the characteristics of variables it will be categorized to this
window
* for variables that come from the opened file
+ for variables that come from the new file
November 5, 2023 37
39. A. Merging to add cases (rows)…
2. Variables in the new working file
• List of variables that could be merged to
the file
• If all variables are found in this window, we
could click “Ok” and we could have a new
file that needs saving, and we should save
it for further analysis.
November 5, 2023 39
Variables in the
new working file
40. B. Merging to add variables (columns)
• It is used when we want to add certain variables of a file from other
database.
• Here a variable having a common identity of cases is needed.
• One or more variables are added to each cases of the file.
November 5, 2023 40
41. Steps Data Merge files Add variables
1. Click browse, to select file
November 5, 2023 41
42. • A window that asks you browse to add file containing the variable you
need comes
2. select “file name”,
then,
3. click “open”
4. click “continue”
5. click “OK”
November 5, 2023 42
43. You will find two windows
1. Excluded variables
• list of variables that would be excluded from the working file are included
• Variables found in common are also listed here, thus the common identity also will be
found here
* for variables that come from the opened file
+ for variables that come from the new file
2. Variables in the new working data file
• List of variables that would be found in the new file
• If all variables needed to the original file are included, process of merging will be started.
November 5, 2023 43
44. 2. Sort
• Sorting is useful in cleaning data.
• When you sort ascending or descending, you can find ‘missing data’, ‘unknown
(unexpected)’ data and ‘outliers’.
• If you find such cases, you can re-check with hard data for possible correction.
• It is also useful during merging (especially when you are adding variables).
November 5, 2023 44
45. Two methods to sort data
A. Using menu bar
Data Sort cases
1st select the variable
3rd select ascending or descending sorting
2nd click
here to
pass into
sort by
November 5, 2023 45
46. B. Right clicking
• Open “data view” format of the SPSS.
• Go to the variable name and do a right click.
• And select ascending or descending sorting as you wish.
• The outcome is then displayed in the Data editor, on “data
view”.
November 5, 2023 46
47. 3. Split file
• It is used to do analysis by stratification
• Data is stratified by the variable selected for splitting.
• Out come (result) of the planned analysis is displayed by stratification
(i.e. result for each value stratified is given separately
• Eg: if data is split by sex, then any analysis done will be displayed
for males and for females
November 5, 2023 47
48. Steps
1. From the menu bar click “Data” and go down to select “Split file”
Data Split file
November 5, 2023 48
49. 1st Select “Organize output by
groups” or “compare groups”
2nd Select the variable you wanted to split your
file
November 5, 2023 49
50. 3rd Click the arrow to pass
To “Groups based on:”
Finally, click Ok
Then do any analysis you wanted to perform
November 5, 2023 50
51. 4. Select cases
• It is useful when you want to analyze data among certain category of a
variable (conditionally selected data).
• E.g.: You can analyze data only among female population.
• It can also be used to select study subjects from sample frame
(Simple random sampling).
• It can also used to select certain range of a population in sequence,
etc
November 5, 2023 51
52. Steps
I) Conditional selection
• From the menu bar click “Data” and go down to select “Select
cases”
Data Select cases
November 5, 2023 52
53. 1st Select “If condition is satisfied”
2nd Click “if”
November 5, 2023 53
54. 3rd. 1st Select the variable
you wanted to select
4th. 2nd Click the arrow to
pass the variable”
Do the function you wanted to select
November 5, 2023 54
56. You can choose
the output option
here
Finally, click “OK”
Any analysis done will be on these selected
category fulfilling the criteria of selection
November 5, 2023 56
57. II) Simple random sample selection
• There is a need of a list of the population (Sampling
frame)
• From the pull down menu click “Data” and go down to
select “Select cases”
Data Select cases
November 5, 2023 57