ITS homepage
       
    
Welcome
Getting Started
Account Forms
Banner System
BannerWeb
Blackboard
File Transfer
GroupWise
Internet Browsers
Macintosh
Microsoft Office
Access
Excel
PowerPoint
Word
Microsoft Windows
Newsgroups
Passwords
Smith Network
Smith ResNet
START for Students
Statistical Tools
Telephones
Terminal Emulators
Training
Unix
Viruses & Spyware
Web Development

Using SPSS on Sophia

SPSS, a powerful all-purpose statistical analysis program, is the primary data analysis program used at Smith. SPSS is available on both the Windows and Macintosh computing platforms.

Users interested in sophisticated statistical analysis of large data files will find that Sophia, our UNIX host, is the best place to get the job done. No other platform can offer comparable performance. Users have access to Sophia from all our Novell networks.

SPSS can be run in two ways: interactively and batch mode. The latter is more efficient, and this document will discuss it in detail. Interactive mode is useful for data exploration, and will be discussed in brief at the end of this document.


Using SPSS in Batch Mode

Creating a Batch File

At the % prompt, type: pico test.sps. <enter>

This will invoke Pico, and you can begin typing SPSS commands.

 Figure 1. A sample Pico session.

If you want to print your output on a laser printer, you will want to set the width to 80 columns.
The first line of your batch program would be: 

set width 80.


Before you can do any data manipulations statistical analysis, you must reference a system file. You can name a file on your own account, or any publicly readable file on someone else's. If you plan to do a lot of data analysis, it is a good idea to create a data directory on your account. The document An Introduction to UNIX at Smith College includes instructions on how to create a directory. If you have a directory called data, you might include a file reference like this:

get file "data/test.sav".


Since SPSS doesn't understand the ~ abbreviation for users' accounts, you must specify the full path when referencing a file on someone else's account. For example, to get to a file in the Sociology 201 directory on Tim Shortell's account, you would type:

get file "/home/x1/tshortel/data/soc201/example.sav".


Once you have referenced an SPSS system file, you are ready for data manipulation or analysis. A typical SPSS batch file might look something like this:

set width 80.

get file "/home/x1/tshortel/data/soc201/example.sav".

display dictionary /vars all.

frequencies vars v1 to v10 /format notable /stats mean median stddev min max.

correlations v1 to v5 /print sig.

Commands should end with a period. If a command wraps onto a second line, indent it. File references should be enclosed in quotations.

If you do any data manipulation and want to save the changes, you should include a save command, as in:

save outfile "/home/x1/tshortel/data/soc201/example.sav".

If this is the same file that was referenced in the get file command, the save file will write over the original version.

You can include multiple get file commands in a single batch file, but only one system file is retained at any one time. When you reference a new file, the old one is abandoned -- and any changes made in it are lost unless saved with the save command.

To save your changes, hold down the control key and press o. To exit pico, hit ^x.


Submitting a Batch File

To submit the file, at the system prompt, type:

spss test.sps > test.out & <enter>

This tells SPSS to process the first file specified (the syntax file, which ends .sps) and send the results to the file named after the redirect symbol (>) (Remember to use lower case, as UNIX is case sensitive). The last character, &, tells UNIX to run the job in the background. This way, you can go on working while the file is processed. Of course, SPSS on Sophia is so fast that it will probably return the output before you would have the opportunity to get started on anything else!

The system will prompt you when the job is finished.

 Figure 2. The system notifies the user that the SPSS batch job is completed.

You can now view the output. Use Pico to view and/or edit the output file. In the example in Figure 2, the user would type:

pico test.out <enter>

to examine the results of test.sps. Unless you specify otherwise in the spss command, SPSS will send the output back to the current working directory.


Printing Files

Once you are satisfied that your results are in order, you can send the output file to a printer. Many networked printers have a queue on Sophia. To see the available printers in the Jahnige Center, type:

printers jahnige <enter>

This will produce:

Printer Name: jahnige_hp

Aliases: j_hp

Description: HP LaserJet in Jahnige Resource Center (Wright Hall)

Printer Name: jahnige_ps

Aliases: jahnige_postscript, j_ps

Description: Postscript printer in Jahnige Resource Center (Wright Hall)

Printer Name: jahnige_epson

Aliases: jahnige, j

Description: Epson printer in Jahnige Resource Center (Wright Hall)

These are the names of all the print queues for Jahnige Center printers. You could specify Bass, Seelye, or faculty (for faculty printers), and so forth.

You specify a particular printer with the -P switch; for example, to print to the Jahnige Center postscript printer, you would type:

lpr -Pj_ps example.lst <enter>

You can also print batch files. You should not, however, print data files. These tend to be rather large and can use hundreds of sheets of paper.


SPSS Naming Conventions

SPSS uses the following naming conventions. System files - binary files with data and formats combined - have the extension .sav. Syntax files, or batch files, have the extension .sps. Output files have the extension .lst.

UNIX is case sensitive, so test.sav and Test.sav are different files. If you receive the following error message,

>Error # 31 on line 1 in column 10. Text: data/example.sav
>File not found.
>No further commands will be executed. Error scan continues.


Check to make sure that the file reference matches the name of the file exactly. You can check the file names with the ls (list) command:

ls *.sav <enter>

This will display all of the files with the extension .sav in the current directory.

Unlike DOS/Windows, filenames may be longer than 8 characters. The following are valid file names:

EliteGroup0.sav EliteGroup3.sav EliteIdeology.sav
EliteGroup1.sav EliteGroup4.sav EliteProx.sav
EliteGroup2.sav EliteGroup5.sav


Using SPSS in Interactive Mode

When running an interactive session of SPSS, commands are executed as they are issued, one at a time, and the results written to the screen. This is useful for data exploration.

Often, when running an interactive session, you will want to keep a copy of the results in a file as well as view them on screen. You can specify this when you invoke SPSS, with the following command:

spss -t InteractiveSession1.lst <enter>

In this example, the output from the session will be written to the file InteractiveSession1.lst in the current working directory. Remember to use the lowercase to invoke SPSS.

 Figure 3. A sample SPSS interactive session.

The prompt will change from the system prompt (%) to the SPSS prompt (SPSS>). You can now enter any valid SPSS commands.

When you hit the enter key, SPSS immediately executes the command and writes the output to the screen (and to a file, if you specified that option when you started the session).

To start, you will need to reference a SPSS system file, with the get command. As with batch mode, you can keep only one system file at a time in working memory. If you reference a second system file, the first will be discarded and any changes to it lost, unless you have saved them with the save command.

When you are finished, type: finish.

The system will respond with a summary of your interactive session, and return to the system prompt.


For Additional Help

A full set of SPSS users guides are available in the Jahnige Center. Users can also consult the Jahnige Center statistician, x3043, for assistance with SPSS on Sophia.


  
..........................................................................................................................................

Copyright © 2004 Smith College // Northampton, Massachusetts 01063
Maintained by Information Technology Services // Main Office (413) 585-3770
For user support, call (413) 585-4487 // Send comments to tara@email.smith.edu
Notice of Nondiscrimination // Copyright Information // Last update: 2/5/2003