%macro gen(mux, muy); do i =1 to 20; x=&mux+normal(123); y=&muy+normal(123);t+1; output; end; %mend gen; data cluster; clus="A"; %gen(0,0); clus="B"; %gen(0,5); clus="C";%gen(5,0); proc gplot data=cluster; symbol1 v="A" c=red i=none; symbol2 v="B" c=green i=none; symbol3 v="C" c=back i=none; plot x*y=clus; title "As Created"; run; proc cluster method=average ccc outtree=tree data=cluster; var x y; copy clus t; data tree; set tree; label = compress(clus)||compress(t); ** Use a string function to make unique labels that start with A B or C **; proc print data=tree(obs=10); title "Tree Dataset"; run; proc tree data=tree height=ncl out=tree1 ncl=3; copy x y clus; id label; run; proc print data=tree1(obs=20); title "Tree1 data"; proc gplot data=tree1; plot x*y=cluster; title "As diagnosed"; symbol1 v="1" c=red i=join; symbol2 v="2" c=green i=join; symbol3 v="3" c=back i=join; run; proc freq data=tree1; tables clus*cluster; goptions reset=all; quit;