Home > Data Services > Catalog . Restricted Data . Census . ACS

Search Data Services

Meta Search
search across all the following databases:

Data Catalog
Data and documentation

Common questions and answers.

Entire collection of data resources.

Latest Data News

RSS Feed icon

Getting A More Accurate Count Of Arab Americans

Measuring Race in the Census: Its Fluid

Expansion of Free Lunch Could Have a Negative Effect on Research Data

You’ll live longer than you think you will [HRS data]

Federal Register Notice: Some ACS questions on the chopping block

Running SPSS on UNIX

This memo describes how to run SPSS on UNIX. It does not explain SPSS statistical procedures. Please refer to the User's Guides for information about SPSS statistical procedures. It is also assumed that the user has a minimal degree of knowledge of the UNIX operating system.

The SPSS program can be run in two modes in the UNIX environment. The program can be run in batch mode (in which the program obtains all of its commands for a given session from a pre-defined command file) or in interactive mode (in which the user enters commands directly into the SPSS program).

Batch Mode:

To run SPSS in Batch Mode on UNIX, enter the following command:

spss -m [-s workspace] -t [outputfile] [commandfile] [> /dev/null] [&]


Interactive Mode:

There are three different ways in which SPSS can be run in interactive mode. SPSS can be run as a fully windowed Xwindow application. SPSS also has a text based interactive menuing and editing system known as the SPSS Manager. SPSS can also be run interactively without using the SPSS Manager or the Xwindow interface. If you decide to use the SPSS Manager, commands can be entered either using menus or can be typed in using the Review Editor. If you use the Xwindow interface, commands can be entered using the pull down menus or from a Syntax Window, exactly as in SPSS for Windows.

Prompted Session (running without the SPSS Manager):

When SPSS is run interactively, but without using the SPSS Manager, the SPSS program will furnish you with a program prompt. SPSS commands can then be entered one line at a time at the appropriate SPSS program prompts. SPSS is run as an interactive, prompted session as follows: spss -m [-s workspace] [-t outputfile] where:

In a prompted SPSS session, your place in the session will be indicated by the prompt displayed. The prompts are as follows:

You should not type past column 80 of your screen when running SPSS in a prompted session. Any information typed in column 81 and beyond will be lost and could lead to the incorrect interpretation of your command. If your command needs to extend beyond column 80, find a natural breaking point in your command line (at or before column 80), press [RETURN] and continue on the next line. When you press [RETURN], the prompt will change from SPSS> to CONTINUE> to remind you that you are simply continuing the SPSS command you began on the previous line. To mark the end of the command and to have SPSS execute that command, place a period at the end of the last line of the command you are entering. If you forget to type a period prior to pressing [RETURN] and receive the CONTINUE> prompt, simply press [RETURN] without typing anything and SPSS will interpret that as the end of your command and will attempt to execute it.

Using the SPSS Xwindow Interface:

To run SPSS using the Xwindow interface, use the following command: spss [-s workspace] where:

In order to run SPSS using the Xwindow interface, you must be logged on using some sort of Xwindow server connection. At PSC, this can be done by logging in directly at the Unix workstation or, from a PC running Microsoft Windows, using the eXceed program. SPSS will run very similarly to SPSS for Windows when run using the Xwindow interface. Please see the SPSS for Unix user guide for further details on using the Xwindow interface.

Using the SPSS Manager:

Cursor Control Keys:

[CTRL][P] - Cursor Up
[CTRL][N] - Cursor Down
[CTRL][B] - Cursor Left
[CTRL][F] - Cursor Right
[CTRL][O] - Page Up
[CTRL][L] - Page Down
[CTRL][A] - Move Cursor to Beginning of Line
[CTRL][E] - Move Cursor to End of Line
[CTRL][D] - Delete Character
[CTRL][G] - Toggle Insert/Overwrite Mode for Editor
[ESC][<] - Move Cursor to Top of File
[ESC][>] - Move Cursor to End of File
[ESC][,] - Move Cursor to Top of Window
[ESC][.] - Move Cursor to Bottom of Window
[ESC][O] - Redraw Screen
[ESC][!] - Execute UNIX Command

Function Keys:
To activate the function keys, press [ESC][n] where n is the number of the desired function. When running SPSS from an X-windows client (either a UNIX workstation running an X-windows shell or Hcl-eXceed under Microsoft Windows) press the appropriately numbered function key.

  1. Information (Help, Menus, Variable List, File List)
  2. Windows (Switch Windows, Zoom Window, Change Window Size)
  3. Input Files (Insert File into Input Window, Edit Different File)
  4. Lines (Insert, Delete, Undelete)
  5. Find and Replace
  6. Go To
  7. Define Area (Mark/Unmark)
  8. Area Actions (Copy, Move, Delete)
  9. Output Files (Write Area/Entire Window to File, Delete File)
  10. Run (Run From Cursor, Run Area, Exit SPSS)

