SAVE Subcommand (KNN command)

The SAVE subcommand writes optional temporary variables to the active dataset.

PREDVAL Keyword

This saves the predicted value for a scale dependent variable and the predicted category for a categorical dependent variable.

Specify a unique, valid variable name. The default variable name is KNN_PredictedValue.

If there is no dependent variabe, this keyword is ignored with a warning.

PREDPROB Keyword

If the dependent variable is categorical, then this keyword saves the predicted probabilities of the first n categories. The value of n is specified by the MAXCAT keyword.

  • Specify a unique, valid variable name. The default root name is KNN_Probability.
  • If there is no dependent variable, this keyword is ignored with a warning.
  • If the dependent variable is scale, this keyword is ignored with a warning.

PARTITION Keyword

This saves the value of the partition (training or holdout) to which the case was assigned.

  • Specify a valid variable name. The default variable name is KNN_Partition.
  • This keyword is ignored with a warning if you specify a variable on the PARTITION subcommand.

FOLD Keyword

This saves the value of the fold to which the case was assigned.

  • Specify a valid variable name. The default variable name name is KNN_Fold.
  • This keyword is ignored if /MODEL NEIGHBORS=FIXED or /MODEL FEATURES=AUTO.
  • This keyword is ignored with a warning if you specify a variable on the CROSSVALIDATION subcommand.

MAXCAT Keyword

The MAXCAT keyword specifies the number of categories for which predicted probabilities should be saved.

  • Specify a positive integer in parentheses. The default is 25.
  • This keyword is ignored if predicted probabilities are not saved.