KCLUS Procedure

SCORE Statement

  • SCORE OUT=libref.data-table <option>;

  • OUTPUT OUT=libref.data-table <option>;

The SCORE statement writes the cluster membership information of each observation to the output data table that is specified in the OUT= option. This information includes the variables that are specified in the COPYVARS= option and additional variables, as described in the section Score Output for Clustering Both Interval and Nominal Variables.

You must specify the following option:

OUT=libref.data-table

names the output data table for PROC KCLUS to use. You must specify this option before any other options. libref.data-table is a two-level name, where

libref

refers to a collection of information that is defined in the LIBNAME statement and includes the library, which includes a path to where the data table is to be stored. For more information about libref, see the section Using SAS Viya Workbench.

data-table

specifies the name of the output data table.

The output data table contains the scored data. When you specify this option, all variables that are specified in the COPYVARS= option, followed by the _CLUSTER_ID_ variable and the _DISTANCE_ variable, are added to the output data table that is specified in this option.

You can also specify the following option:

COPYVAR=variable
COPYVARS=(variables)

lists one or more variables from the input data table that are transferred to the scored output data table, provided that the output data table produces one or more records per input observation. By default, the KCLUS procedure does not transfer any variables from the input data table to the output data table. The COPYVARS= option accepts numeric and character variables. You can also use COPYVARS=(_ALL_) option to include all the input variables.

Last updated: May 14, 2026