data dat1;
infile cards dlm=',' dsd;
input rank_frequency
rank_recency
rank_value
count;
vip = .;
cards;
;
data dat2;
infile cards dlm=',' dsd;
input rank_frequency
rank_recency
rank_value
count;
vip = 1;
cards;
1,0,0,470
1,0,1,66
1,1,1,4616
1,1,2,18
1,2,1,50
1,2,2,5784
2,0,0,1468
2,0,1,274
2,1,1,26773
2,1,2,100
2,2,1,352
2,2,2,88290
;
run;
data alldat;
set dat1 dat2;
run;
proc summary data=alldat nway;
class rank_frequency rank_recency rank_value;
var count;
output out=allsum(drop=_type_ _freq_) sum=;
run;
proc sql;
select max(count) as max
,min(count) as min
from allsum
;
quit;
******
HLS numbers
Hue = 201 = 0C9 Hex
Light = variable
Saturation = 86 = 56 HEX
Need to scale the range of Light over the range of our counts
Max count = 110781
Max Light = 256 (actually 255, but it's 0-255)
110781/256 = 432.
****;
data allsum2;
set allsum;
* value of light variable... *;
decval = floor(count/433);
hexval = put(decval,hex2.);
colour = 'H0CF' !! hexval !! '56';
*colRGB = "%HLSTORGB(colour)";
run;
proc format;
value $colfmt
'' = ''
;
value rnkfmt
0 = 'Low'
1 = 'Medium'
2 = 'High'
;
value vipfmt
. = 'Regular'
1 = 'VIP'
;
run;
ods html file='C:\coltest.htm';
proc report data=allsum2 nowd;
columns count colour;
define count /order;
define colour /display style=[background=$colfmt.];
run;
ods html close;
goptions reset=all;
proc goptions;
run;
ods html path='c:\'
file='test.htm';
proc g3d data=allsum2;
scatter rank_recency*rank_frequency=rank_value /color=colour shape='balloon'
size=5 noneedle;
run;
quit;
ods html close;