Professional Documents
Culture Documents
Using SPSS and PASW/SPSS syntax - Wikibooks, open books for an open world
Now, suppose you want a frequency table of the variable relig in order to see what religions many of
the genetic counselors identify with. You could repeat the above procedure but choose relig instead of
attend. Or you can use syntax.
To begin using syntax, go to File New Syntax, like this:
http://en.wikibooks.org/wiki/Using_SPSS_and_PASW/SPSS_syntax
1/6
5/21/2015
Using SPSS and PASW/SPSS syntax - Wikibooks, open books for an open world
This window is the Syntax Editor window and it allows you to control the many statistical tests available
in SPSS (and many other functions) using programming language rather than point and click mouse
movements.
One of the easiest ways to get started using syntax is simply to change your Preferences in SPSS to
include syntax in the Output Window (see Chapter 7). You can then use that syntax to run the same
commands or similar commands in the Syntax Editor window.
Returning to the example... Since we want to run the frequencies on the variable relig, we can start by
returning to the original output window where you can copy the syntax from your original command just
above the frequency table. The syntax is located in the red box below:
http://en.wikibooks.org/wiki/Using_SPSS_and_PASW/SPSS_syntax
2/6
5/21/2015
Using SPSS and PASW/SPSS syntax - Wikibooks, open books for an open world
To copy the syntax, you will have to double-click on it, then select it and hit CTRL+C (the copy
command in most operating systems). Now return to the Syntax Editor window and paste the syntax into
the blank syntax window you have already opened, it should look like this:
While it is beyond the scope of this chapter to explain all of the syntax commands available in SPSS, the
above commands are relatively straightforward. Let's begin with the first word:
FREQUENCIES
This is a command that will tell SPSS which statistical test to perform. In our case, we simply want
Frequencies. The second word is paired with an equals sign and includes our variable of interest:
VARIABLES=attend
This is a modifier for the first word, FREQUENCIES, that tells SPSS which variables will be analyzed.
The last part of the syntax simply tells SPSS how to organize the analysis and output:
http://en.wikibooks.org/wiki/Using_SPSS_and_PASW/SPSS_syntax
3/6
5/21/2015
Using SPSS and PASW/SPSS syntax - Wikibooks, open books for an open world
/ORDER=ANALYSIS.
The period . at the end of ANALYSIS tells SPSS that is the end of a series of commands, so the
software knows where this small program ends.
Now, erase the word attend and replace it with the word relig, which is the name of the religious
affiliation variable in our example dataset, and click the blue arrow which tells SPSS to run the syntax.
The blue arrow is circled below:
The new frequency table for the variable relig should pop up in your output box. Voila! You have
successfully run a small computer program using SPSS syntax. Your output window will now have
frequencies for both variables and should look like this:
http://en.wikibooks.org/wiki/Using_SPSS_and_PASW/SPSS_syntax
4/6
5/21/2015
Using SPSS and PASW/SPSS syntax - Wikibooks, open books for an open world
Now, if we wanted to see if the religiosity of genetic counselors varies by their attitudes towards women
getting abortions because they are single and do not wish to marry the father of their unborn baby
(absingle), we begin by copying and pasting the syntax from the ANOVA statistical test in the Output
Window into the Syntax Editor window. Replace the variable abpoor with the variable absingle. The
syntax window should look like this:
If you wanted to, you could also copy this syntax and paste it five more times, then replace the abortion
attitudes variable in the syntax each time. When you're ready, run the test, click Run. (Note: You can
run all six tests at one time by highlighting them all and selecting Run.) In your Output Window you
http://en.wikibooks.org/wiki/Using_SPSS_and_PASW/SPSS_syntax
5/6
5/21/2015
Using SPSS and PASW/SPSS syntax - Wikibooks, open books for an open world
Once again, genetic counselors' religiosity varies by their abortion attitudes. However, regardless of
whether or not the results show there is no significant relationship, what is important is that you can save
time and energy by using syntax, particularly when you have a repetitive task you need to run many
times. This chapter has only scratched the surface of syntax in SPSS; it can be used to run the entire
program, avoiding the Data Editor window almost entirely. It should also be noted that other statistical
software, like SAS and R, rely much more heavily on syntax. SPSS is known for being more userfriendly as it allows people to point and click to run tests.
Chapter contributed by Victoria Blyde.
Retrieved from "http://en.wikibooks.org/w/index.php?
title=Using_SPSS_and_PASW/SPSS_syntax&oldid=1884043"
http://en.wikibooks.org/wiki/Using_SPSS_and_PASW/SPSS_syntax
6/6