These sample files and code examples are provided by SAS Institute Inc. "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose. Recipients acknowledge and agree that SAS Institute shall not be liable for any damages whatsoever arising out of their use of this material. In addition, SAS Institute will provide no support for the materials contained herein.
/* Create a format to group the prices into categories. */
proc format;
value price
1='< $30,000'
2='$30-$40,000'
3='$40-$50,000'
4='> $50,000';
run;
quit;
/* Define a style to assign the colors to be used. */
proc template;
define style styles.heatmap;
parent=styles.harvest;
style graphcolors from graphcolors /
'gcdata1'=CX679920
'gcdata2'=CXFDC861
'gcdata3'=CXDC531F
'gcdata4'=CX751C07;
end;
run;
/* Sort the data and subset to include specific car types. */
proc sort data=sashelp.cars (where=(make in
('Buick' 'Cadillac' 'Chevrolet' 'Chrysler' 'Dodge'
'GMC' 'Ford' 'Saturn' 'Pontiac' 'Hummer')))
out=cars_sorted;
by make type;
run;
/* Create a data set to contain the mean value of the
suggested retail price. */
proc means data=cars_sorted noprint;
by make type;
output out=cars_average mean=avgmsrp;
run;
/* Group the data by the car prices and apply
the format for the prices. */
data cars_final;
set cars_average;
format group price.;
label group='MSRP';
if avgmsrp le 30000 then group=1;
else if avgmsrp le 40000 then group=2;
else if avgmsrp ge 50000 then group=3;
else group=4;
run;
/* Sort the data. */
proc sort data=cars_final out=cars_heatmap;
by group;
run;
/* Specify the style to be the HEATMAP style
defined with PROC TEMPLATE. */
ods listing style=heatmap;
/* Specify the size, in pixels, for the output. */
ods graphics / reset width=600px height=400px;
title h=12pt "Manufacturer's Suggested Retail Prices";
/* Create the heat map. */
proc sgplot data=cars_heatmap;
scatter x=make y=type / group=group
markerattrs=(size=.18in symbol=squarefilled);
run;
These sample files and code examples are provided by SAS Institute Inc. "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose. Recipients acknowledge and agree that SAS Institute shall not be liable for any damages whatsoever arising out of their use of this material. In addition, SAS Institute will provide no support for the materials contained herein.
Type: | Sample |
Topic: | SAS Reference ==> Procedures ==> SGPLOT |
Date Modified: | 2008-03-20 10:20:32 |
Date Created: | 2008-03-17 14:13:44 |
Product Family | Product | Host | SAS Release | |
Starting | Ending | |||
SAS System | SAS/GRAPH | z/OS | 9.2 TS1M0 | |
Microsoft® Windows® for 64-Bit Itanium-based Systems | 9.2 TS1M0 | |||
Microsoft Windows Server 2003 Datacenter 64-bit Edition | 9.2 TS1M0 | |||
Microsoft Windows Server 2003 Enterprise 64-bit Edition | 9.2 TS1M0 | |||
Microsoft Windows XP 64-bit Edition | 9.2 TS1M0 | |||
Microsoft® Windows® for x64 | 9.2 TS1M0 | |||
Microsoft Windows 2000 Advanced Server | 9.2 TS1M0 | |||
Microsoft Windows 2000 Datacenter Server | 9.2 TS1M0 | |||
Microsoft Windows 2000 Server | 9.2 TS1M0 | |||
Microsoft Windows 2000 Professional | 9.2 TS1M0 | |||
Microsoft Windows Server 2003 Datacenter Edition | 9.2 TS1M0 | |||
Microsoft Windows Server 2003 Enterprise Edition | 9.2 TS1M0 | |||
Microsoft Windows Server 2003 Standard Edition | 9.2 TS1M0 | |||
Microsoft Windows XP Professional | 9.2 TS1M0 | |||
Windows Vista | 9.2 TS1M0 | |||
64-bit Enabled AIX | 9.2 TS1M0 | |||
64-bit Enabled HP-UX | 9.2 TS1M0 | |||
64-bit Enabled Solaris | 9.2 TS1M0 | |||
HP-UX IPF | 9.2 TS1M0 | |||
Linux | 9.2 TS1M0 | |||
Linux for x64 | 9.2 TS1M0 | |||
OpenVMS on HP Integrity | 9.2 TS1M0 | |||
Solaris for x64 | 9.2 TS1M0 |