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.

UPDATE 1625<br />

• BY specifies the key variables LOCATN and DEPT.<br />

• KEEP specifies the subset and order of variables to be retained in the resulting file.<br />

• MAP provides a list of the variables in the resulting file and the two input files.<br />

• SAVE saves the resulting file as an SPSS-format data file.<br />

FILE Subcommand<br />

FILE identifies each input file. At least two FILE subcommands are required on UPDATE: one<br />

specifies the master file and the other a transaction file. A separate FILE subcommand must<br />

be used to specify each transaction file.<br />

• The first FILE subcommand must specify the master file.<br />

• An asterisk on FILE refers to the working data file.<br />

• All files must be sorted in ascending order according to the variables specified on BY.<br />

• The master file cannot contain duplicate values for the key variables. However, transaction<br />

files can and often do contain cases with duplicate keys (see “Operations” on p.<br />

1623).<br />

Raw Data Files<br />

To update the master file with cases from a raw data file, use DATA LIST first to define the<br />

raw data file as the working data file. UPDATE can then use the working data file to update<br />

the master file.<br />

Example<br />

DATA LIST FILE=RAWDATA<br />

ID 1-3 NAME 5-17 (A) ADDRESS 19-28 (A) ZIP 30-34.<br />

SORT CASES BY ID.<br />

UPDATE FILE=MAILIST1 /RENAME=(STREET=ADDRESS) /FILE=* /BY=ID /MAP.<br />

SAVE OUTFILE=MAILIST2.<br />

• DATA LIST defines the variables in the raw data file RAWDATA, which will be used to<br />

update values in the master file.<br />

• SORT CASES sorts the working data file in ascending order of the key variable ID. Cases<br />

in the master file were previously sorted in this manner.<br />

• The first FILE subcommand on UPDATE refers to the master file, MAILIST1. The RENAME<br />

subcommand renames the variable STREET to ADDRESS in file MAILIST1.<br />

• The second FILE subcommand refers to the working data file defined on DATA LIST.<br />

• BY indicates that cases in MAILIST1 and the working data file are to be matched by the key<br />

variable ID.<br />

• MAP requests a map of the resulting file.<br />

• SAVE saves the resulting file as an SPSS-format data file named MAILIST2.

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

Saved successfully!

Ooh no, something went wrong!