Introduction To Sample Surveys - Lab 4 How To Code Data From Questionnaires and Introduction To Syntax Editor
Introduction To Sample Surveys - Lab 4 How To Code Data From Questionnaires and Introduction To Syntax Editor
Introduction To Sample Surveys - Lab 4 How To Code Data From Questionnaires and Introduction To Syntax Editor
One of the questionnaires given on this website is the Youth Services Census. This
questionnaire is number 8 on the web page. Read the introduction to the questionnaire
and observe the information the researcher gives the respondents.
4.1. There are a number of different types of questions in this survey form. For each of
the following questions write down how you would code the question for input into
SPSS, indicating
how many columns you would need,
what value labels you would need, and
what form the basic descriptive output for this question would take.
We have already met with some of the question types, but not all.
How would you code this question for input into SPSS, and what form would the
descriptive output take?
This is an ordinal variable, and we would enter 1,…,7 into SPSS, but we would only label
1 and 7 (since we cannot assign meanings to the other responses, as they are not
explicitly stated). We would use frequencies to analyse the data.
4.3. In previous labs using the Attitudes to the Library data, we transformed our age data
using Transform>Recode and calculated age at a certain date using
Transform>Compute. We saved the results in a data file. Suppose we wanted to add
some cases to the data file. We would have to redo all the steps transforming the data.
Similarly, we created several multiple response sets, but these were not saved after we
logged off from our session. To overcome these difficulties we can use the Syntax Editor
which enables us to keep a record of a session and easily make modifications and redo
the analysis.
Open the Attitudes to the Library data used in the last two labs. Click on Analyze >
Descriptive Statistics > Frequencies and select Q1 for Variable[s]. Instead of clicking
on OK, click on Paste. The command will appear in the Syntax Editor. To execute the
command click on Run and select All. All the commands in the syntax window will be
executed. (If you had wanted to run only a subset of commands in the syntax window,
you would highlight the selected commands and click on Selection.) Save the syntax file
(extension .sps). You can reopen the file later and use the same commands again, or edit
them easily to produce the output you require.
An alternative way to generate a record of your syntax is to set up SPSS to automatically
record all syntax in the Output Viewer. Click on Edit > Options. Within the Options
dialogue box select Viewer and click Display commands in the log. (It may already be
selected.) Click on OK. (While you are in the Options dialogue box, notice that you can
change the order in which variables are presented in the dialogue boxes. Click on
General and you have the choice of displaying variable lists using labels or names and in
alphabetical order or file order.) Now click on Analyze > Descriptive Statistics >
Frequencies and select Q2 for Variable[s]. Click on OK. The syntax command will
appear in the output window above the frequency table, and you could copy and paste it
into a syntax file.
Write down the syntax that is produces (2 lines beginning with FREQUENCIES)
FREQUENCIES VARIABLES=Q2
/ORDER=ANALYSIS.
Note that SPSS syntax is not case sensitive and that all commands end in a full stop.