Chapter Contents

Previous

Next
The PLOT Procedure

Example 7: Producing a Contour Plot


Procedure features:
PLOT statement option
CONTOUR=

This example shows how to represent the values of three variables with a two-dimensional plot by setting one of the variables as the CONTOUR variable. The variables X and Y appear on the axes, and Z is the contour variable. Program statements are used to generate the observations for the plot, and the following equation describes the contour surface:

[IMAGE]


Program

options nodate pageno=1 linesize=64 pagesize=25;
 Note about code
data contours;
   format Z 5.1;
   do X=0 to 400 by 5;
      do Y=0 to 350 by 10;
         z=46.2+.09*x-.0005*x**2+.1*y-.0005*y**2+.0004*x*y;
         output;
      end;
   end;
run;
 Note about code
proc print data=contours(obs=5) noobs;
   title 'CONTOURS Data Set';
   title2 'First 5 Observations Only';
run;
 Note about figure
                       CONTOURS Data Set                       1
                   First 5 Observations Only

                            Z    X     Y

                         46.2    0     0
                         47.2    0    10
                         48.0    0    20
                         48.8    0    30
                         49.4    0    40

 Note about code
options nodate pageno=1 linesize=120 pagesize=60 noovp;
 Note about code
proc plot data=contours;
plot y*x=z / contour=10;
    title 'A Contour Plot';
run;


Output
The shadings associated with the values of Z appear at the bottom of the plot. The plotting symbol # shows where high values of Z occur. [HTML Output]
 [Listing Output]


Chapter Contents

Previous

Next

Top of Page

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