Examples (KNN command)

Basic specification with default settings

KNN DepVar BY A B C WITH X Y Z.
  • The KNN procedure treats DepVar as the dependent variable. Predictors A, B, and C are factors, and X, Y, and Z are covariates.
  • By default, covariates are normalized before training. Also, the active dataset is partitioned into training and holdout data samples, with 70% going to the training data and 30% to the holdout data sample.
  • The model uses Euclidean distance to select the three nearest neighbors.
  • User-missing values are excluded and default output is displayed.