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


Calculating a Weight Variable for the Number of Repeated Values of a Variable
Bruce Ratner, Ph.D.
Live chat by Boldchat
Live chat by Boldchat

weight


data
input;
input id $ X ;
cards;
a 12
b 34
c 34
d 56
e 56
f 56
g 78
h 78
i 78
j 78
;
proc print data=input;
title1 ' ';
title2 ' input dataset ';
run;

proc sort data=input; by X;
run;

data
temp ;
set input;
WEIGHT+1;
by X;
if first.X then WEIGHT=1 ;
if last.X then output;
run;

title2 ' output, desired with WEIGHT variable ';
data desired;
merge temp input;
by X;
proc print data=desired;
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.