The KCLUS Procedure

Example 9.2 Finding the Number of Clusters

This example uses the same data table that is loaded into your CAS session in Example 9.1.

You can find the number of clusters in the data table by specifying NOC=ABC in the PROC KCLUS statement as follows:

data mycas.iris;
   set sashelp.iris;
run;
proc kclus data=mycas.iris maxclusters=9 seed=1234
           NOC=ABC(B=10 minclusters=2 align=PCA criterion=FIRSTPEAK);
   input SepalLength SepalWidth PetalLength PetalWidth;
   ods output ABCStats=ABCStats1;
run;

PROC KCLUS generates several ODS tables, some of which are shown in Output 9.2.1 through Output 9.2.4.

Output 9.2.1 shows the parameters that are used in the aligned box criterion (ABC) method.

Output 9.2.1: Aligned Box Criterion Parameters

The KCLUS Procedure

ABC Parameters
Minimum
Cluster
Maximum
Cluster
Reference
Distribution
Count
Alignment
Method
2910PCA


Output 9.2.2 shows the statistics that are obtained for each candidate number of clusters.

Output 9.2.2: Aligned Box Criterion Statistics

ABC Statistics
Number of
Clusters
Logarithm of
Within-Cluster SSE
GapSimulation
Adjusted
Standard
Deviation
One
Standard
Error
Adjusted
Gap
InputReference
29.631310.32710.69570.03040.6654
38.97279.46460.49190.03860.4533
48.65499.04010.38520.03700.3482
58.51677.6998-0.81690.0738-0.8907
68.50237.3959-1.10640.0840-1.1904
78.25126.9015-1.34970.0635-1.4132
88.11938.12280.003500.0497-0.0462
98.07728.35750.28040.05080.2296


Output 9.2.3: Estimated Number of Clusters

Estimated Number of Clusters
CriterionNumber of
Clusters
FirstPeak2


Output 9.2.4: Cluster Summary Table for Each Cluster

Cluster Summary for Interval Variables
ClusterFrequencyDistance from Cluster Centroid
to Observation
SSEStandard
Deviation
Nearest
Cluster
Distance
to
Nearest
Cluster
Centroid
MinimumMaximumAverage
1972.216224.844810.034612379.611.2971239.2879
2531.131021.61975.84922855.27.3397139.2879


When you use the NOC= option, the KCLUS procedure first estimates the number of clusters, k, and then it displays the cluster analysis results for each of the k clusters as shown in Output 9.2.4.

Last updated: April 08, 2021