IMSTAT Procedure (Analytics)

Example 5: Performing a Cluster Analysis

Details

You can perform a clustering analysis for all variables in an in-memory table by simply issuing a CLUSTER statement. However, specifying the variables to analyze and options can be specified to provide more a meaningful analysis.
The following SAS statements load the famous Iris flower data of R.A. Fisher to memory, and then perform k-means clustering on four of the variables.

Program

libname example sasiola host="grid001.example.com" port=10010 tag='hps';

data example.iris; 
    set sashelp.iris;
run;

proc imstat data=example.iris;
   cluster SepalLength SepalWidth PetalLength PetalWidth / 1
       maxiter=50
       numclus=3
       nsamp  =2
       conv   =1.e-06
       init   =rand
       freq   =Species; 2
quit;

Program Description

  1. The four variables to analyze are specified in the CLUSTER statement.
  2. Species is specified as the frequency variable and is used to cluster the four variables.

Output

CLUSTER Statement Results for the Iris Data Set
CLUSTER statement results for the Iris data set