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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

572 FILE TYPE—END FILE TYPE<br />

Example<br />

* A nested file of accident records.<br />

FILE TYPE NESTED RECORD=6 CASE=ACCID 1-4.<br />

RECORD TYPE 1.<br />

DATA LIST /ACC_ID 9-11 WEATHER 12-13 STATE 15-16 (A) DATE 18-24 (A).<br />

RECORD TYPE 2.<br />

DATA LIST /STYLE 11 MAKE 13 OLD 14 LICENSE 15-16(A) INSURNCE 18-21 (A).<br />

RECORD TYPE 3.<br />

DATA LIST /PSNGR_NO 11 AGE 13-14 SEX 16 (A) INJURY 18 SEAT 20-21 (A)<br />

COST 23-24.<br />

END FILE TYPE.<br />

BEGIN DATA<br />

0001 1 322 1 IL 3/13/88 /* Type 1: accident record<br />

0001 2 1 44MI 134M /* Type 2: vehicle record<br />

0001 3 1 34 M 1 FR 3 /* Type 3: person record<br />

0001 2 2 16IL 322F /* vehicle record<br />

0001 3 1 22 F 1 FR 11 /* person record<br />

0001 3 2 35 M 1 FR 5 /* person record<br />

0001 3 3 59 M 1 BK 7 /* person record<br />

0001 2 3 21IN 146M /* vehicle record<br />

0001 3<br />

END DATA.<br />

1 46 M 0 FR 0 /* person record<br />

• FILE TYPE specifies a nested file type. The record identifier, located in column 6, is not<br />

assigned a variable name, so the default scratch variable name ####RECD is used. The<br />

case identification variable ACCID is located in columns 1–4.<br />

• Because there are three record types, there are three RECORD TYPE commands. For each<br />

RECORD TYPE, there is a DATA LIST command to define variables on that record type. The<br />

order of the RECORD TYPE commands defines the hierarchical structure of the file.<br />

• END FILE TYPE signals the end of file definition.<br />

• The program builds a case for each lowest-level (type 3) record, representing each person<br />

in the file. There can be only one type 1 record for each type 2 record, and one type 2<br />

record for each type 3 record. Each vehicle can be in only one accident, and each person<br />

can be in only one vehicle. The variables from the type 1 and type 2 records are spread to<br />

their corresponding type 3 records.<br />

Types of Files<br />

The first specification on FILE TYPE is a file type keyword, which defines the structure of the<br />

data file. There are three file type keywords: MIXED, GROUPED, and NESTED. Only one of<br />

the three types can be specified on FILE TYPE.<br />

MIXED Mixed file type. MIXED specifies a file in which each record type named on a<br />

RECORD TYPE command defines a case. You do not need to define all types<br />

of records in the file. In fact, FILE TYPE MIXED is useful for reading only one<br />

type of record because the program can decide whether to execute the DATA<br />

LIST for a record by simply reading the variable that identifies the record type.

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

Saved successfully!

Ooh no, something went wrong!