Update the active data file from a secondary or transaction file
STATS UPDATE
UPDATESOURCE = "sav file" or "update dataset name"*
IDVARS = id variable name(s)*
SOURCEIND = name for variable to record case source
MAP = NO** or YES
/HELP
* Required
** Default
STATS UPDATE /HELP. prints this information and does nothing else.
STATS UPDATE UPDATESOURCE="c:/data/updates.sav"
IDVARS=id SOURCEIND=FROM MAP=YES.
This procedure copies data from the update dataset or file to the active file, replacing existing values of matching cases in the active file except that missing or blank values are not copied. The variable types of the updating and updated variables must agree. Cases in the two files are matched according to a set of one or more id variables.
This procedure differs from Merge Files Add Cases or Add Variables in that the update file values replace the active file variables. This is particularly useful when the update file holds a set of transactions. Variables not already present in the active file are added to it. Further details are provided in the Command Syntax Reference under the UPDATE command.
UPDATESOURCE specifies the quoted name of a sav file or dataset containing the values to update.
SOURCEIND specifies a name for a new variable that will indicate the source of each case in the updated active file. Its value is 1 for the active file and 0 for the update file.
MAP specifies whether to produce a list of the variables in the new active dataset and the file from which they came or not. Variables are listed in the order in which they appear in the resulting file.
Using the UPDATE command instead of this procedure, you can specify which variables in the update file are copied; you can rename variables, and you can have more than one update file. The purpose of STATS UPDATE and its dialog box is just to make it easier to use the UPDATE command, which does not itself have a dialog box interface.© Jon K Peck, 2023