Examples (UPDATE command)
Basic Example
UPDATE FILE='/data/mailist.sav'
/FILE='/data/newlist.sav'
/BY=ID.
- mailist.sav is specified as the primary file. newlist.sav is the transaction file. ID is the key variable.
- Both mailist.sav and newlist.sav must be sorted in ascending order of ID.
- If newlist.sav has cases or nonmissing variables that are not in mailist.sav, the new cases or variables are added to the resulting file.
Using Multiple Key Variables
SORT CASES BY LOCATN DEPT.
UPDATE FILE='/data/primary.sav' /FILE=* /BY LOCATN DEPT
/KEEP AVGHOUR AVGRAISE LOCATN DEPT SEX HOURLY RAISE /MAP.
SAVE OUTFILE='/data/personnel.sav'.
-
SORT CASESsorts the active dataset in ascending order of the variables to be named as key variables onUPDATE. -
UPDATEspecifies primary.sav as the primary file and the sorted active dataset as the transaction file. The file primary.sav must also be sorted by LOCATN and DEPT. -
BYspecifies the key variables LOCATN and DEPT. -
KEEPspecifies the subset and order of variables to be retained in the resulting file. -
MAPprovides a list of the variables in the resulting file and the two input files. -
SAVEsaves the resulting file as a data file in IBM® SPSS® Statistics format.