Leaving the SPSS Manager:

The SPSS Manager operates separately from the SPSS Processor (the part of SPSS which actually carries out statistical analysis and data management). The FINISH command will only halt the SPSS Processor. In order to shut down the SPSS Manager and leave SPSS altogether, you need to use the Exit command under the Run function (even if you have already shut down the SPSS Processor using FINISH).

Some Additional Notes/Concerns:

Interoperability of Files

SPSS for Unix version 5.0 can freely interchange System Files with SPSS for Windows version 6.0 or higher. These are currently the only versions of SPSS that use the same file format (although SPSS for Macintosh version 6.0 will also use the same file format when released next year). If you are moving SPSS datasets between any other operating system or older versions of SPSS for Unix, SPSS for Windows or SPSS/PC, you will need to create a Portable File using the EXPORT command and then IMPORT the file into SPSS for Unix.

Saving Input and Output Under SPSS Manager:

SPSS will not automatically save the contents of the Input and Output windows in the Xwindow interface or the SPSS Manager. In order to save the contents of the Input and Output windows, you need to use the File Save command of the Xwindow display for each window or the Output Files function of the Manager for each Manager window prior to exiting SPSS. If you have not saved the contents of either the Input or Output windows (or if the contents of either have changed since the last save), you will be prompted to save the contents of the windows before SPSS terminates). This also applies to any Syntax windows you may have opened using the Xwindow interface.

Reading Raw Data Files with Long Records:

When reading raw data files into SPSS using the DATA LIST command, if the records of the file are longer than 1,024 characters, you will need to tell SPSS how long the records are. This cannot be done within the context of the DATA LIST command itself. You need to set up a File Handle, using the FILE HANDLE command, to point to the data file you want to use and then refer to that file in the DATA LIST command by its File Handle. To tell SPSS how long the file's records are, you add the LRECL=n parameter to the FILE HANDLE command, where n is the length of the files records (i.e. its logical record length)

(Data List command continues here)

You would also use the FILE HANDLE command to accommodate other types of raw data files. See SPSS for UNIX: Operations Guide (pp. 69-71) for further details.

Allocating Memory Workspace:

The SPSS program will reserve for its own use 200 kilobytes of memory when it starts. If you are working with a large dataset or are attempting to perform a computationally complex analysis with even a relatively small dataset, this may not be enough memory for SPSS to do its job. Unfortunately, unlike some other UNIX programs, SPSS will not attempt to get additional memory for itself if it needs it. Therefore, if you are going to be working with a large datafile (near or more than 200 kilobytes in size) or if you are going to be performing a complex analysis on a dataset, even one significantly smaller than 200 kilobytes, you will need to tell SPSS to obtain more memory when starting the program. This is done with the -s workspace parameter, where workspace is the amount of memory you want SPSS to get from the operating system when starting. The amount of memory can be specified in either kilobytes by placing a k at the end of the workspace parameter or in megabytes by placing a m at the end of the workspace parameter.

Run SPSS with a 500 kilobyte workspace:
spss -s 500k
Run SPSS with a 5 megabyte workspace:
spss -s 5m

While you should endeavor to get enough memory for your job to run, you should not attempt to obtain too much memory. The larger the workspace SPSS has to get, the slower the machine will perform (not only the SPSS job, but all other jobs on the machine).

Temporary Files Created by SORT:

When SPSS attempts to sort the active file using the SORT procedure, the SPSS program will invoke the UNIX sorting utility. During the process of the sort, a scratch file containing the intermediate results of the sort will be created on the working directory from which the SPSS program was launched. If there is not enough free disk space on the device the working directory resides on, the sort will fail. If you plan on sorting using SPSS, check to make certain that there is enough free disk space on the device that the working directory you plan to run SPSS resides from resides on (this can be checked using the df command for either local or NFS devices and fs lq for IFS devices). If you don't have enough free disk space, use the cd command to move to a directory whose device has enough free disk space.

Returning to Menu Mode After Running an SPSS Command:

Normally, when running the text based SPSS Manager in Menu Mode, when you tell SPSS to run a command or group of commands, the Menu window will disappear and will not reappear unless you explicitly tell it to do so (using the Menu option in the Information function menu). This is done to give the user an opportunity to study the output before proceeding to the next analysis (since the Menu window and its related Help window will overlay the Output window). Also, when SPSS finishes with a command, the Output window will be the active window. Therefore, if you are directly typing commands into the Review Editor and running them from there, you will still need to switch from the Output to the Input windows before entering additional commands.