OUTFILE Subcommand (KNN command)

The OUTFILE subcommand saves an XML-format file containing the nearest neighbor model. It also saves IBM® SPSS® Statistics-format data files containing distances from focal cases.

  • File names must be specified in full. KNN does not supply extensions.
  • The MODEL keyword is not honored if split-file processing is in effect (see the SPLIT FILE command). If this keyword is specified when split-file processing is on, then a warning is displayed.

MODEL = 'file'. Writes the nearest neighbor mdoel to an XML file. Specify a valid file name. If the 'file' specification refers to an existing file, then the file is overwritten. The model is written in PMML with extensions.

FOCALCASES = 'savfile' | ‘dataset'. Writes the distances from focal cases to IBM SPSS Statistics-format data files. Specify a valid file or dataset name. If the specification refers to an existing file or dataset, then the file or dataset is overwritten.

For each focal case, a separate variable is created for each of the focal case's k nearest neighbors (from the training set) and the corresponding k nearest distances. The variable names are KNN_FocalCase_CaseNumber, KNN_NearestNeighbor_CaseNumber_1 through KNN_NearestNeighbor_CaseNumber_k and KNN_NearestNeighbor_Distance_1 through KNN_NearestNeighbor_CaseNumber_k.