Chapter Contents


The GPLOT Procedure

Example 10: Creating Plots with Drill-down for the Web

Procedure features:
PLOT statement options:
ODS features:
ODS HTML statement:
Other features:
BY statement
GOPTIONS statement
Sample library member: GR21N10

This example shows how to create a plot with simple drill-down functionality for the Web. If you display the plot in a Web browser, you can select any plot point or legend symbol to display a report on monthly temperatures for the selected city.

The example explains how to use the ODS HTML statement and the HTML procedure options to create the drill-down. It shows how to

For more information on drill-down graphs, see About Drill-down Graphs.

This program modifies the code from sample GR21N08, which shows how to generate separate plots for the formatted values of a classification variable. In this example, the code implements drill-down capability for the plot, enabling you to select any plot point or legend symbol to drill down to a report on the yearly temperatures for the corresponding city. Browser View of Drill-down Plot shows the drill-down plot as it is viewed in a Browser.

Browser View of Drill-down Plot


Browser View of Report on Raleigh Temperatures shows the report that appears when you select any plot point or legend symbol that corresponds to the data for Raleigh.

Browser View of Report on Raleigh Temperatures


 Note about code
filename odsout 'path-to-Web-server-space';
 Note about code
ods listing close;
 Note about code
goptions reset=global gunit=pct
         colors=(black red blue green)
         ftext=swiss ftitle=swissb htitle=6 htext=3
         device=gif transparency noborder;
 Note about code
data citytemp;
   input  Month Fahrenheit City $;
   1      40.5    Raleigh
   1      12.2    Minn
   1      52.1    Phoenix
   2      42.2    Raleigh
   2      16.5    Minn
   2      55.1    Phoenix
   3      49.2    Raleigh
   3      28.3    Minn
   3      59.7    Phoenix
   4      59.5    Raleigh
   4      45.1    Minn
   4      67.7    Phoenix
   5      67.4    Raleigh
   5      57.1    Minn
   5      76.3    Phoenix
   6      74.4    Raleigh
   6      66.9    Minn
   6      84.6    Phoenix
   7      77.5    Raleigh
   7      71.9    Minn
   7      91.2    Phoenix
   8      76.5    Raleigh
   8      70.2    Minn
   8      89.1    Phoenix
   9      70.6    Raleigh
   9      60.0    Minn
   9      83.8    Phoenix
  10      60.2    Raleigh
  10      50.0    Minn
  10      72.2    Phoenix
  11      50.0    Raleigh
  11      32.4    Minn
  11      59.8    Phoenix
  12      41.2    Raleigh
  12      18.6    Minn
  12      52.5    Phoenix
 Note about code
data newtemp;
   set citytemp;
   length citydrill $ 40;
   if city='Minn' then
   else if city='Phoenix' then
   else if city='Raleigh' then
 Note about code
title1 'Average Monthly Temperature';
footnote1 j=l h=3 ' Click a data point or legend symbol'
          j=r 'GR21N10 ';

symbol1 interpol=join
 Note about code
ods html path=odsout
 Note about code
proc gplot data=newtemp;
   plot fahrenheit*month=city / hminor=0
 Note about code
ods html path=odsout
 Note about code
proc sort data=newtemp;
   by city month;
 Note about code
goptions reset=footnote;
option nobyline;
 Note about code
title1 'Monthly Temperatures in #byval(city)';
proc report data=newtemp nowindows;
  by city;
  column city month fahrenheit;
  define city       / noprint group;
  define month      / display group;
  define Fahrenheit / display group;
 Note about code
ods html close;
ods listing;

Chapter Contents



Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.