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.

KEYED DATA LIST<br />

KEYED DATA LIST KEY=varname IN=varname<br />

FILE=file [{TABLE }]<br />

{NOTABLE}<br />

/varname {col location [(format)]} [varname ..]<br />

{(FORTRAN-like format) }<br />

Example<br />

FILE HANDLE EMPL/ file specifications.<br />

KEYED DATA LIST FILE=EMPL KEY=#NXTCASE IN=#FOUND<br />

/YRHIRED 1-2 SEX 3 JOBCLASS 4.<br />

Overview<br />

KEYED DATA LIST reads raw data from two types of nonsequential files: direct-access files,<br />

which provide direct access by a record number, and keyed files, which provide access by<br />

a record key. An example of a direct-access file is a file of 50 records, each corresponding<br />

to one of the United States. If you know the relationship between the states and the record<br />

numbers, you can retrieve the data for any specific state. An example of a keyed file is a file<br />

containing social security numbers and other information about a firm’s employees. The<br />

social security number can be used to identify the records in the file.<br />

Direct-Access Files<br />

There are various types of direct-access files. This program’s concept of a direct-access file,<br />

however, is very specific. The file must be one from which individual records can be selected<br />

according to their number. The records in a 100-record direct-access file, for example, are<br />

numbered from 1 to 100.<br />

Although the concept of record number applies to almost any file, not all files can be<br />

treated by this program as direct-access files. In fact, some operating systems provide no<br />

direct-access capabilities at all, and others permit only a narrowly defined subset of all files<br />

to be treated as direct access.<br />

Very few files turn out to be good candidates for direct-access organization. In the case<br />

of an inventory file, for example, the usual large gaps in the part numbering sequence would<br />

result in large amounts of wasted file space. Gaps are not a problem, however, if they are<br />

predictable. For example, if you recognize that telephone area codes have first digits of 2<br />

through 9, second digits of 0 or 1, and third digits of 0 through 9, you can transform an area<br />

code into a record number by using the following COMPUTE statement:<br />

COMPUTE RECNUM = 20*(DIGIT1-2) + 10*DIGIT2 + DIGIT3 + 1.<br />

where DIGIT1, DIGIT2, and DIGIT3 are variables corresponding to the respective digits in the<br />

area code, and RECNUM is the resulting record number. The record numbers would range<br />

781

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

Saved successfully!

Ooh no, something went wrong!