Sample 35215: Heat Map with Discrete Axis
This sample uses the SGPLOT procedure to produce a heat map with a discrete axis.
This sample uses the SGPLOT procedure to produce a heat map with a discrete axis.
proc format;
value zval 1='Potential Problem'
2='Emerging Issue'
other=.;
run;
data wu;
format x date9.;
format z zl zval.;
keep x y z zl;
do i=1 to 12;
do j=0 to 12-i;
x=j * 15 + '01Jan2006'd;
y=i;
z=int(8 * abs(ranuni(0))) + 1;
*--Set values over 2 to 3, to get more white boxes--;
*--ZL var has values of only 1 & 2 for the legend--;
if z > 2 then do;
z=3;
zl=.;
end;
else zl=z;
output;
end;
end;
run;
proc sort data=wu out=wu2;
by z;
run;
proc template;
define Style HeatMapStyle;
parent = styles.harvest;
style GraphFonts from GraphFonts
"Fonts used in graph styles" /
'GraphTitleFont' = (", ",10pt,bold)
'GraphFootnoteFont' = (", ",8pt)
'GraphLabelFont' = (", ",8pt)
'GraphValueFont' = (", ",8pt)
'GraphDataFont' = (", ",8pt);
style GraphColors from graphcolors /
"gcdata1" = cxaf1515
"gcdata2" = cxeabb14
"gcdata3" = cxffffff
"gramp3cend" = cxaa081b
"gramp3cneutral" = cx000000
"gramp3cstart" = cx1ba808;
end;
run;
ods listing close;
ods html file='emerging.html' path='.' style=heatmapstyle;
ods graphics / reset width=600px height=400px imagename='Emerging' imagefmt=gif;
title 'Emerging Issues';
proc sgplot data=wu2 noautolegend nocycleattrs;
scatter x=x y=y / group=zl markerattrs=(symbol=squarefilled
size=8) name='s1' nomissinggroup;
scatter x=x y=y / group=z markerattrs=(symbol=squarefilled
size=20) name='s3' nomissinggroup;
scatter x=x y=y / markerattrs=(symbol=square size=20);
xaxis type=time label='Build Periods' offsetmin=.1 offsetmax=.1;
yaxis type=discrete label='Periods of Service';
keylegend 's1' / location=outside position=right across=1;
run;
ods html close;
ods listing;
This sample uses the SGPLOT procedure to produce a heat map with a discrete axis.
| Type: | Sample |
| Topic: | SAS Reference ==> Procedures ==> SGPLOT
|
| Date Modified: | 2009-03-20 15:16:53 |
| Date Created: | 2009-03-20 09:20:57 |
Operating System and Release Information
| SAS System | SAS/GRAPH | Microsoft Windows Server 2003 Standard Edition | 9.2 TS2M0 | |
| Microsoft Windows Server 2003 Enterprise Edition | 9.2 TS2M0 | |
| Microsoft Windows Server 2003 Datacenter Edition | 9.2 TS2M0 | |
| Microsoft Windows XP 64-bit Edition | 9.2 TS2M0 | |
| Microsoft Windows Server 2003 Enterprise 64-bit Edition | 9.2 TS2M0 | |
| Microsoft Windows Server 2003 Datacenter 64-bit Edition | 9.2 TS2M0 | |
| Microsoft® Windows® for x64 | 9.2 TS2M0 | |
| Microsoft® Windows® for 64-Bit Itanium-based Systems | 9.2 TS2M0 | |
| z/OS | 9.2 TS2M0 | |
| Microsoft Windows XP Professional | 9.2 TS2M0 | |
| Windows Vista | 9.2 TS2M0 | |
| 64-bit Enabled AIX | 9.2 TS2M0 | |
| 64-bit Enabled HP-UX | 9.2 TS2M0 | |
| 64-bit Enabled Solaris | 9.2 TS2M0 | |
| HP-UX IPF | 9.2 TS2M0 | |
| Linux | 9.2 TS2M0 | |
| Linux for x64 | 9.2 TS2M0 | |
| OpenVMS on HP Integrity | 9.2 TS2M0 | |
| Solaris for x64 | 9.2 TS2M0 | |