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.

1396 REPEATING DATA<br />

• In the data, NUMVEH has the value 2 for the first case, 1 for the second, and 3 for the third.<br />

Thus, six cases are built from these records. If the value of NUMVEH is 0, no cases are<br />

built from that record.<br />

Example<br />

* Read only the first repeating group from each record.<br />

INPUT PROGRAM.<br />

DATA LIST FILE=VEHICLE / SEQNUM 2-4 NUMPERS 6-7 NUMVEH 9-10.<br />

REPEATING DATA STARTS=12 /OCCURS=1<br />

/DATA=MAKE 1-8 (A) MODEL 9 (A) NUMCYL 10.<br />

END INPUT PROGRAM.<br />

LIST.<br />

• Since OCCURS specifies that there is only one repeating group for each input case, only<br />

one output case is built from each input case regardless of the actual number of repeating<br />

groups.<br />

DATA Subcommand<br />

DATA specifies a name, location within each repeating segment, and format for each variable<br />

to be read from the repeating groups. DATA is required and must be the last subcommand on<br />

REPEATING DATA.<br />

• The specifications for DATA are the same as for the DATA LIST command.<br />

• The specified location of the variables on DATA is their location within each repeating<br />

group—not their location within the record.<br />

• Any input format available on the DATA LIST command can be specified on the DATA<br />

subcommand. Both FORTRAN-like and the column-style specifications can be used.<br />

Example<br />

INPUT PROGRAM.<br />

DATA LIST FILE=VEHICLE / SEQNUM 2-4 NUMPERS 6-7 NUMVEH 9-10.<br />

REPEATING DATA STARTS=12 /OCCURS=NUMVEH<br />

/DATA=MAKE 1-8 (A) MODEL 9 (A) NUMCYL 10.<br />

END INPUT PROGRAM.<br />

LIST.<br />

• Variable MAKE is a string variable read from positions 1 through 8 of each repeating<br />

group; MODEL is a single-character string variable read from position 9; and NUMCYL is<br />

a one-digit numeric variable read from position 10.<br />

• The DATA LIST command defines variables SEQNUM, NUMPERS, and NUMVEH. These<br />

variables are spread to each output case built from the repeating groups.<br />

FILE Subcommand<br />

REPEATING DATA always reads the file specified on its associated DATA LIST or FILE TYPE<br />

command. The FILE subcommand on REPEATING DATA explicitly specifies the name of the<br />

file.

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

Saved successfully!

Ooh no, something went wrong!