1. SPSS Series
“Basics to Data Entry and Coding”
Dr. Majdi N. Al-Jasim
Consultant Family Medicine
2. OBJECTIVES
By the end of this workshop, you should be able to
achieve:
Proper way of data entry in SPSS.
Proper coding of different question types using SPSS.
4. Toggle between “Data
View” & “Variable View”
Each number represents a
participant or responder
Variables that could be
one coded or non-coded
item; as well as a newly
created parameter
Data View
6. Variable View
❑ Name: The nickname for your variable. It should start with letter
and does not include any operational characters “? ! * = + ( )
/ < >[ ]{ }” and does not end by dot “.” or underscore “_”. Also
no spacing is allowed. It should not exceed 64 characters.
❑ Type: The most commonly used types are:
▪ Numeric: this is the default in SPSS in which the data entry
will consists only of numbers, i.e. continuous data or
coded variables.
▪ String: here you can type any word in the variable. It is
used mainly for “open ended questions”, names… etc.
7. Variable View
❑ Width: How many characters you can put in the string
variable type. By default it is set to “8”.
❑ Decimals: How many decimal points can be viewed in
numeric variable type. By default it is set to “2”. Keep in
mind if your number doesn’t consist of decimal point, it will
be shown as “.00” as decimal points.
8. Variable View
❑ Label: Here you can put any description you like. All
characters are allowed here. It should not exceed 256
characters.
❑ Values: This is where you do coding for your variables. The
coding could be numeric or alphabetic (it is better to do
numeric coding because it can be used in data analysis
and processing later on). The value label should not
exceed 60 characters.
9. Variable View
In “Value” box, you will
put your code
In “Label” box, you will
put the real description
of your code. Max
characters is 60
All entered codes and
labels will be shown
here in this box
10. Variable View
❑ Missing: Here you can put a code for any missing data.
Usually the numeric code “99” is used since it is unlikely to
be used in the coding process of any other variable.
❑ Columns: Is the width size of column in Data View. By
default it is set to “8”.
❑ Align: Text alignment. By default it is set to “Right”.
11. Variable View
❑ Measure: This is could be:
▪ Nominal: Any categorical data in which the coded
value doesn’t matter.
Example: it doesn’t matter if you code (female = 1) or
(female = 2) in gender coding.
▪ Ordinal: Any categorical data in which order matters.
Example: severity, ranking, level… etc.
▪ Scale: Any continuous data.
Example: weights, height, age , scores… etc.
12. Variable View
❑ Role: The most commonly used types are:
▪ Input: used for independent variables (IV).
▪ Target: used for dependent variables (DV).
Usually you don’t need to change anything here since during
analysis you will set IV and DV anyway!!
14. Ground Role
Before doing data entry, you should
do manual appropriate coding for
your questionnaire before hand.
This is important for later reference
for you and for appropriate scoring
summation of certain items.
18. “No specific correct answer”
Use SPSS to do data entry and coding of the following question?
1# Multiple Choice Question
What is your marital status?
□ Single
□ Married
□ Divorced
□ Widowed
19. Data entry & coding tips:
In data entry and coding of MCQ without
specific correct answer, you can put
coding of the responses anyway you like.
Single = 1 Married = 2
Divorced = 3 Widowed = 4
1# Multiple Choice Question
20. 1# Multiple Choice Question
Go to “Values”, and start your
coding for marital status
21. 1# Multiple Choice Question
Since marital status is
Categorical Data, Set
“Measure” to nominal
22. 1# Multiple Choice Question
This icon can toggle
between codes and
real entry name
24. “With one specific correct answer”
Use SPSS to do data entry and coding of the following question?
2# Multiple Choice Question
One of the following is criterion to diagnose DM-2:
□ FPG ⩾ 100mg/dL
□ RPG ⩾ 120mg/dL
□ HbA1C ⩾ 6.5%
□ Urine sugar ⩾ +3
25. Data entry & coding tips #1:
In data entry and coding of MCQ with
one specific correct answer, put coding
of the responses anyway you like. Later
on during scoring summation, use the
option “record into different variable” to
give the correct answer the highest score
(for example “5”) and the rest wrong
answers give them “0”
2# Multiple Choice Question
28. 2# Multiple Choice Question
In Record into Different Variables, transfer your variable into “Input
Variable -> Output Variable” box, then give the new variable a name
and label, then press “Change”, then press “Old and New Values”
29. 2# Multiple Choice Question
In this dialogue, put in
“Old Value” area in
“Value:” box the code of
correct answer and then
in “New Value” area in
“Value:” box give it the
correct answer mark (like
“5”).
Repeat the same process
for wrong answers but
give them the mark “0” in
“New Value” area in
“Value:” box .
30. 2# Multiple Choice Question
You will have new variable that
is coded with “0” and “5”
values, you will just need to give
these values new labels
31. 2# Multiple Choice Question
In variable view, you can give
labels to the new codes values
32. 2# Multiple Choice Question
Here, give value “0” a label
“wrong answer”, and give
value “5” a label “correct
answer”
33. 2# Multiple Choice Question
Toggle between codes
and real entry name to
check results
35. 3# Multiple Choice Question
Do you have any of the following chronic disease
(you may choose more than one):
□ Hypertension
□ Diabetes Mellites
□ Bronchial asthma
□ Anemia
□ Other (specify) ………………………………….………………
“Possibility of more than one response”
Use SPSS to do data entry and coding of the following question?
36. Data entry & coding tips #1:
In data entry and coding of MCQ with
possibility of more than one response (no
correct or wrong answer), put the coding
for each choice as “0” if unticked and as
“1” if ticked.
Here you will end up with several variable
entry in SPSS.
Hypertension = 0 / 1 DM = 0 / 1 BA = 0 / 1
Anemia = 0 / 1 Other = 0 / 1
3# Multiple Choice Question
38. 3# Multiple Choice Question
Toggle between codes
and real entry name to
check results
39. Data entry & coding tips #2:
If you want to know exactly who only
choose some specific answers in MCQ
with possibility of more than one
response, you will need to go to the
option “Data” then “Select cases…” and
then from the choice “if condition is
satisfied” code all specific answers with
“1” and the rest with “0”.
3# Multiple Choice Question
40. 3# Multiple Choice Question
Let’s say you want to know how many
have both Hypertension and Diabetes
Mellites, go to “Data” menu and
choose “Select Cases…”
ADVANCED TIP !
41. 3# Multiple Choice Question
Now from “Select” area, choose
“If condition is satisfied” and the
press “If…”.
42. 3# Multiple Choice Question
In this dialogue, declare
Hypertension as “=1”
which is referred to
“Yes” coding. Then put
the parameter “&” and
declare the same for
Diabetes Mellites
43. 3# Multiple Choice Question
You will notice a new variable created called “filter_$”. Also
notice only participants with both Hypertension and Diabetes
Mellites are selected. The rest has been crossed.
Here, out of 4 cases only 1 case has both Hypertension and
Diabetes Mellites.
44. 3# Multiple Choice Question
Before doing frequency analysis, you noticed only 1 case out of 4
has both Hypertension and Diabetes Mellites.
45. 3# Multiple Choice Question
In Frequency dialogue, choose the variable “Hypertension = 1
and Diabetes Mellites = 1” then press “OK”.
46. 3# Multiple Choice Question
In the output screen, it mentioned you only have 1 case that has both
Hypertension and Diabetes Mellites and that is exactly the reality.
47. 3# Multiple Choice Question
REMEMBER…
Any further analysis you
will do later on will have
the filter you created
active (i.e. “filter_$” ).
You need to remove it
if you don’t need it
anymore.
48. Data entry & coding tips #3:
As a good practice, MCQ with more than
one correct answer SHOULD be avoided.
3# Multiple Choice Question
50. “Keeping logical order”
Use SPSS to do data entry and coding of the following question?
4# Ordinal Question
What is your educational level:
□ Illiterate
□ Primary school
□ Intermediate school
□ Secondary school
□ University
□ Higher education
51. Data entry & coding tips:
In data entry and coding of ordinal
question, you must put the coding in
logical stepwise manner, either
descending or ascending.
This logical stepwise manner is important
for logistic regression analysis later on.
Illiterate = 1 1ry school = 2
Intermediate school = 3 2ry school = 4
University = 5 Higher education = 6
4# Ordinal Question
56. Use SPSS to do data entry and coding of the following question?
5# Continuous Data Question
What is your age in years:
……………………………..……………………… Years
57. Data entry & coding tips:
In data entry and coding of continuous
data question, you just declare the
variable type as “Numeric” and variable
measure as “Scale”.
5# Continuous Data Question
58. 5# Continuous Data Question
Since age is continuous Data,
Set “Measure” to scale
Since age is
continuous Data, Set
“Type” to numeric
60. “Q2 is dependent question”
Use SPSS to do data entry and coding of the following question?
6# Dependent Question
Q1. Did you have abortion previously:
□ Yes
□ No
If answer is (Yes), please answer Q2;
otherwise go to Q3
Q2. About how many times you got
abortion:
□ Once
□ Twice
□ More than twice
61. Data entry & coding tips:
In data entry and coding of dependent
question, you must put coding in case
there was a jump between questions.
Here if the responder does not need to
answer the dependent question, you
should put extra coding for “non-
applicable” response and code it as “0”.
Non-applicable = 0 Once = 1
Twice = 2 More than twice= 3
6# Dependent Question
64. 6# Dependent Question
In the dependent question
you should put extra code
for “Non-applicable”
response.
It is better to code it as “0”
since it can be used to
calculate scores later on
66. “With desired response”
Use SPSS to do data entry and coding of the following question?
7# Likert Scale Question
Folic acid intake during pregnancy can prevent neonatal spina bifida:
□ Strongly agree □ Agree □ Neutral □ Disagree □ Strongly disagree
Strongly agree is the best desired answer here followed by agree, neutral,
disagree and the least strongly disagree.
67. 7# Likert Scale Question
Folic acid intake during pregnancy can prevent sickle cell anemia:
□ Strongly agree □ Agree □ Neutral □ Disagree □ Strongly disagree
Strongly disagree is the best desired answer here followed by disagree, neutral,
agree and the lest strongly agree.
“With desired response”
Use SPSS to do data entry and coding of the following question?
68. Data entry & coding tips:
In data entry and coding of scale
question with desired response, code the
most desired response with the highest
score and going down to the least
desired one.
7# Likert Scale Question
69. Notice scoring of these two
items differ from the rest since
the desired response is reversed
7# Likert Scale Question
70. 7# Likert Scale Question
Likert max score “5” is given
to “Strongly agree” for this
question
71. 7# Likert Scale Question
It may be called Likert scale but it is
actually not a scale measure in SPSS. It is
considered as categorical data and so
it is Nominal Measure. Some might
consider it as Ordinal Measure
72. 7# Likert Scale Question
Likert max score “5” is given
to “Strongly disagree” for
this question
74. 8# Likert Scale Question
How frequent you visited emergency department in the last month:
□ Very frequent □ Frequent □ Rarely □ Very Rarely □ Never
“Without desired response”
Use SPSS to do data entry and coding of the following question?
75. Data entry & coding tips:
In data entry and coding of scale
question without desired response, you
can put coding of the responses anyway
you like.
Very frequent = 5 Frequent = 4
Rarely = 3 Very rarely = 2
Never = 1
8# Likert Scale Question
76. 8# Likert Scale Question
Since there is no desired
response, you can
code Likert scale
whatever you like
77. Summary
SPSS Data Entry and
Coding
The most important parts in data entry in Variable View
are variable name, type, label, values and measure.
There are different ways of coding in SPSS depending on
the type of question. Proper coding in SPSS will ensure
smooth data analysis later on.