27.03.2013 Views

SPSS® 12.0 Command Syntax Reference

SPSS® 12.0 Command Syntax Reference

SPSS® 12.0 Command Syntax Reference

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

782 KEYED DATA LIST<br />

from 1, for the nonexistent area code 200, through 160, for area code 919. The file would<br />

then have a manageable number of unused records.<br />

Keyed Files<br />

Options<br />

Of the many kinds of keyed files, the ones to which the program can provide access are<br />

generally known as indexed sequential files. A file of this kind is basically a sequential file<br />

in which an index is maintained so that the file can be processed either sequentially or selectively.<br />

In effect, there is an underlying data file that is accessed through a file of index entries.<br />

The file of index entries may, for example, contain the fact that data record 797 is associated<br />

with social security number 476-77-1359. Depending on the implementation, the underlying<br />

data may or may not be maintained in sequential order.<br />

The key for each record in the file generally comprises one or more pieces of information<br />

found within the record. An example of a complex key is a customer’s last name and house<br />

number, plus the consonants in the street name, plus the zip code, plus a unique digit in case<br />

there are duplicates. Regardless of the information contained in the key, the program treats<br />

it as a character string.<br />

On some systems, more than one key is associated with each record. That is, the records<br />

in a file can be identified according to different types of information. Although the primary<br />

key for a file normally must be unique, sometimes the secondary keys need not be. For<br />

example, the records in an employee file might be identified by social security number and<br />

job classification.<br />

Data Source. You can specify the name of the keyed file on the FILE subcommand. By default,<br />

the last file that was specified on an input command, such as DATA LIST or REPEATING DATA,<br />

is read.<br />

Summary Table. You can display a table that summarizes the variable definitions.<br />

Basic Specification<br />

• The basic specification requires FILE, KEY, and IN, each of which specifies one variable,<br />

followed by a slash and variable definitions.<br />

• FILE specifies the direct-access or keyed file. The file must have a file handle already defined.<br />

• KEY specifies the variable whose value will be used to read a record. For direct-access<br />

files, the variable must be numeric; for keyed files, it must be string.<br />

• IN creates a logical variable that flags whether a record was successfully read.<br />

• Variable definitions follow all subcommands; the slash preceding them is required.<br />

Variable definitions are similar to those specified on DATA LIST.<br />

Subcommand Order<br />

• Subcommands can be named in any order.<br />

• Variable definitions must follow all specified subcommands.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!