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.

422 DATA LIST<br />

Example<br />

* Concatenate three raw data files.<br />

INPUT PROGRAM.<br />

NUMERIC #EOF1 TO #EOF3. /*These will be used as the END variables.<br />

DO IF #EOF1 & #EOF2 & #EOF3.<br />

+ END FILE.<br />

ELSE IF #EOF1 & #EOF2.<br />

+ DATA LIST FILE=THREE END=#EOF3 NOTABLE / NAME 1-20(A)<br />

AGE 25-26 SEX 29(A).<br />

+ DO IF NOT #EOF3.<br />

+ END CASE.<br />

+ END IF.<br />

ELSE IF #EOF1.<br />

+ DATA LIST FILE=TWO END=#EOF2 NOTABLE / NAME 1-20(A)<br />

AGE 21-22 SEX 24(A).<br />

+ DO IF NOT #EOF2.<br />

+ END CASE.<br />

+ END IF.<br />

ELSE.<br />

+ DATA LIST FILE=ONE END=#EOF1 NOTABLE /1 NAME 1-20(A)<br />

AGE 21-22 SEX 24 (A).<br />

+ DO IF NOT #EOF1.<br />

+ END CASE.<br />

+ END IF.<br />

END IF.<br />

END INPUT PROGRAM.<br />

REPORT FORMAT AUTOMATIC LIST /VARS=NAME AGE SEX.<br />

• The input program contains a DO IF—ELSE IF—END IF structure.<br />

• Scratch variables are used on each END subcommand so the value will not be reinitialized<br />

to the system-missing value after each case is built.<br />

• Three data files are read, two of which contain data in the same format. The third requires<br />

a slightly different format for the data items. All three DATA LIST commands are placed<br />

within the DO IF structure.<br />

• END CASE builds cases from each record of the three files. END FILE is used to trigger<br />

end-of-file processing once all data records have been read.<br />

• This application can also be handled by creating three separate SPSS-format data files<br />

and using ADD FILES to put them together. The advantage of using the input program is<br />

that additional files are not required to store the separate data files prior to performing<br />

ADD FILES.<br />

Variable Definition<br />

The variable definition portion of DATA LIST assigns names and formats to the variables in<br />

the data. Depending on the format of the file, you may also need to specify record and<br />

column location. The following sections describe variable names, location, and formats.

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

Saved successfully!

Ooh no, something went wrong!