SPSS support materials
Key links:
Internal:
External:
--------------------------------------------------
The following SPSS format macro files (syntax command files) are used within the lab exercises distributed from the page 'workshop materials' :
command file which exercises a group of data management tasks on a specific data extract (ghs95.sav) |
command file which defines a number of generic regression models |
command file which adds text value labels to UK SEG occupational groups |
command file which adds text value labels to UK SEG occupational groups |
command file which computes a series of new dummy variables for a single categorical measure |
command file which transfers value labels between different files |
--------------------------------------------------
Working with SPSS : Some selected notes and advice
(written by Paul Lambert, 9/06, wrt SPSS version 14)
Good practice with SPSS : Three golden rules
Below are three rants regarding the use of SPSS for social science data analysis..!
1. Always work with SYNTAX .
To reiterate, always work in SPSS syntax commands!!!! SPSS processes, such as data analysis or variable manipulation, can be undertaken in two alternative ways: they can be invoked direct from the windows menus or icons (aka the GUI interface), or they can be invoked by running SPSS syntax (ie, text) commands. Most new users, and most textbooks, start by using / referring to the windows file menus. However, there are enourmous advantages to learning to work through SPSS syntax commands.
The main reason is that working through syntax enables you to keep a clear record of what you are doing with the data, how your are manipulating and analysing it, and then if need be, you can return to that syntax to repeat and / or alter your previous work in some way. By contrast, working with the windows menus involves changing the data and analysis interactively, and is a sure fire way to loose track of your work. Additional attractions of working in syntax files include that the commands allow you to see much more clearly what it is you are doing with the data, whilst working with syntax is also, after you have had just a little experience with it, far, far quicker than working through the windows menus.
This site maintained by Raynald Levesque is an excellent resource for working with SPSS, and includes, under the 'syntax' links, further discussions of why SPSS syntax is preferable, and extensive lists of example syntax applications.
The key to using SPSS syntax is that you have to write out (or copy) the text commands for each SPSS manipulation. This is much easier than it sounds, most commands are quite simple and after a little use you soon start to remember key parts of SPSS text. The names of the commands and the way in which their text formats are used can be found in several ways. The best is to get them from previous examples of work from other users. Alternatively you can look them up in the SPSS manuals or under the in-built 'help' options; look them up in appropriate textbooks (eg Bryman and Cramer 1994); or find them via the Windows menus : you can set up a manipulation / analysis via the windows menus, but then get the syntax written out as text by clicking 'paste' rather than 'ok'.
Running SPSS in syntax works by writing out the SPSS commands in an SPSS syntax window, then running the commands by highlighting the relevant section of the text file, and asking SPSS to run them (either Ctrl-R or click the 'run' icon). There are a few simple format rules you have to obey - each command starts on a new line and must end in a full stop, whilst comments can be added to help you by starting lines with the * symbol.
When working in SPSS, you can build up syntax command files, save them, edit them slightly if you want to change something, and rerun them. Syntax files also make life a lot easier in that there is little need to save the large SPSS output files, or even the altered dataset files: so long as you keep hold of your original data and all of the syntax commands you used to manipulate it, you can immediately reproduce anything that you did before.
2. Make backups of your datasets and syntax .
It is very important to keep track of what you are doing to your dataset - the most common source of problems concern users manipulating files and variables then not being able to retrace their steps when they realise they made a mistake. The first thing is to make multiple copies of your original SPSS data file so that you can return to it whenever you need, and remember to save any significant manipulations to data files with different names(!).
If you are working with SPSS syntax, all you really have to do is keep a hold of all your syntax files and manipulations, then you can retrace your steps through them if you need to; save several copies of syntax files, as you develop them, to different file names.
If for some reason you are trying to work from the SPSS windows menus, you will need to repeatedly save copies of your data files each time you change them, and also probably save copies of the SPSS output files (*.spo), which are very large and inconvenient to work with.
3. Avoid presenting raw SPSS output .
The SPSS output from data analysis procedures, particularly the tables of results, is sent to an SPSS output file (named *.spo) and can be printed or pasted into other ouput and printed. However, it seldom looks good in its raw form, it often includes unwanted additional statistics, and it often uses up a lot of space unneccesarily. It is far better practice to use the SPSS output as a guide to your own tables created by hand in, for example, Excel or Word - you will find that you can fit much more, selective, information, into much less space, by working this way.
Graphs are a little different and it probably will make sense to paste graphical ouput from SPSS files straight into documents (after editing them a bit on screen). However, few experienced SPSS users regularly print or save SPSS output, but instead use it to guide their more carefully produced final reports.
---------------------------------------------------------
Tip: Moderating SPSS output
When you run SPSS commands the output is sent to an output window. Quite how the output on this window is displayed depends upon the 'output settings' for your SPSS session. On a new session you will usually start with the default settings but in some circumstances it can be preferable to change them a little, some suggestions below:
--------------------------
Tip: Opening SPSS data files from the UK Data Archive
SPSS data files are usually saved in a standard format with a *.sav extension, eg "data1.sav". However, in some circumstances an alternative file format can be used, something called a 'portable' file format in which the file names are extension *.por, eg "data1.por". The UK Data Archive often supplies files in portable format rather than the standard format, so if you download a dataset from it, you may get an SPSS file something like "study1234n.por" or whatever name
These files have exactly the same information as a conventional *.sav file. The only significant difference is that a different command is needed to open them up in an initial SPSS session. Whereas for a sav file you might use something like
get file="c:\data\files\data1.sav".
for a portable file you need something like:
import file="c:\data\files\data1.por".
Once opened as a portable file, all of the same data analysis procedures are possible, and it is also possible to save out the data to a new name as a *.sav file, eg sav out="c:\data\files\data2.sav".
--------------------------
SPSS syntax textbooks:
Two texts were published in 2005 which featured guides to working with SPSS syntax commands:
Boslaugh, S. (2005) An Intermediate Guide to SPSS Programming: Using Syntax for Data Management. London: Sage. ISBN: 0761931856.
Levesque, R. (2005). SPSS Programming and Data Management, 2nd Edition. A Guide for SPSS and SAS users. Chicago: SPSS Inc. ISBN: 156827355X. (A free pdf version of this non-introductory book is available from the website, www.spss.com/spss/data_management_book.htm ).
--------------------------------------------------
More SPSS internet links:
Other data analysis resources: