Sample 25248: Produce a graph with a Table of Contents listing in an HTML frame
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.
/***********************************************************/
/* This program uses ODS to generate a drill-down graph. */
/* Click on any state to view PROC GCHART output which */
/* corresponds to that state. */
/* Point your web browser to the frame.html file in order */
/* to view the output. */
/***********************************************************/
/* This is the only line you have to change to run the program. */
/* Specify a location in your file system. */
filename odsout 'path to web server';
/* Close the listing destination. */
ods listing close;
/* The GIF device driver is used to create graph entries that */
/* will then be used to create GIF files. */
goptions reset=all device=gif border ftext=centb;
/* Create the data set SALES. */
data sales;
input Name $ statenm $ Sales;
/* Set the length of the HTML variable.*/
length statelink $ 40;
/* Assign values to the HTML variable. */
if statenm='SC' then
statelink='HREF=SC.html';
else if statenm='VA' then
statelink='HREF=VA.html';
else if statenm='NC' then
statelink='HREF=NC.html';
else if statenm='WV' then
statelink='HREF=WV.html';
state=stfips(statenm);
datalines;
Troy NC 50
Chris NC 30
Marcia NC 20
Bill NC 10
Martin SC 15
Lynn SC 20
Sue SC 5
Irene SC 1
Roger Nc 25
Dawn NC 30
Peter VA 17
Lelia VA 12
Roger WV 12
Joe WV 25
;
/* Sort SALES by STATE. */
proc sort;
by state;
run;
/* Calculate the total sales for each state. */
proc means data=sales sum noprint;
by state;
id statelink;
var sales;
output out=links sum=sumsales;
run;
/* Specify pattern statements to be used with the GMAP procedure. */
pattern1 v=msolid c=red;
pattern2 v=msolid c=green;
pattern3 v=msolid c=blue;
/* Subset out selected states from the US map data set. */
data newmap;
set maps.us;
if state = stfips('NC') or
state = stfips('SC') or
state = stfips('VA') or
state = stfips('WV');
run;
/* PATH= specifies the destination for all HTML and GIF files. */
/* produced by this application. */
/* FILE= specifies the HTML file that contains the map output. */
/* The drill-down links are available from here. */
/* FRAME= specifies the HTML file that contains the frame file. */
/* CONTENTS= specifies the HTML file that contains the TOC file. */
ods html path=odsout
file='gmap.html'
frame='frame.html'
contents='contents.html';
/* Define a format for the variable SALES. */
proc format;
value salesfmt
low-29='under 30 thousand'
30 - 60 = 'between 30-60 thousand'
61-high = 'over 60 thousand';
run;
/* Create the map using the GMAP procedure. */
proc gmap data=links map=newmap;
id state;
choro sumsales/html=statelink coutline=black discrete legend=legend1;
legend1 label=('Total Sales');
title f=swiss 'GMAP Output';
format sumsales salesfmt.;
run;
quit;
/* Specify patterns for the 3d pie charts. */
pattern1 v=psolid c=red;
pattern2 v=psolid c=green;
pattern3 v=psolid c=blue;
pattern4 v=psolid c=yellow;
pattern5 v=psolid c=orange;
/* Create a drill-down graph for the SC Sales Division. */
ods html file='SC.html';
proc gchart data=sales;
where statenm ? 'SC';
title f=swiss 'Sales for SC';
pie3d name/sumvar=sales other=0 name='SC' description='3d pie chart for SC';
run;
quit;
/* Create a drill-down graph for the VA Sales Division. */
ods html file='VA.html';
proc gchart data=sales;
where statenm ? 'VA';
title f=swiss 'Sales for VA';
pie3d name/sumvar=sales other=0 name='VA' description='3d pie chart for VA';
run;
quit;
/* Create a drill-down graph for the NC Sales Division. */
ods html file='NC.html';
proc gchart data=sales;
where statenm ? 'NC';
title f=swiss 'Sales for NC';
pie3d name /sumvar=sales other=0 name='NC' description='3d pie chart for NC';
run;
quit;
/* Create a drill-down graph for the WV Sales Division. */
ods html file='WV.html';
proc gchart data=sales;
where statenm ? 'WV';
title f=swiss 'Sales for WV';
pie3d name /sumvar=sales other=0 name='WV' description='3d pie chart for WV';
run;
quit;
/* Close the HTML destination. */
ods html close;
/* Open the listing destination. */
ods listing;
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.
This code produces an HTML file with a Table of Contents (TOC).
Click here to see the frameset:
See the frameset
This sample produces a graph with a table of contents listing in an HTML frame using the GIF device driver.
Type: | Sample |
Topic: | Third Party ==> Output ==> Device Drivers ==> GIF, JPEG, PNG SAS Reference ==> ODS (Output Delivery System)
|
Date Modified: | 2005-09-01 03:03:09 |
Date Created: | 2005-03-04 13:19:38 |
Operating System and Release Information
SAS System | SAS/GRAPH | All | n/a | n/a |