Date: Mon, 4 Nov 2002 14:44:08 -0500
Reply-To: "Bhardwaj,Vatsal" <vb@EE.DUKE.EDU>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Bhardwaj,Vatsal" <vb@EE.DUKE.EDU>
Organization: Duke University, Durham, NC, USA
Subject: Help with CLUSTERING procedures
Content-Type: TEXT/PLAIN; charset=US-ASCII
Hi Guys,
I am new to SAS and have just written my 2nd program. :-). I need some
help with clustering. I have a large Data set on which i am using FASTCLUS
to cluster data in to various states. The result files are very exhautive,
but unforutnately i have not been able to find what i need.
Is there anyway i can find out for every observation in my data to which
cluster that particular observation belongs to? . (After i have done the
clustering).
I have include my SAS program below. I tried lookign around the SAS Doc
but could not find anything helpful. Would appreciate any pointers on
this.
My measure of intereast here is to set up a n*n matrix( i have 'n' cluster states) for no. of
times transition occurs between any two clusters.
Thanks in Advance for your help and time.
Best Regards,
Vatsal
libname datalib 'D:\SAS\Datalib\';
* put pointer to input file name here;
filename in1 ('D:\Data\Data Files-2\Jul0902.txt') lrecl=2500;
filename out 'D:\SAS\Output\temp_oct301.txt';
* output graphics file in PS format ;
filename outfile 'D:\SAS\Output\cluster.ps';
goptions device=pscolor gsfname=outfile gsfmode=append;
options ls=90;
data datalib.tmpjul9; retain time 0;
infile in1 delimiter=','; input col1-col342;
time=col1; hrs=time/60/24;
time=time/60;
time=time/60;
time=time/24;
keep time;
file out; retain count 0;
options linesize=256;
*One Time Only;
if mod(_n_,10)=0;
put col1-col342;
proc standard mean=0 std=1 out=stan;
var col3 col9 col11 col12;
run;
proc fastclus data=stan out=clust maxclusters=5;
var col3 col9 col11 col12;
run;
proc candisc data=clust out=Can noprint;
class Cluster;
var col3 col9 col11 col12 ;
legend1 frame cframe=ligr label=none cborder=black
position=center value=(justify=center);
axis1 label=(angle=90 rotate=0) minor=none;
axis2 minor=none;
proc gplot data=Can;
plot Can2*Can1=Cluster/frame cframe=ligr
legend=legend1 vaxis=axis1 haxis=axis2;
run;
quit;
--
"Work like you don't need money, Love like you have never been hurt ,
And Dance like no one is watching. "
Contact
-------
Office : 919-401-0299 -Ext 312
Home : 919-382-1950