%let ht = .6; %let C= .1; data macaroni; do i = 1 to 500; a = ranuni(123)*3.14159; id="Green"; Z = cos(A); X=0; Y=sin(A)-&ht; Z = Z + &c*normal(123); X=X+&C*normal(123); Y=Y+&C*normal(123); output; a = ranuni(123)*3.14159; id="Cyan"; X= cos(A); Z = 0; Y = -sin(A)+&ht; Z = Z + &c*normal(123); X=X+&C*normal(123); Y=Y+&C*normal(123); output; X=1; Y = -1; Z=2*(ranuni(123)-.5); id="red"; Z = Z + &c*normal(123); X=X+&C*normal(123); Y=Y+&C*normal(123); output; end; proc g3d; scatter X*Y=Z/color=id; proc modeclus method=1 k=60 out=outmac data=macaroni cascade=3; var x y z; proc g3d; scatter x*y=density/noneedle shape= "balloon" size= .5; proc print data=outmac; run; proc cluster method=single ccc outtree=tree data=macaroni noprint; var x y z; proc print data=tree(obs=10); run; proc tree data=tree height=ncl spaces=1 inc=1 out=outclus ncl=6; * where _ncl_<60; copy x y z; proc print data=outclus; run;