SAVE subcommand (COMPARE DATASETS command)

You can use the optional SAVE subcommand to create a new variable in the active dataset that identifies mismatches and create new datasets that contain only cases that match in both files or only cases that have differences.

FLAGMISMATCHES=YES|NO. Creates a new variable in the active dataset that indicates if the corresponding case in the other dataset contains any values that differ from the values for that case in the active dataset. The default is YES.

  • The value of the new variable is 1 if there are differences and 0 if all the values are the same. If there cases in the active dataset that are not present in the other dataset, the value is -1.
  • The default name of the new variable is CasesCompare. Use the optional VARNAME keyword to specify a different name. The name must conform to variable naming rules. See the topic Variable Names for more information.

MATCHDATASET=NO|YES. Creates a new dataset or external data file that contains only cases from the active dataset that have exact matches in the other dataset. The default is NO.

  • Use the MATCHNAME keyword to specify a dataset name or an external file. External file specifications must be enclosed in quotes. If it is a dataset in the current session, it must be an existing or previously declared dataset.
  • If a dataset or external file with the specified name already exists, it will be overwritten.
  • Use the MATCHPASS keyword if you are creating an external data file and you want to save it as an encrypted file. The specified value is the password that is required to open the file and it must be enclosed in quotation marks. Passwords are limited to 10 characters and are case-sensitive. The keyword NONE is the default and it specifies that the file is not encrypted.

MISMATCHDATASET=NO|YES. Creates a new dataset or external data file that contains only cases from the active dataset that do not have exact matches in the other dataset. The default is NO.

  • Use the MISMATCHNAME keyword to specify a dataset name or an external file. External file specifications must be enclosed in quotes. If it is a dataset in the current session, it must be an existing or previously declared dataset.
  • If a dataset or external file with the specified name already exists, it will be overwritten.
  • Use the MISMATCHPASS keyword if you are creating an external data file and you want to save it as an encrypted file. The specified value is the password that is required to open the file and it must be enclosed in quotation marks. Passwords are limited to 10 characters and are case-sensitive. The keyword NONE is the default and it specifies that the file is not encrypted.

ENCRYPTEDPW Keyword

The ENCRYPTEDPW keyword specifies whether the password is encrypted and applies to both the MATCHPASS and MISMATCHPASS keywords.

NO. The password is not encrypted. It is treated as plain text. This setting is the default.

YES. The password is encrypted. Use ENCRYPTEDPW=YES only when the password is known to be encrypted. For reference, passwords are always encrypted in syntax that is pasted from the Save Data As dialog.

Note:
  • Passwords cannot be recovered if they are lost. If the password is lost, then an encrypted file cannot be opened.
  • Encrypted files cannot be opened in versions of IBM® SPSS® Statistics prior to version 21.

Creating strong passwords

  • Use eight or more characters.
  • Include numbers, symbols and even punctuation in your password.
  • Avoid sequences of numbers or characters, such as "123" and "abc", and avoid repetition, such as "111aaa".
  • Do not create passwords that use personal information such as birthdays or nicknames.
  • Periodically change the password.

For information on declaring a new dataset before specifying it on the COMPARE DATASETS command, see DATASET DECLARE.

Example

/SAVE
  FLAGMISMATCHES=YES VARNAME=Mismatch
  MATCHDATASET=YES MATCHNAME=Matches
  MISMATCHDATASET=YES MISMATCHNAME='/myfiles/'mismatches.sav'.