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.

Grouped Data<br />

Defining Complex Files 1707<br />

In a grouped file, a case has several records that are grouped together in the file. You can<br />

use DATA LIST to define a grouped file if each case has the same number of records and<br />

records appear in the same order for each case. You can use FILE TYPE GROUPED<br />

whether the number of records per case and record order are fixed or vary. However,<br />

FILE TYPE GROUPED requires that each record have a case identifier and a record code.<br />

Using DATA LIST<br />

Table C.1 shows the organization of a grouped data file containing school subject scores<br />

for three students. Each student has three data records, and each record contains a score.<br />

The first record for each student also contains a case identifier. Records for each case<br />

are grouped together. Student 1 records appear first, followed by records for student 2<br />

and student 3.<br />

Record order determines whether a score is a reading, math, or science score. The<br />

reading score appears on the first record for a case, the math score appears on the second<br />

record, and the science score appears on the third record.<br />

Table C.1 Data for GROUPED.DAT<br />

Student Score<br />

1 58<br />

59<br />

97<br />

2 43<br />

88<br />

45<br />

3 67<br />

75<br />

90<br />

Since each case has the same number of records and record order is fixed across cases,<br />

you can use DATA LIST to define the student data:<br />

DATA LIST FILE=’GROUPED.DAT’ RECORDS=3<br />

/STUDENT 1 READING 5-6<br />

/MATH 5-6<br />

/SCIENCE 5-6.<br />

LIST.<br />

• DATA LIST indicates that data are in file GROUPED.DAT.<br />

• RECORDS defines three records per case. The program reads student ID number<br />

(STUDENT) and reading score (READING) in the first record for a case. Math and<br />

science scores are read in the second and third records.

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

Saved successfully!

Ooh no, something went wrong!