Data defines the model by dint of genetic programming, producing the best decile table.


SAS Code for Direction of Correlates of Varclus
Bruce Ratner, PhD


varclus13
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
direc13

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
options pageno=1;
ods exclude stdscorecoef ClusterStructure ;

data IN;
do id=1 to 120;
x1 = (rannor(2345)+100)*5000;
x2 = (rannor(2345)+5)*10;
x3 = (rannor(2345)+10)*500;
x4 = (rannor(234)+5)*10;
x5 = (rannor(2345)+1)*5;
x6 = (rannor(23)+5)*10;
x7 = (rannor(23)+1)*5;
x8 = (rannor(12345)+5)*10;
wt=1;
output;
end;
run;

PROC VARCLUS data= IN MAXC=4 simple outstat=Coef;
var x1-x8;
run;

/*** Seeking Directions of Correlates
of Clus1 of 3-Cluster Solution ***/

data Coef3;
set Coef;
if _ncl_ = . or _ncl_ = 3;
drop _ncl_;
run;

PROC SCORE data=IN score=Coef3 out=SCORED;
run;

data SCORED_CLASSIFIED;
set   SCORED;
temp=max(clus1, clus2, clus3);
        if clus1 = temp then predictd = clus1;
else if clus2 = temp then predictd = clus2;
else if clus3 = temp then predictd = clus3; 
run;

data SCORED_CLASSIFIED (drop=temp);
set   SCORED_CLASSIFIED;
temp=max(clus1, clus2, clus3);
        if clus1 = temp then segment = 'clus1';
else if clus2 = temp then segment = 'clus2';
else if clus3 = temp then segment = 'clus3';
run;

%let clusnum=1;
title ' Clus1 of 3-Cluster-Solution ';

proc
corr data=SCORED_CLASSIFIED rank outp=out noprint;
var
x3 x4 x8;
with Clus&clusnum ;
freq wt;
run;

data out1;
set out;
if _TYPE_='MEAN' then delete;
if _TYPE_='STD' then delete;
drop _NAME_;
run;

proc transpose data=out1
out=out2 (rename=(_1=n _2=corr_Clus&clusnum ) ) prefix=_;
run;

data out2;
set out2;
abs_corr=abs(corr_Clus&clusnum);
Correlate=_NAME_;
run;

proc sort data=out2;by descending abs_corr;

data out3;
set out2;
if n ge 0 and abs_corr ge .0;
rank=_n_;

proc sort data=out3;by descending abs_corr; run;

data direction&clusnum;
set out3;
proc print data=direction&clusnum noobs;
var Rank Correlate CORR_Clus&clusnum;
run;

For more information about this article, call Bruce Ratner at 516.791.3544 or 1 800 DM STAT-1; or e-mail at br@dmstat1.com.
Sign-up for a free GenIQ webcast: Click here.