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.

912 MATCH FILES<br />

• FIRST creates a variable with the value 1 for the first case of each group and the value 0<br />

for all other cases.<br />

• LAST creates a variable with the value 1 for the last case of each group and the value 0 for<br />

all other cases.<br />

• Variables created by FIRST and LAST are automatically attached to the end of the<br />

resulting file and cannot be dropped.<br />

• If one file has several cases with the same values for the key variables, FIRST or LAST can<br />

be used to create a variable that flags the first or last case of the group.<br />

Example<br />

MATCH FILES TABLE=HOUSE /FILE=PERSONS<br />

/BY=HOUSEID /FIRST=HEAD.<br />

• The variable HEAD contains the value 1 for the first person in each household and the<br />

value 0 for all other persons. Assuming that the PERSONS file is sorted with the head of<br />

household as the first case for each household, the variable HEAD identifies the case for<br />

the head of household.<br />

Example<br />

* Using match files with only one file.<br />

* This example flags the first of several cases with<br />

the same value for a key variable.<br />

MATCH FILES FILE=PERSONS /BY HOUSEID /FIRST=HEAD.<br />

SELECT IF (HEAD EQ 1).<br />

CROSSTABS JOBCAT BY SEX.<br />

• MATCH FILES is used instead of GET to read the SPSS-format data file PERSONS. The BY<br />

subcommand identifies the key variable (HOUSEID), and FIRST creates the variable HEAD<br />

with the value 1 for the first case in each household and the value 0 for all other cases.<br />

• SELECT IF selects only the cases with the value 1 for HEAD, and the CROSSTABS procedure<br />

is run on these cases.<br />

MAP Subcommand<br />

MAP produces a list of the variables that are in the new working file and the file or files from<br />

which they came. Variables are listed in the order in which they appear in the resulting file. MAP<br />

has no specifications and must be placed after all FILE, TABLE, and RENAME subcommands.<br />

• Multiple MAP subcommands can be used. Each MAP shows the current status of the<br />

working data file and reflects only the subcommands that precede the MAP subcommand.<br />

• To obtain a map of the resulting file in its final state, specify MAP last.<br />

• If a variable is renamed, its original and new names are listed. Variables created by IN,<br />

FIRST, and LAST are not included in the map, since they are automatically attached to the<br />

end of the file and cannot be dropped.

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

Saved successfully!

Ooh no, something went wrong!