04-18-2012 08:00 AM
I have a data set with two variables,one is the ID,the other is the amount.Can proc cluster or porc fastclus deal only with the amount?
And what is the difference between quantile and cluster?
Maybe I am too careful,but I have to make it clear.
Thanks in advance!
04-18-2012 11:05 AM
Yes, you can do clustering on a single variable. Suppose you know that there are two groups in your data and want to separate them automatically, you could use clustering to do that. Run the following example:
/* Generate example data with 2 clusters in variable x */
do x = 1,2,3,4,5,12,13,14;
id = put(x,2.);
/* Form all clusters */
proc cluster data=test outtree=tree method=centroid noprint;
/* Isolate top 2 clusters */
proc tree data=tree out=clusters nclusters=2 noprint;
/* Get quantiles */
proc rank data=test fraction out=quantiles;
/* Assemble clusters and quantiles */
select Q.id, Q.x, Q.quantile label="Quantile", C.cluster
from clusters as C inner join quantiles as Q on C._NAME_=Q.id
order by cluster, x;
Observations are assigned to the proper cluster. The quantiles are just like rescaled ranks.