Overview
SPSS on the RCI system may be run in either of two modes: batch or interactive. In
batch (i.e., noninteractive) mode, users prepare a file containing SPSS statements to be
submitted for processing. When processing is complete, SPSS creates a file containing
output which may be printed and/or viewed at a terminal. Batch mode processing is useful
for large, time consuming, SPSS jobs, and for relatively routine SPSS jobs which have
been tested and shown to be error free. This document describes the use of SPSS in
batch mode.
Conventions
Within this document, UNIX commands that you will enter at your terminal are in
Bold Courier font. Information intended to be typed into files or windows appears
in boldface. Filenames and (sub)directory names are in
italics.
Sample Run
Step 1:
Use the Emacs text editor to create a file
called try1.sps containing the SPSS
statements and raw data below (enter emacs
try1.sps at your terminal).
data list free / id var1 var2
begin data
01 2 3
02 4 4
03 4 2
04 2 1
05 2 3
06 3 9
end data
list vars=all
Type <Ctrl>x <Ctrl>s to save what you just entered (i.e., hold the
<Ctrl> key and press x, then hold the
<Ctrl> key and press s). Press
<Ctrl>x <Ctrl>c to exit emacs . (See the document entitled
Gnu EMACS Short Form for more details on
using Emacs)
Use the ls command to list the files in your directory. Note that you now have a
file called try1.sps.
Step 2:
Enter the following command at your terminal to submit the SPSS statements and
data contained in try1.sps for processing (do not include the first ">" - that is the
terminal prompt).
> spss -m try1.sps > try1.out
After the job runs, SPSS will create a file called
try1.out. This file will contain the
output of the SPSS job. In addition, SPSS will display a message on your
terminal informing you that the job has completed. For example:
End of job: 9 command lines 0 errors 0 warnings 0 CPU seconds
Use the ls command to list the files in your directory. Note that you now have a
file named try1.out.
Step 3:
View the try1.out file using either Emacs
(emacs try1.out) or the more program
(more try1.out).
Step 4:
Print try1.out (if you wish) using the
lpr command (contact the OIT/NBCS Help Desk for details on setting a preferred printer and bin for printed output).
lpr try1.out
Running Time-Consuming SPSS Jobs
When running the sample SPSS job described above, you probably noticed that
the terminal prompt (>) did not re-appear until all SPSS statements had been executed
(i.e., until the job was finished). As a consequence, no additional programs (e.g.,
emacs, zmlite, etc.) could be run until SPSS was finished. Although the small sample job
you submitted resulted in only a short delay, larger and more time-consuming jobs could
tie up your terminal for long periods, thus preventing you from doing additional work.
In order to force the terminal prompt to re-appear immediately after the SPSS job
is submitted, the job must be submitted for background processing. An SPSS job
submitted for background processing runs while you use you terminal for running other programs.
To run an SPSS job in the background, add an "&" to the end of the SPSS command
you type at your terminal (e.g., spss -m
try1.sps > try1.out &). The system
will display the process id (PID: a tracking number assigned by the computer's
operating system) of the SPSS job and will then return you to the terminal prompt. You can
then run other SPSS jobs, run other programs, or logout. None of these actions will affect
the SPSS job running in the background.
To check on the status of a SPSS job running in the background, use the
ps (process status) command. The ps
command will display the process identification
number (PID) of each process currently running and the name of the program associated with
the process. If the PID for a SPSS process is listed when you use the
ps command, then that SSPS process is still running. If the PID is not listed, the SPSS process/job has
completed and you may view the Log and Output files.