%let gpath='C:\';
%let dpi=100;
ods html close;
ods listing style=htmlblue gpath=&gpath image_dpi=&dpi;
/*--2D Heat map Data--*/
data HeatmapParm2D;
drop pi;
format value 4.1;
pi=constant('Pi');
do x=1 to 100;
do y=1 to 60;
value=sin(x*pi/80+pi/3) + cos(y*pi/60+pi/8);
value=50*value + 40;
if value > 31 and value <33 then value=32;
y2=ceil(value/3);
size=10;
output;
end;
end;
run;
/*--Define format for temperature--*/
proc format;
value temp
32='Freezing';
run;
/*--Template with Heat Map Parm--*/
proc template;
define statgraph heatmap2D;
begingraph;
dynamic _attr _title _x _y;
entrytitle "Temperature Gradient (" {unicode '00b0'x} "F) with" _title;
entryfootnote halign=left 'Using Heat Map Parm';
rangeattrmap name='map';
range -100 -< -60 / rangecolormodel=(purple purple);
range -60 -< -32 / rangecolormodel=(purple blue);
range -32 -< 0 / rangecolormodel=(blue lightblue);
range 0 -< 32 / rangecolormodel=(lightblue cxf7f7f7);
range 32 - 32/ rangecolor=white;
range 32 -< 72 / rangecolormodel=(cxf7f7f7 gold);
range 72 -< 100 / rangecolormodel=(gold red);
range 100 -< 120 / rangecolormodel=(red darkred);
range 120 -< 160 / rangecolormodel=(darkred darkred);
endrangeattrmap;
rangeattrvar attrvar=attrvar var=value attrmap='map';
layout overlay / xaxisopts=(display=(ticks tickvalues))
yaxisopts=(display=(ticks tickvalues));
if (exists(_attr))
heatmapparm x=_x y=_y colorresponse=attrvar / name='a';
else
heatmapparm x=_x y=_y colorresponse=value / name='a';
endif;
continuouslegend 'a';
endlayout;
endgraph;
end;
run;
/*--Heat Map with Range Attr Map--*/
ods graphics / reset width=5in height=3in imagename='Heatmap2D_Map';
proc sgrender data=HeatmapParm2d template=heatmap2D;
/* format value temp.;*/
dynamic _x='x' _y='y' _attr='y' _title=' Range Attr Map';
run;
/*--Heat Map with default color model--*/
ods graphics / reset width=5in height=3in imagename='Heatmap2D_Default';
proc sgrender data=HeatmapParm2d template=heatmap2D;
dynamic _x='x' _y='y' _title=' Default Color Model';
run;
/*--Template using Bubble Plot--*/
proc template;
define statgraph Bubble_RangeAttrMap;
begingraph;
dynamic _attr _title _x _y _size;
entrytitle "Temperature Gradient (" {unicode '00b0'x} "F) with" _title;
entryfootnote halign=left 'Using Bubble Plot';
rangeattrmap name='map';
range -100 -< -60 / rangecolormodel=(purple purple);
range -60 -< -32 / rangecolormodel=(purple blue);
range -32 -< 0 / rangecolormodel=(blue lightblue);
range 0 -< 32 / rangecolormodel=(lightblue cxf7f7f7);
range 32 - 32/ rangecolor=white;
range 32 -< 72 / rangecolormodel=(cxf7f7f7 gold);
range 72 -< 100 / rangecolormodel=(gold red);
range 100 -< 120 / rangecolormodel=(red darkred);
range 120 -< 160 / rangecolormodel=(darkred darkred);
endrangeattrmap;
rangeattrvar attrvar=attrvar var=value attrmap='map';
layout overlay / xaxisopts=(display=(ticks tickvalues) offsetmin=0 offsetmax=0)
yaxisopts=(display=(ticks tickvalues) offsetmin=0 offsetmax=0);
if (exists(_attr))
bubbleplot x=_x y=_y size=_size / colorresponse=attrvar name='a'
bubbleradiusmin=4 bubbleradiusmax=4 display=(fill);
else
bubbleplot x=_x y=_y size=_size / colorresponse=value name='a'
bubbleradiusmin=4 bubbleradiusmax=4 display=(fill);
endif;
continuouslegend 'a';
endlayout;
endgraph;
end;
run;
/*--Bubble Plot with Range Attr Map--*/
ods graphics / reset width=5in height=3in imagename='Bubble2D_Map';
proc sgrender data=HeatmapParm2d template=Bubble_RangeAttrMap;
format value temp.;
dynamic _x='x' _y='y' _size='size' _attr='y' _title=' Range Attr Map';
run;
/*--Bubble Plot with default color model--*/
ods graphics / reset width=5in height=3in imagename='Bubble2D_Default';
proc sgrender data=HeatmapParm2d template=Bubble_RangeAttrMap;
dynamic _x='x' _y='y' _size='size' _title=' Default Color Model';
run;