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.

1392 REPEATING DATA<br />

Example<br />

Figure 1 Output cases built with REPEATING DATA<br />

SEQNUM NUMPERS NUMVEH MAKE MODEL NUMCYL<br />

1 2 2 FORD T 8<br />

1 2 2 PONTIAC C 6<br />

2 4 1 CHEVY C 4<br />

3 2 3 CADILAC C 8<br />

3 2 3 FORD T 6<br />

3 2 3 VW C 4<br />

NUMBER OF CASES READ = 6 NUMBER OF CASES LISTED = 6<br />

* Use REPEATING DATA with FILE TYPE MIXED: read only type 3 records.<br />

FILE TYPE MIXED RECORD=#SEQNUM 2-4.<br />

RECORD TYPE 003.<br />

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

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

END FILE.<br />

END FILE TYPE.<br />

BEGIN DATA<br />

1001 02 02 FORD T8PONTIAC C6<br />

1002 04 01 CHEVY C4<br />

1003 02 03 CADILAC C8FORD T6VW C4<br />

END DATA.<br />

LIST.<br />

• The task in this example is to read only the repeating data for records with value 003 for<br />

variable #SEQNUM.<br />

• REPEATING DATA is used within a FILE TYPE structure, which specifies a mixed file type.<br />

The record identification variable #SEQNUM is located in columns 2–4.<br />

• RECORD TYPE specifies that only records with value 003 for #SEQNUM are copied into<br />

the working data file. All other records are skipped.<br />

• REPEATING DATA indicates that the repeating groups start in column 12. The OCCURS<br />

subcommand indicates there are three repeating groups on each input case, and the DATA<br />

subcommand specifies names, locations, and formats for the variables in the repeating<br />

groups.<br />

• The DATA LIST command is not required in this example, since none of the information<br />

on the input case is being spread to the output cases. However, if there were multiple<br />

input cases with value 003 for #SEQNUM and they did not all have three repeating<br />

groups, DATA LIST would be required to define a variable whose value for each input<br />

case indicated the number of repeating groups for that case. This variable would then<br />

be specified on the OCCURS subcommand.

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

Saved successfully!

Ooh no, something went wrong!