SPSS Data Sets
SPSS system files
A system file is a file that contains data and program together in binary format. These files can be processed by computers much more quickly than can ASCII files. Creating a system file substantially reduces the computer processing time, especially with several data transformation steps. System files are normally created with variable names, value labels, variable labels, and data manipulation steps.
Suppose you want to create a system file from the data (clas.dat) and command (clas1.sps) files created earlier. Add the SAVE OUTFILE immediately after the VALUE LABELS command in the command file.
The general syntax for creating a system file is:
Replace systemfile with an appropriate path name and filename for storing the system file. Note: Any external file in SPSS that is encased in single-quotes must be in the correct case.
A system file is readable only by the operating system from where it was created. The general syntax for accessing a system file is:
Replace systemfile with the name of the file. Specify a full pathname when applicable.
SPSS portable files
If you are using SPSS under other operating systems (e.g., Macintosh, Windows), you can move your SPSS files to a Unix environment. However, SPSS system files created under one operating system are not readable under another system. For example, an SPSS system file created under Windows is not readable under Unix. There are variations of Unix, and system files created under one Unix platform are not readable from another. For example, a SPSS system file created under IBM AIX (libra), and vice versa.
When you want to use a system file created under one operating system on another, you must create an export file and move it to the host machine. The general syntax (irrespective of the operating system) for creating an export format file is:
Replace exportfile with appropriate filename. In some instances, you may want to give the full pathname where the export file is to be stored. Once the export file is in the designated operating system, use the import command to read the import file. The general syntax for reading an export file is:
Replace exportfile with the name of the file you moved from the source operating system.
If you want to create a system file from the export file, add another command line to the above import command line:
Replace systemfile with an appropriate filename for storing the system file.
Reading compressed files
For SPSS 6.1 on UNIX, you can create and use compressed ASCII data files, SPSS systems files, and SPSS portable files. This means you can compress any SPSS data files you have in order save disk space on your account.
To compress an SPSS file, use the UNIX "compress" command which uses the Lempel-Ziv compression method. At your UNIX prompt, type:
Replace the filename with the name of the file you want to compress. This creates a new file with the extension ".Z". For example, if you compressed a file called "test.dat," a compressed file called "test.dat.Z" would be created.
To read this file into SPSS, use the FILE HANDLE command. For example,
FILE HANDLE alias/INPIPE="zcat filename.Z".
Replace alias with the file handle (nickname) you'll assign the compressed file. It can be up to 8 characters long. Replace filename.Z with the name of your compressed file (remember to always have a .Z extension). This can either be an ASCII data file or an SPSS systems file. Be sure, also, to include the path of the data file if the file is stored somewhere other than the default directory from which you are running SPSS.
For example, if you had an ASCII data file called "test.dat" with 10 variables (v1-v10) that you wished to compress and then access, the command to compress the file is:
To use this file in SPSS, use the following SPSS commands:
FILE HANDLE test/inpipe="zcat test.dat.Z". DATA LIST FILE = test / v1 to v10.
You can then execute this command file as you normally would.
If you are using a compressed SPSS systems file, you would use the same syntax, but you would use the GET FILE command instead of a DATA LIST statement. If "test.dat" was an SPSS systems file instead of a compressed ASCII file, you would replace the second line above with:
GET FILE = test.
Finally, if "test.dat" were a compressed SPSS portable file, you would use the IMPORT FILE command:
IMPORT FILE = test.
Transferring files between SPSS and SAS
SPSS can read SAS transport format files and create SPSS system files. The general syntax for reading a SAS transport format file and creating an SPSS system file is:
GET SAS DATA='sastransportfile'. SAVE OUTFILE='fromsas.sys'.
Replace sastransportfile with the name of the SAS transport format file, and fromsas.sys with an appropriate filename to store the system file. An SPSS system file or export file is also readable during a SAS session.
SPSS can also read data files created using Lotus, Excel, dBase, and so on. Refer to the GET TRANSLATE command in the SPSS System Syntax Reference Guide (Release 5.0 or 6.1).
Next: Temporary Disk Space
Prev: Getting Started
Up: Table of Contents