2
votes

I have made a cluster anaysis in SAS using proc cluster.

How do I get SAS to print the number of chosen clusters? If I have chosen clusters = 7, I want to print the 7 clusters with the observations that lie in every cluster.

HOw do I do?

1

1 Answers

1
votes

Use the OUT= option on PROC CLUSTER to create a SAS data set and use PROC TREE to associate the source records into the number of clusters you want. Then you can sort the result and print by cluster:

proc tree data=Tree    /* Data set created by PROC CLUSTER */
          out=New      /* New data set to create */
          nclusters=7  /* Number of clusters you want */
          noprint;
   id idvar;           /* ID variable from PROC CLUSTER */
   copy a b c;         /* Other variables from input data */
run;

proc sort data=new;
   by cluster idvar;
run;

proc print data=new;
   by cluster;
   id cluster;
run;

See this example in the SAS documentation for much more info.