Procedure Syntax


Requirements: At least one PLOT or BUBBLE statement is required. A PLOT2 or BUBBLE2 statement can be used in conjunction with a PLOT or BUBBLE statement.

Global statements: AXIS AXIS Statement on page 124, FOOTNOTE TITLE, FOOTNOTE, and NOTE Statements on page 210, GOPTIONS GOPTIONS Statement on page 146, LEGEND LEGEND Statement on page 151, PATTERN PATTERN Statement on page 169, SYMBOL SYMBOL Statement on page 183, TITLE TITLE, FOOTNOTE, and NOTE Statements on page 210

Reminder: The procedure can include BY, FORMAT, LABEL, WHERE, and NOTE statements.

Supports: RUN- group processing Output Delivery System (ODS)

PROC GPLOT <DATA= input-data-set >

  • <ANNOTATE= Annotate-data-set >

  • <GOUT=< libref. > output-catalog >

  • <IMAGEMAP= output-data-set >

  • <UNIFORM>;

BUBBLE plot-request(s) </ option(s) >;

  • BUBBLE2 plot-request(s) </ option(s) >;

PLOT plot-request(s) </ option(s) >;

  • PLOT2 plot-request(s) </ option(s) >;

PROC GPLOT Statement

Identifies the data set that contains the plot variables . Optionally specifies uniform axis scaling for all graphs as well as annotation and an output catalog.

Requirements: An input data set is required.

Syntax

PROC GPLOT <DATA= input-data-set >

  • <ANNOTATE= Annotate-data-set >

  • <GOUT=< libref. > output-catalog >

  • <IMAGEMAP= output-data-set >

  • <UNIFORM>;

Options

ANNOTATE= Annotate-data-set

ANNO= Annotate-data-set

  • specifies a data set to annotate all graphs that are produced by the GPLOT procedure. To annotate individual graphs, use ANNOTATE= in the action statement.

    See also: Chapter 24, Using Annotate Data Sets, on page 587

DATA = input-data-set

  • specifies the SAS data set that contains the variables to plot. By default, the procedure uses the most recently created SAS data set.

    See also: SAS Data Sets on page 29 and About the Input Data Set on page 1086.

GOUT=< libref .> output-catalog

  • specifies the SAS catalog in which to save the graphics output that is produced by the GPLOT procedure. If you omit the libref, SAS/GRAPH looks for the catalog in the temporary library called WORK and creates the catalog if it does not exist.

    See also: Storing Graphics Output in SAS Catalogs on page 53.

IMAGEMAP= output-data-set

  • creates a temporary SAS data set that is used to generate an image map in an HTML output file. The IMAGEMAP= option can be used only if the PLOT or PLOT2 statements are used, and the PLOT or PLOT2 statement must use the HTML= option or the HTML_LEGEND= option or both.

    If HTML= is used on the PLOT or PLOT2 statement, the plot points are defined as hot zones, unless AREA= is also used, in which case there are not plot points and the areas between plot lines are defined as hot zones. If HTML_LEGEND= is used, the legend symbols are defined as hot zones. Information for the links is stored in the variables referenced by the HTML= and/or HTML_LEGEND= options.

    The %IMAGEMAP macro generates the image map in the HTML output file. The macro takes two arguments, the name of the image map data set and the name or fileref of the HTML output file, as shown in the following example:

     %imagemap(imgmapds, myimgmap.html); 

UNIFORM

  • specifies that the same axis scaling is used for all graphs that are produced by the procedure. By default, the range of axis values for each axis is based on the minimum and maximum values in the data and, therefore, may vary from graph to graph and among BY groups. Using the UNIFORM option forces the value range for each axis to be the same for all graphs. Thus, if the procedure produces multiple graphs with both left and right vertical axes, the UNIFORM option scales all of the left axes the same and all of the right axes the same, based on the minimum and maximum data values.

    In addition, UNIFORM forces the assignment of SYMBOL statements for the category variable without regard to the BY-group variable, and, if a legend is generated, makes the legend the same across graphs.

    Not supported by: Java, ActiveX

BUBBLE Statement

Creates bubble plots in which a third variable is plotted against two variables represented by the horizontal and vertical axes; the value of the third variable controls the size of the bubble.

Requirements: At least one plot request is required.

Global statements: AXIS AXIS Statement on page 124, FOOTNOTE TITLE, FOOTNOTE, and NOTE Statements on page 210, TITLE TITLE, FOOTNOTE, and NOTE Statements on page 210

Description

The BUBBLE statement specifies one or more plot requests that name the horizontal and left vertical axis variables and the variable that controls the size of the bubbles .

This statement automatically

  • centers each circle at a data point that is determined by the values of the vertical and horizontal axes variables

  • scales the axes to include the maximum and minimum data values

  • labels each axis with the name of its variable or associated label

  • displays each major tick mark value

  • draws circles for values that are located within the axes.

You can use statement options to control axis scaling, draw reference lines, modify the appearance of axes, control the display of the bubbles, specify a backplane color or image, and specify annotation.

In addition, you can use global statements to modify axes (AXIS statement), and add text to the graph (TITLE, NOTE, and FOOTNOTE statements). You can also use the Annotate data set to enhance the plot.

Syntax

BUBBLE plot-request(s) </ option(s) >;

option(s) can be one or more options from any or all of the following categories:

  • bubble appearance options:

    • BCOLOR= bubble-color

    • BFONT= font

    • BLABEL

    • BSCALE=AREA RADIUS

    • BSIZE= multiplier

  • plot appearance options:

    • ANNOTATE= Annotate-data-set

    • CAXIS= axis-color

    • CFRAME= background-color

    • CTEXT= text-color

    • FRAME NOFRAME

    • GRID

    • HREVERSE

    • IFRAME= fileref external-file

    • IMAGESTYLE = TILE FIT

    • NOAXIS

  • horizontal axis options:

    • AUTOHREF

    • CAUTOHREF= reference-line-color

    • CHREF= reference-line-color ( reference-line-color ) reference-line-color-list

    • HAXIS= value-list AXIS<1 99>

    • HMINOR= number-of-minor- ticks

    • HREF= value-list

    • HZERO

    • LAUTOHREF= reference-line-type

    • LHREF= reference-line-type ( reference-line-type ) reference-line-type-list

  • vertical axis options:

    • AUTOVREF

    • CAUTOVREF= reference-line-color

    • CVREF= reference-line-color ( reference-line-color ) reference-line-color-list

    • LAUTOVREF= reference-line-type

    • LVREF= reference-line-type ( reference-line-type ) reference-line-type-list

    • VAXIS= value-list AXIS<1 99>

    • VMINOR= number-of-minor-ticks

    • VREF= value-list

    • VREVERSE

    • VZERO

  • catalog entry description options:

    • DESCRIPTION= entry-description

    • NAME= entry-name

Required Arguments

plot-request(s)

  • each specifies the variables to plot and produces a separate graph. All variables must be in the input data set. Multiple plot requests are separated with blanks. A plot request must have this form:

    y-variable * x-variable = bubble-size

    • plots the values of two variables and draws a circle (bubble) at each data point. The value of the third variable determines the size of the bubble.

      y-variable

      • variable plotted on the left vertical axis.

    • x-variable

      • variable plotted on the horizontal axis.

    • bubble-size

      • variable that dictates the size of the bubbles. Bubble-size must be numeric. If the value of bubble-size is positive, bubbles are drawn with a solid line; if it is negative, bubbles are drawn with a dashed line.

Note: If you specify the JAVA, JAVAMETA, or JAVAIMG device drivers, then either the x-variable or the y-variable must be numeric.

Options

Options in a BUBBLE statement affect all graphs that are produced by that statement. You can specify as many options as you want and list them in any order.

ANNOTATE= Annotate-data-set

ANNO= Annotate-data-set

  • specifies a data set to annotate plots that are produced by the BUBBLE statement.

    See also: Chapter 24, Using Annotate Data Sets, on page 587

AUTOHREF

  • draws reference lines at all major tick marks on the horizontal axis. To specify line types for these reference lines, use the LAUTOHREF= option. To specify colors for these reference lines, use the CAUTOHREF= option. To specify labels for these reference lines, use the HAXIS= option.

AUTOVREF

  • draws reference lines at all major tick marks on the vertical axis. To specify line types for these reference lines, use the LAUTOVREF= option. To specify colors for these reference lines, use the CAUTOVREF= option. To specify labels for these reference lines, use the VAXIS= option.

BCOLOR= bubble-color

  • specifies the color for the bubbles. If you omit the BCOLOR= option, the first color in the colors list is used for the bubble color.

    Featured in: Example 2 on page 1122 and Example 3 on page 1124.

BFONT= font

  • specifies the font to use for bubble labels. See Chapter 5, SAS/GRAPH Fonts, on page 75for details on how to specify font . If you omit the BFONT= option, a font specification is searched for in this order:

    1. the FTEXT= option in a GOPTIONS statement

    2. the default hardware font.

  • See also: The BLABEL option for information on the location and color of labels.

    Featured in: Example 2 on page 1122.

    Not supported by: Java, ActiveX

BLABEL

  • labels the bubbles with the values of the third variable. If the variable has a format, the formatted value is used. By default, bubbles are not labeled.

    The procedure normally places labels directly outside of the circle at 315 degrees rotation. If a label in this position does not fit in the axis area, other 45-degree placements (that is, 45, 135, and 225 degrees) are attempted. If the label cannot be placed at any of the positions (45, 135, 225, or 315 degrees) without being clipped, the label is omitted. However, labels may collide with other bubbles or previously placed labels.

    Labels display in the color specified by the CTEXT= option. If you omit CTEXT=, the default is the first color in the colors list.

    Featured in: Example 2 on page 1122.

BSCALE=AREA RADIUS

  • specifies whether the bubble-scaling proportion is based on the area of the circles or the radius measure. By default, BSCALE=AREA.

    The value that is assigned to the BSCALE= option affects how large the bubbles appear in relation to each other. For example, suppose the third variable value is twice as big for one bubble as it is for another. If BSCALE=AREA, the area of the larger bubble will be twice the area of the smaller bubble. If BSCALE=RADIUS, the radius of the larger bubble will be twice the radius of the smaller bubble and the larger bubble will have more than twice the area of the smaller bubble.

    Not supported by: Java, ActiveX

BSIZE= multiplier

  • specifies an overall scaling factor for the bubbles so that you can increase or decrease the size of all bubbles by this factor. By default, BSIZE=5. If you specify BSIZE=0, then the default size is used instead.

    In Web output, the Java applets and the ActiveX Control override the default value. To prevent this override, specify a value for the BSIZE= option, rather than relying on the default value.

    Featured in: Example 2 on page 1122 andExample 2 on page 1122.

    Not supported by: Java (partial), ActiveX (partial)

CAUTOHREF= reference-line-color

  • specifies colors for reference lines drawn at major tick marks on the horizontal axis, as specified by the AUTOHREF option. The default color is either the value of the CAXIS= option or the first color in the color list. To specify line types for these reference lines, use the LAUTOHREF= option. To specify labels for these reference lines, use the HAXIS= option.

CAUTOVREF= reference-line-color

  • specifies colors for reference lines drawn at major tick marks on the vertical axis, as specified by the AUTOVREF option. The default color is either the value of the CAXIS= option or the first color in the color list. To specify line types for these reference lines, use the LAUTOVREF= option. To specify labels for these reference lines, use the VAXIS= option.

CAXIS= axis-color

CA= axis-color

  • specifies the color for the axis line and all major and minor tick marks. By default, the procedure uses the first color in the colors list.

    If you use the CAXIS= option, it may be overridden by

    1. the COLOR= option in an AXIS definition, which in turn is overridden by

    2. the COLOR= suboption of the MAJOR= or MINOR= option in an AXIS definition.

  • Featured in: Example 2 on page 1122 and Example 3 on page 1124.

CFRAME= background-color

CFR= background-color

  • fills the axis area with the specified color. If the FRAME option is also in effect, the procedure determines the color of the frame according to the precedence list given for the FRAME option description. If the IFRAME= option is in effect, the specified image fills the axis area instead of the specified color.

CHREF= reference-line-color ( reference-line-color )

CH= reference-line-color ( reference-line-color )

  • specifies the color of reference lines drawn perpendicular to the horizontal axis. This option affects reference lines drawn with the AUTOHREF, HREF, and GRID options. Specifying a single color without parentheses applies that color to all reference lines. The CAUTOHREF= option overrides the CHREF= option for lines drawn with the AUTOHREF option. Specifying a single color in parentheses applies that color only to the first reference line drawn with the HREF= option. Specifying a color list applies colors sequentially to successive reference lines drawn with the HREF= option. The syntax of the color list is of the form ( color1 color2 colorN ) or ( color1 , color2 , colorN ). Default colors for reference lines are determined by the CAXIS= option or by the first color in the color list. To specify line types for these reference lines, use the LHREF= option. To specify labels for these reference lines, use the HAXIS= option.

CTEXT= text-color

C= text-color

  • specifies the color for all text on the axes, including tick mark values, axis labels, and bubble labels.

    If you omit the CTEXT= option, a color specification is searched for in this order:

    1. the CTEXT= option in a GOPTIONS statement

    2. the default, the first color in the colors list.

  • If you use the CTEXT= option, it overrides the color specification for the axis label and the tick mark values in the COLOR= option in an AXIS definition that is assigned to the axis.

    If you use CTEXT=, the color specification is overridden in this situation: if you also use the COLOR= suboption of a LABEL= or VALUE= option in an AXIS definition that is assigned to the axis, that suboption determines the color of the axis label or the color of the tick mark values, respectively.

CVREF= reference-line-color ( reference-line-color ) reference-line-color-list

CV= reference-line-color ( reference-line-color ) reference-line-color-list

  • specifies the color of reference lines drawn perpendicular to the vertical axis. This option affects reference lines drawn with the AUTOVREF, VREF, and GRID options. Specifying a single color without parentheses applies that color to all reference lines. The CAUTOVREF= option overrides the CVREF= option for lines drawn with the AUTOVREF option. Specifying a single color in parentheses applies that color only to the first reference line drawn with the VREF= option. Specifying a color list applies colors sequentially to successive reference lines drawn with the VREF= option. The syntax of the color list is of the form ( color1 color2 colorN ) or ( color1 , color2 , colorN ). Default colors for reference lines are determined by the CAXIS= option or by the first color in the color list. To specify line types for these reference lines, use the LVREF= option. To specify labels for these reference lines, use the VAXIS= option.

DESCRIPTION= entry-description

DES= entry-description

  • specifies the description of the catalog entry for the plot. The maximum length for entry-description is 256 characters . The description does not appear on the plot. By default, the procedure assigns a description of the form BUBBLE OF variable * variable = variable .

    The entry-description can include the #BYLINE, #BYVAL, and #BYVAR substitution options, which work as they do when used on TITLE, FOOTNOTE, and NOTE statements. For more information, refer to the description of the option on page 222, and the discussion of Substituting BY Line Values in a Text String on page 226. The 256-character limit applies before the substitution takes place for these options; thus, if in the SAS program the entry-description text exceeds 256 characters, it is truncated to 256 characters, and then the substitution is performed.

    The descriptive text is shown in the "description" portion of each of the following:

    • in the Results window

    • among the catalog-entry properties that you can view from the Explorer window

    • in the Table of Contents that is generated when you use CONTENTS= option on an ODS statement, assuming that the GPLOT output is generated while the contents page is open . See Linking to Output through a Table of Contents on page 495.

    • in the Description field of the PROC GREPLAY window

FRAME NOFRAME

FR NOFR

  • specifies whether a frame is drawn around the axis area. The default is FRAME; however, if the V6COMP option is in effect on the GOPTIONS statement, the default is NOFRAME. If you also use a BUBBLE2 or PLOT2 statement and your plotting statements have conflicting frame specifications, FRAME is used.

    For the frame color, a specification is searched for in this order:

    1. the CAXIS= option

    2. the COLOR= option in the AXIS definition assigned to the vertical axis

    3. the COLOR= option in the AXIS definition assigned to the horizontal axis

    4. the default, the first color in the colors list.

    To fill the axis area with a background color, use the CFRAME= option.

    To fill the axis area with a background image, use the IFRAME= option.

GRID

  • draws reference lines at all major tick marks on both axes. You get the same result when you use all of these options in a BUBBLE statement: AUTOHREF, AUTOVREF, FRAME, LVREF=34, and LHREF=34. The line type for GRID is 34.

    The line color is the color of the axis.

HAXIS= value-list AXIS<1 99>

  • specifies major tick mark values for the horizontal axis or assigns an axis definition. For a description of value-list , see the HAXIS= on page 1108 option for the PLOT statement. To assign labels to horizontal reference lines, specify an axis definition that contains the REFLABEL= option. Labels will be applied in sequence to all reference lines drawn with the AUTOHREF and HREF= options.

    If you assign an axis definition that does not currently exist, the option is ignored. By default, the procedure scales the axis and provides an appropriate number of tick marks.

    If data values fall outside of the range that is specified by the HAXIS= option, then by default the outlying data values are not used in interpolation calculations.

    For Web output that is generated with a Java or ActiveX device driver, certain options of the AXIS statement are not supported. For details, see AXIS Statement on page 124.

    See also: About the Input Data Set on page 1086 for more information on values out of range.

    Featured in: Example 2 on page 1122.

    Not supported by: Java (partial), ActiveX (partial)

HMINOR= number-of-minor-ticks

HM= number-of-minor-ticks

  • specifies the number of minor tick marks that are drawn between each major tick mark on the horizontal axis. Minor tick marks are not labeled. The HMINOR= option overrides the NUMBER= suboption of the MINOR= option in an AXIS definition. You must specify a positive number.

    Featured in: Example 2 on page 1122.

HREF= value-list

  • draws one or more reference lines perpendicular to the horizontal axis at points that are specified by value-list . For a description of value-list see the HAXIS= on page 1108 option for the PLOT statement. To specify colors for these reference lines, use the CHREF= option. To specify line types for these reference lines, use the LHREF= option. To specify labels for these reference lines, use the HAXIS= option.

HREVERSE

  • specifies that the order of the values on the horizontal axis be reversed . For Web output that is generated with a Java device driver, the horizontal axis data must be numeric.

    Not supported by: Java (partial)

HZERO

  • specifies that tick marks on the horizontal axis begin in the first position with a value of zero. The HZERO request is ignored if negative values are present for the horizontal variable or if the horizontal axis has been specified with the HAXIS= option.

IFRAME= fileref external-file

  • identifies the image file you wish to apply to the backplane of the plot. See also the IMAGESTYLE= option and Placing a Backplane Image on Graphs with Frames on page 115. The IFRAME= option is overridden by the NOIMAGEPRINT goption IMAGEPRINT on page 318.

    Not supported by: Java

IMAGESTYLE= TILE FIT

  • specifies whether to tile the image to fill the backplane or to stretch the image to fit the backplane. The TILE value is the default. See also the IFRAME= option.

LAUTOHREF= reference-line-type

  • specifies a line type for reference lines drawn at major tick marks on the horizontal axis, as specified by the AUTOHREF option. The reference-line-type value can be a whole number from 1 to 46. A value of 1 specifies a solid line; values 2 through 46 specify dashed lines. The default value 1 draws a solid line. To specify colors for these reference lines, use the CAUTOHREF= option. To specify labels for these reference lines, use the HAXIS= option.

LAUTOVREF= reference-line-type

  • specifies a line type for reference lines drawn at major tick marks on the vertical axis, as specified by the AUTOVREF option. The reference-line-type value can be a whole number from 1 to 46. A value of 1 specifies a solid line; values 2 through 46 specify dashed lines. The default value 1 draws a solid line. To specify colors for these reference lines, use the CAUTOVREF= option. To specify labels for these reference lines, use the VAXIS= option.

LHREF= reference-line-type ( reference-line-type ) reference-line-type-list

LH= reference-line-type ( reference-line-type ) reference-line-type-list

  • specifies line types for reference lines drawn perpendicular to the horizontal axis. The reference-line-type value can be a whole number from 1 to 46. A value of 1 specifies a solid line; values 2 through 46 specify dashed lines. This option affects reference lines drawn with the AUTOHREF, HREF, and GRID options. Specifying a single line type without parentheses applies that line type to all reference lines. The LAUTOHREF= option overrides the LHREF= option for lines drawn with the AUTOHREF option. Specifying a single line type in parentheses applies that line type only to the first line drawn with the HREF= option. Specifying a line-type list applies line types in sequence to successive reference lines drawn with the HREF= option. The syntax of the line type list is of the form ( type1 type2 typeN ). The default value 1 draws a solid line. To specify colors for these references lines, use the CHREF= option. To specify labels for these reference lines, use the HAXIS= option.

LVREF= reference-line-type ( reference-line-type ) reference-line-type-list

LV = reference-line-type ( reference-line-type ) reference-line-type-list

  • specifies line types for reference lines drawn perpendicular to the vertical axis. The reference-line-type value can be a whole number from 1 to 46. A value of 1 specifies a solid line; values 2 through 46 specify dashed lines. This option affects reference lines drawn with the AUTOVREF, VREF, and GRID options. Specifying a single line type without parentheses applies that line type to all reference lines. The LAUTOVREF= option overrides the LVREF= option for lines drawn with the AUTOVREF option. Specifying a single line type in parentheses applies that line type only to the first line drawn by the VREF= option. Specifying a line-type list applies line types in sequence to successive reference lines drawn with the VREF= option. The syntax of the line type list is of the form ( type1 type2 typeN ). The default value 1 draws a solid line. To specify colors for these references lines, use the CVREF= option. To specify labels for these reference lines, use the VAXIS= option.

NAME= entry-name

  • specifies the name of the catalog entry for the graph. The maximum length for entry-name is eight characters. The default name is GPLOT. If you specify DEVICE=ACTIXIMG or DEVICE=JAVAIMG, then the name that you specify will be used for the Java or ActiveX device driver image output even in the file exists. For all other devices, if the name duplicates an existing entry name, SAS/GRAPH adds a number to the duplicate name to create a unique entry, for example, GPLOT1.

NOAXIS

NOAXES

  • suppresses the axes, including axis lines, axis labels, all major and minor tick marks, and tick mark values.

VAXIS= value-list AXIS<1 99>

  • specifies the major tick mark values for the vertical axis or assigns an axis definition. For a description of the value-list , see the HAXIS= option on page 1108 of the PLOT statement. To assign labels to reference lines, specify an axis definition that contains the REFLABEL= option. Labels will be applied in sequence to all reference lines defined with the AUTOVREF and VREF= options.

    For Web output that is generated with a Java or ActiveX device driver, certain options of the AXIS statement are not supported. For details, see AXIS Statement on page 124.

    Featured in: Example 2 on page 1122 and Example 3 on page 1124.

    Not supported by: Java (partial), ActiveX (partial)

VMINOR= number-of-minor-ticks

VM= number-of-minor-ticks

  • specifies the number of minor tick marks that are drawn between each major tick mark on the vertical axis. Minor tick marks are not labeled. VMINOR= overrides the NUMBER= suboption of the MINOR= option in an AXIS definition. You must specify a positive number.

    Featured in: Example 2 on page 1122.

VREF= value-list

  • draws one or more reference lines perpendicular to the vertical axis at points that are specified by value-list . For a description of the value-list , see the HAXIS= option on page 1108 of the PLOT statement. To specify colors for reference lines, use the CVREF= option. To specify line types for these reference lines, use the LVREF= option. To specify labels for these reference lines, use the VAXIS= option.

VREVERSE

  • specifies that the order of the values on the vertical axis should be reversed.

VZERO

  • specifies that tick marks on the vertical axis begin in the first position with a zero. The VZERO request is ignored if the vertical variable either contains negative values or has been ordered with the VAXIS= option or the ORDER= option in an AXIS statement.

Controlling the Display of Bubbles

The BUBBLE statement draws circles only for values that are located within the axes. Observations with values that lie outside of the axis area are not plotted. If a bubble size value causes a bubble to overlap the axis, the bubble is clipped against the axis line. The bubbles for the highest axis value and lowest axis value may be clipped unless you modify the axes in either of the following ways:

  • by offsetting the first and last values

  • by adding values to the range that is represented by the axis.

Specify the range of values on an axis with the HAXIS= or VAXIS= option, or with AXIS definitions.

To add a right vertical axis, use a BUBBLE2 statement.

BUBBLE2 Statement

Creates a second vertical axis on the right side of a graph produced by an accompanying BUBBLE or PLOT statement. A second variable can be plotted against this axis.

Requirements: You cannot use the BUBBLE2 statement alone. You can use it only with a BUBBLE or PLOT statement. At least one plot request is required.

Global statements: AXIS AXIS Statement on page 124, FOOTNOTE TITLE, FOOTNOTE, and NOTE Statements on page 210, TITLE TITLE, FOOTNOTE, and NOTE Statements on page 210

Description

The BUBBLE2 statement specifies one or more plot requests that name the horizontal and right vertical axis variables and the variable that controls the size of the bubbles. This statement automatically

  • scales the axes to include the maximum and minimum data values

  • labels each axis with the name of its variable or an associated label

  • displays each major tick mark value

  • draws circles for values that are located within the axes.

You can use statement options to control right vertical axis scaling, draw reference lines on the right vertical axis, control the display of the bubbles, display a background color or image, and specify annotation.

In addition, you can use global statements to modify the axes (AXIS statement), and add text to the graph (TITLE, NOTE, and FOOTNOTE statements). You can also use the Annotate data set to enhance the plot.

Syntax

BUBBLE2 plot-request(s) </ option(s) >;

option(s) can be one or more options from any or all of the following categories:

  • bubble appearance options:

    • BCOLOR= bubble-color

    • BFONT= font

    • BLABEL

    • BSCALE=AREA RADIUS

    • BSIZE= multiplier

  • plot appearance options:

    • ANNOTATE= Annotate-data-set

    • CAXIS= axis-color

    • CFRAME= background-color

    • CTEXT= text-color

    • FRAME NOFRAME

    • GRID

    • NOAXIS NOAXES

  • vertical axis options:

    • AUTOVREF

    • CAUTOVREF= reference-line-color

    • CVREF= reference-line-color ( reference-line-color ) reference-line-color-list

    • LAUTOVREF= reference-line-type

    • LVREF= reference-line-type ( reference-line-type ) reference-line-type-list

    • VAXIS= value-list AXIS<1 99>

    • VMINOR= number-of-minor ticks

    • VREF= value-list

    • VREVERSE

    • VZERO

Required Arguments

plot-request(s)

  • each specifies the variables to plot and produces a separate graph. All variables must be in the input data set. Multiple plot requests are separated with blanks. A plot request must have this form:

    y-variable * x-variable = bubble-size

    • plots the values of two variables and draws a circle (bubble) at each data point. The value of the third variable determines the size of the bubble. All variables must be in the input data set.

      y-variable

      • variable plotted on the right vertical axis; typically it is different from y-variable in the accompanying BUBBLE or PLOT statement.

    • x-variable

      • variable plotted on the horizontal axis; it is the same as x-variable in the accompanying BUBBLE or PLOT statement.

    • bubble-size

      • variable that dictates the size of the bubbles. Bubble-size must be numeric. If the value of bubble-size is positive, bubbles are drawn with a solid line; if it is negative, bubbles are drawn with a dashed line.

Options

Options for the BUBBLE2 statement are identical to those for the BUBBLE statement except for these options, which are ignored if specified:

  • AUTOHREF

  • CAUTOHREF=

  • CHREF=

  • DESCRIPTION=

  • HAXIS=

  • HMINOR=

  • HREF=

  • HZERO=

  • IFRAME=

  • IMAGESTYLE =

  • LAUTOHREF=

  • LHREF=

  • NAME=

See BUBBLE Statement on page 1090 for complete descriptions of options used with the BUBBLE2 statement.

Coordinating BUBBLE and BUBBLE2 Plot Requests

The BUBBLE2 statement draws circles only for values that are located within the axes. Bubbles are not drawn for values that lie outside of the axis range. If a bubble size value causes a bubble to overlap the axis, the bubble is clipped against the axis line.

In the BUBBLE2 statement, either y-variable or bubble-size may differ from the variables in the BUBBLE statement. Here are some possible combinations of plot requests for BUBBLE and BUBBLE2 statement pairs and how they affect the plot:

  • The vertical axis variables Y and Y2 are different, but the bubble size variable, S, is the same in both:

     bubble y*x=s;     bubble2 y2*x=s; 

    These plot requests generate a plot in which both sets of bubbles have the same value (size) but different locations on the graph.

  • The vertical axis variables are the same, Y, but the bubble size variables, S and S2, are different:

     bubble y*x=s;     bubble2 y*x=s2; 

    The resulting plot has two identical vertical axes and two sets of concentric bubbles of different sizes.

  • Both the vertical axis variables, Y and Y2, and the bubble size variables, S and S2, are different:

     bubble y*x=s;     bubble2 y2*x=s2; 

These plot requests produce the equivalent of an overlay plot in which two different sets of bubbles plotted against different vertical axes are displayed on the same graph.

The plot requests on the BUBBLE and BUBBLE2 statements must be evenly matched, for example:

 bubble y*x=s b*a=c;     bubble2 y2*x=s b2*a=c2; 

These statements produce two graphs each with two vertical axes. The first pair of plot requests (Y*X=S and Y2*X=S) produce one graph in which the variable X is plotted on the horizontal axis, the variable Y is plotted on the left axis, and the variable Y2 is plotted on the right axis. In this pair, the value of S is the same for both requests. The second pair of plot requests (B*A=C and B2*A=C2) produce another graph in which the variable A is plotted on the horizontal axis, the variable B is plotted on the left axis, and the variable B2 is plotted on the right axis.

Any modifications to horizontal axes specifications must be identical for both statements; if they are different, the BUBBLE2 axis specification is ignored.

If the scale of values for the left and right vertical axes is the same and you want both axes to represent the same range of values, specify the range with a VAXIS= option in both the BUBBLE and BUBBLE2 statements.

PLOT Statement

Creates plots in which one variable is plotted on the horizontal axis and a second variable is plotted on the left vertical axis.

Requirements: At least one plot request is required.

Global statements: AXIS AXIS Statement on page 124, FOOTNOTE TITLE, FOOTNOTE, and NOTE Statements on page 210, LEGEND LEGEND Statement on page 151, PATTERN PATTERN Statement on page 169, SYMBOL SYMBOL Statement on page 183, TITLE TITLE, FOOTNOTE, and NOTE Statements on page 210

Supports: Drill-down functionality

Description

The PLOT statement specifies one or more plot requests that name the horizontal and left vertical axis variables, and optionally a third classification variable. This statement automatically

  • scales the axes to include the maximum and minimum data values

  • plots data points within the axes

  • labels each axis with the name of its variable and displays each major tick mark value.

You can use statement options to manipulate the axes, modify the appearance of your graph, and describe catalog entries. You can use SYMBOL definitions to modify plot symbols for the data points, join data points, draw regression lines, plot confidence limits, or specify other types of interpolations. For more information on the SYMBOL statement, see About SYMBOL Definitions on page 1114.

In addition, you can use global statements to modify the axes; add titles, footnotes, and notes to the plot; or modify the legend if one is generated by the plot. You can also use an Annotate data set to enhance the plot.

Syntax

PLOT plot-request(s) </ option(s) >;

option(s) can be one or more options from any or all of the following categories:

  • plot options:

    • AREAS= n

    • GRID

    • LEGEND LEGEND=LEGEND<1 99>

    • NOLEGEND

    • OVERLAY

    • REGEQN

    • SKIPMISS

  • appearance options:

    • ANNOTATE= Annotate-data-set

    • CAXIS= axis-color

    • CFRAME= background-color

    • COUTLINE= outline-color

    • CTEXT= text-color

    • FRAME NOFRAME

    • HREVERSE

    • IFRAME= fileref external-file

    • IMAGESTYLE = TILE FIT

    • NOAXIS NOAXES

  • horizontal axis options:

    • AUTOHREF

    • CAUTOHREF= reference-line-color

    • CHREF= reference-line-color ( reference-line-color ) reference-line-color-list

    • HAXIS= value-list AXIS<1 99>

    • HMINOR= number-of-minor-ticks

    • HREF= value-list

    • HZERO

    • LAUTOHREF= reference-line-type

    • LHREF= reference-line-type ( reference-line-type ) reference-line-type-list

  • vertical axis options:

    • AUTOVREF

    • CAUTOVREF= reference-line-color

    • CVREF= reference-line-color ( reference-line-color ) reference-line-color-list

    • LAUTOVREF= reference-line-type

    • LVREF= reference-line-type ( reference-line-type ) reference-line-type-list

    • VAXIS= value-list AXIS<1 99>

    • VMINOR= number-of-minor-ticks

    • VREF= value-list

    • VREVERSE

    • VZERO

  • catalog entry description options:

    • DESCRIPTION= entry-description

    • NAME= entry-name

  • ODS options:

    • HTML= variable

    • HTML_LEGEND= variable

Required Arguments

plot-request(s)

  • each specifies the variables to plot and produces a separate graph, unless you specify OVERLAY. All variables must be in the input data set. Multiple plot requests are separated with blanks. You can plot character or numeric variables. A plot request can be any of these:

    y-variable * x-variable <= n >

    • plots the values of two variables and, optionally, assigns a SYMBOL definition to the plot.

      y-variable

      • variable plotted on the left vertical axis.

    • x-variable

      • variable plotted on the horizontal axis.

    • n

      • number of the n th generated SYMBOL definition.

    • Note: The n th generated SYMBOL definition is not necessarily the same as the n th SYMBOL statement. Plot requests of the form y-variable * x-variable = n assign the SYMBOL definition that is designated by n to the plot that is produced by y-variable * x-variable . For more information, see About Plot Requests that Assign a SYMBOL Definition on page 1114.

  • ( y-variable(s) )*( x-variable(s) )

    • plots the values of two or more variables and produces a separate graph for each combination of Y and X variables. That is, each Y*X pair is plotted on a separate set of axes, unless you specify OVERLAY.

      y-variable(s)

      • variables plotted on the left vertical axes.

    • x-variable(s)

      • variables plotted on the horizontal axes.

    • If you use only one y-variable or only one x-variable , omit the parentheses for that variable, for example,

       plot (temp rain)*month; 

      This plot request produces two plots, one of TEMP and MONTH and one of RAIN and MONTH.

  • y-variable * x-variable = third-variable

    • plots the values of two variables against a third classification variable

      y-variable

      • variable plotted on the left vertical axis.

    • x-variable

      • variable plotted on the horizontal axis.

  • third-variable

    • classification variable against which y-variable and x-variable are plotted. Third-variable can be character or numeric, but numeric variables should contain discrete rather than continuous values, or should be formatted to provide discrete values.

  • A separate plot (set of data points) is produced for each unique value of third-variable ; all plots are drawn on the same set of axes, and a legend is automatically generated to show the plot symbol and color for each value of the classification variable.

    Note: If a BY statement is used to produce multiple plots, you can make the legend the same across graphs by specifying the UNIFORM option in the PROC GPLOT statement.

    The following plot request produces a graph with a plot line for each department and a legend that shows the plot symbol for each department:

     plot sales*weekday=dept; 

    For an example of a plot that specifies a third-variable , see Example 8 on page 1135.

You can use more than one type of plot request in a single PLOT statement (provided that you do not specify OVERLAY), for example

 plot temp*month rain*month=2; 

Options

Options in a PLOT statement affect all graphs that are produced by that statement. You can specify as many options as you want and list them in any order.

ANNOTATE= Annotate-data-set

ANNO= Annotate-data-set

  • specifies a data set to annotate plots that are produced by the PLOT statement.

    See also: Chapter 24, Using Annotate Data Sets, on page 587.

AREAS= n

  • fills all the areas below plot line n with a pattern. The value of n specifies which areas to fill:

    • AREAS=1 fills the first area.

    • AREAS=2 fills both the first and second areas, and so forth.

  • If you specify a value for AREAS= that is greater than the number of bounded areas in the plot, the area between the top plot line and the axis frame is filled.

    Before an area can be filled, the data points that border the area must be joined by a line. Use a SYMBOL statement with one of these interpolation methods to join the data points:

    INTERPOL=JOIN

    INTERPOL=STEP

    INTERPOL=R series

    INTERPOL=SPLINE SM L

  • See SYMBOL Statement on page 183 for details on interpolation methods.

    By default, the AREAS= option fills areas by rotating a solid pattern through the colors list, starting with the first color in the list. If it needs more patterns, it rotates hatch patterns, beginning with the M2N0 pattern. See PATTERN Statement on page 169 for more information on map/plot patterns. However, if the V6COMP graphics option is in effect, or if color is limited to a single color with the CPATTERN= or COLORS= graphic options, the solid pattern is skipped and the first default pattern is M2N0. If the COLORS= graphic option specifies a single color, use as many SYMBOL statements as you have areas to fill in the plot because the INTERPOL= setting does not automatically apply to multiple symbol definitions.

    Note: If your device's default colors list is in effect and the first color in the list is black, color rotation begins with the second color in the list (no solid black patterns), unless the V6COMP graphics option is in effect. See How Default Patterns and Outlines Are Generated on page 178 for more information.

    You can alter the default pattern behavior by specifying patterns and colors on PATTERN statements that specify map and plot patterns. A separate PATTERN definition is needed for each specified area.

    If you specify PATTERN statements, AREAS= uses the lowest numbered PATTERN statement first. If it runs out of patterns, it uses the default behavior for map and plot patterns. See PATTERN Statement on page 169 for details.

    Pattern definitions are assigned to the areas below the plot lines in the order the plots are drawn. The first area is that between the horizontal axis and the plot line that is drawn first. The second area is that above the first plot line and below the plot line that is drawn second, and so forth. If the line that is drawn second lies below the line that is drawn first, the second area is hidden when the first is filled. The plots with the lower line values must be drawn first to prevent one area fill from overlaying another. If the lines cross, only the part of an area that is above the previous line is visible.

    Therefore, if you produce multiple plots by submitting multiple plot requests and using the OVERLAY option, the plot requests must be ordered in the PLOT statement so that the plot request that produces the lowest line values is the first (leftmost) plot request, the plot request that produces the next lowest line values is the second plot request, and so on.

    If you produce multiple plots with a y-variable * x-variable = third-variable plot request, the lines are plotted in order of increasing third variable values. Therefore, the data must be recoded so that the lowest value of the third variable produces the lowest plot line, the next lowest value produces the next lowest plot line, and so on.

    AREAS= works only if all plot lines are generated by the same PLOT or PLOT2 statement.

    If you use the VALUE= option in the SYMBOL statement, some symbols may be hidden. If reference lines are also specified with AREAS=, they are drawn behind the pattern fill.

    Featured in: Example 7 on page 1134.

AUTOHREF

  • draws reference lines at all major tick marks on the horizontal axis. If the AREAS= option is also used, the filled areas cover the reference lines. To draw lines on top of the filled areas, use the ANNOTATE= option in either the PROC GPLOT statement or the PLOT statement. To specify line types for these reference lines, use the LAUTOHREF= option. To specify colors for these reference lines, use the CAUTOHREF= option. To specify labels for these reference lines, use the HAXIS= option.

AUTOVREF

  • draws reference lines at all of the major tick marks on the vertical axis. If you also use the AREAS= option, the filled areas cover the reference lines. To draw lines on top of the filled areas, use the ANNOTATE= option in either the PROC GPLOT statement or the PLOT statement. To specify line types for these reference lines, use the LAUTOVREF= option. To specify colors for these reference lines, use the CAUTOVREF= option. To specify labels for these reference lines, use the VAXIS= option.

CAUTOHREF= reference-line-color

  • specifies colors for reference lines drawn at major tick marks on the horizontal axis, as specified by the AUTOHREF option. The default color is either the value of the CAXIS= option or the first color in the color list. To specify line types for these reference lines, use the LAUTOHREF= option. To specify labels for these reference lines, use the HAXIS= option.

CAUTOVREF= reference-line-color

  • specifies colors for reference lines drawn at major tick marks on the vertical axis, as specified by the AUTOVREF option. The default color is either the value of the CAXIS= option or the first color in the color list. To specify line types for these reference lines, use the LAUTOVREF= option. To specify labels for these reference lines, use the VAXIS= option.

CAXIS= axis-color

CA= axis-color

  • specifies the color for the axis line and all major and minor tick marks. By default, the procedure uses the first color in the colors list.

    If you use the CAXIS= option, it may be overridden by

    1. the COLOR= option in an AXIS definition, which in turn is overridden by

    2. the COLOR= suboption of the MAJOR= or MINOR= option in an AXIS definition for major and minor tick marks.

  • Featured in: Example 5 on page 1129.

CFRAME= background-color

CFR= background-color

  • fills the axis area with the specified color. If the FRAME option is also in effect, the procedure determines the color of the frame according to the precedence list given later in the FRAME option description. If the IFRAME= option is in effect, an image will appear in the background instead of the color.

CHREF= reference-line-color ( reference-line-color ) reference-line-color-list

CH= reference-line-color ( reference-line-color ) reference-line-color-list

  • specifies the color of reference lines drawn perpendicular to the horizontal axis. This option affects reference lines drawn with the AUTOHREF, HREF, and GRID options. Specifying a single color without parentheses applies that color to all reference lines. The CAUTOHREF= option overrides the CHREF= option for reference lines drawn with the AUTOHREF option. Specifying a single color in parentheses applies that color only to the first reference line drawn with the HREF= option. Specifying a color list applies colors sequentially to successive reference lines drawn with the HREF= option. The syntax of the color list is of the form ( color1 color2 colorN ) or ( color1 , color2 , colorN ). The default color for reference lines is determined by the CAXIS= option or by the first color in the color list. To specify line types for these reference lines, use the LHREF= option. To specify labels for these reference lines, use the HAXIS= option.

COUTLINE= outline-color

  • specifies the color of the outline that is drawn around filled areas. The filled areas are generated when the SYMBOL statement or GOPTIONS statement specifies INTERPOL on page 191= map/plot-pattern . The default outline color is black for ActiveX devices. Otherwise, the default color is the first color in the colors list. The COUTLINE= option cannot be used with the PATTERN statement. The COUTLINE= option overrides the SYMBOL statement option CO=.

    Not supported by: Java

CTEXT= text-color

C= text-color

  • specifies the color for all text on the axes, including tick mark values and axis labels. If the PLOT request generates a legend, the CTEXT= option also colors the legend label and the value descriptions.

    If you omit the CTEXT= option, a color specification is searched for in this order:

    1. the CTEXT= option in a GOPTIONS statement

    2. the default, the first color in the colors list.

  • If you use the CTEXT= option, it overrides the color specification for the axis label and the tick mark values in the COLOR= option in an AXIS definition that is assigned to the axis.

    If you use the CTEXT= option, the color specification is overridden in one or more of these situations:

    • If you also use the COLOR= suboption of a LABEL= or VALUE= option in a AXIS definition that is assigned to the axis, that suboption determines the color of the axis label or the color of the tick mark values, respectively.

    • If you also use the COLOR= suboption of a LABEL= or VALUE= option in a LEGEND definition that is assigned to the legend, it determines the color of the legend label or the color of the legend value descriptions, respectively.

  • Featured in: Example 5 on page 1129

CVREF= reference-line-color ( reference-line-color ) reference-line-color-list

CV= reference-line-color ( reference-line-color ) reference-line-color-list

  • specifies the color of reference lines drawn perpendicular to the vertical axis. Specifying a single color without parentheses applies that color to reference lines drawn with the AUTOVREF and VREF= options. The CAUTOVREF= option overrides the CVREF= option for reference lines drawn with the AUTOVREF option. Specifying a single color in parentheses applies that color only to the first reference line drawn with the VREF= option. Specifying a color list applies colors sequentially to successive reference lines drawn with the VREF= option. The syntax of the color list is of the form ( color1 color2 colorN ) or ( color1 , color2 , colorN ). The default color for reference lines is determined by the CAXIS= option or by the first color in the color list. To specify line types for these reference lines, use the LVREF= option. To specify labels for these reference lines, use the VAXIS= option.

    For needle plots that are generated with a Java or ActiveX device driver, the value of the CVREF= option is not applied to the default reference line that is drawn at zero when the minimum value of the vertical axis is less than zero. The color of this line is the first color in the color list, which is black by default.

    Featured in: Example 5 on page 1129

    Not supported by: Java (partial), ActiveX (partial)

DESCRIPTION= entry-description

DES= entry-description

  • specifies the description of the catalog entry for the plot. The maximum length for entry-description is 256 characters. The description does not appear on the plot. By default, the procedure assigns a description of the form PLOT OF y-variable * x-variable , where y-variable and x-variable are the names of the plot variables.

    The entry-description can include the #BYLINE, #BYVAL, and #BYVAR substitution options, which work as they do when used on TITLE, FOOTNOTE, and NOTE statements. For more information refer to the description of the text-string on page 222 option and the section that discusses Substituting BY Line Values in a Text String on page 226. The 256-character limit applies before the substitution takes place for these options; thus, if in the SAS program the entry-description text exceeds 256 characters, it is truncated to 256 characters, and then the substitution is performed.

    The descriptive text is shown in the "description" portion of each of the following:

    • in the Results window

    • among the catalog-entry properties that you can view from the Explorer window

    • in the Table of Contents that is generated when you use the CONTENTS= option on an ODS statement. This assumes that the GPLOT output is generated while the contents page is open. See Linking to Output through a Table of Contents on page 495.

    • in the Description field of the PROC GREPLAY window

FRAME NOFRAME

FR NOFR

  • specifies whether a frame is drawn around the axis area. The default is FRAME; however, if the V6COMP option is in effect on the GOPTIONS statement, the default is NOFRAME. If you also use a BUBBLE2 or PLOT2 statement and your plotting statements have conflicting frame specifications, FRAME is used.

    For the frame color, a specification is searched for in this order:

    1. the CAXIS= option

    2. the COLOR= option in the AXIS definition assigned to the vertical axis

    3. the COLOR= option in the AXIS definition assigned to the horizontal axis

    4. the default, the first color in the colors list.

    To fill the axis area with a background color, use the CFRAME= option.

    To fill the axis area with a background image, use the IFRAME= option.

GRID

  • draws reference lines at all major tick marks on both axes. You get the same result when you use all of these options in a PLOT statement: AUTOHREF, AUTOVREF, FRAME, LVREF=34, and LHREF=34. The line type for GRID is 34. The line color is the color of the axis. When specified in a PLOT2 statement, the reference lines are drawn on the vertical axis on the right side of the plot.

HAXIS= value-list AXIS<1 99>

  • specifies major tick mark values for the horizontal axis or assigns an axis definition. By default, the procedure scales the axis and provides an appropriate number of tick marks. To assign labels to reference lines, use an axis definition that contains the REFLABEL= option. The labels will be applied in sequence to all reference lines defined with the AUTOHREF and HREF= options.

    The way you specify value-list depends on the type of variable:

    • For numeric variables , value-list is either an explicit list of values, or a starting and an ending value with an interval increment, or a combination of both forms:

      • n < n>

      • n TO n <BY increment >

      • n < n> TO n <BY increment > < n < n> >

      If a numeric variable has an associated format, the specified values must be the unformatted values.

    • For date-time values , value-list includes any SAS date, time, or datetime value described for the SAS functions INTCK and INTNX, shown here as SAS-value :

      • SAS-value i < SAS-value i >

      • SAS-value i TO SAS-value i <BY interval >

    • For character variables , value-list is a list of unique character values enclosed in quotation marks and separated by blanks:

      • value-1 < value-n >

    • If a character variable has an associated format, the specified values must be the formatted values.

  • For a complete description of value-list , see the ORDER= on page 130 option in the AXIS statement.

    If data values fall outside of the range that is specified by the HAXIS= option, then by default the outlying data values are not used in interpolation calculations. See About the Input Data Set on page 1086 for more information on values out of range.

    For Web output that is generated with a Java or ActiveX device driver, certain options of the AXIS statement are not supported. For details, see AXIS Statement on page 124.

    Featured in: Example 4 on page 1126,Example 5 on page 1129, and Example 9 on page 1138.

    Not supported by: Java (partial), ActiveX (partial)

HMINOR= number-of-minor-ticks

HM= number-of-minor-ticks

  • specifies the number of minor tick marks drawn between each major tick mark on the horizontal axis. Minor tick marks are not labeled. The HMINOR= option overrides the NUMBER= suboption of the MINOR= option in an AXIS definition. You must specify a positive number.

    Featured in: Example 4 on page 1126,Example 5 on page 1129, and Example 9 on page 1138.

HREF= value-list

  • draws one or more reference lines perpendicular to the horizontal axis at points specified by value-list . See the HAXIS= option for a description of value-list . If the AREAS= option is also used, the filled areas cover the reference lines. To draw lines on top of the filled areas, use the ANNOTATE= option on either the PROC GPLOT or the PLOT statement. To specify colors for these reference lines, use the CHREF= option. To specify line types for these reference lines, use the LHREF= option. To specify labels for these reference lines, use the HAXIS= option.

HREVERSE

  • specifies that the order of the values on the horizontal axis be reversed. For Web output that is generated with a Java device driver, the horizontal axis data must be numeric.

    Not supported by: Java (partial)

HTML= variable

  • identifies the variable in the input data set whose values create links in the HTML output file that is generated by ODS. These links are associated with the plot points, or if AREA= is used, with the areas between plot lines. The links point to the data or graph that you wish to display when the user drills down on the plot point or area. The maximum length for the value of this variable is 1024 characters.

    Note that the HTML= option is functional only when a single PLOT or PLOT2 statement appears in the PROC GPLOT procedure.

    Not supported by: Java (partial), ActiveX (partial)

HTML_LEGEND= variable

  • identifies the variable in the input data set whose values are used to create links in the HTML output file that is generated by ODS. When the HTML output file is displayed in a Web browser, clicking on an element in the legend displays the URL that was specified for that legend element, based on the value of the variable that is named as the value of the HTML_LEGEND option. The maximum length for the value of this variable is 1024 characters. To see an example that generates a drill-down graph using ODS, see Example 10 on page 1141.

    Not supported by: Java, ActiveX

HZERO

  • specifies that tick marks on the horizontal axis begin in the first position with a value of zero. The HZERO request is ignored if negative values are present for the horizontal variable or if the horizontal axis has been specified with the HAXIS= option.

IFRAME= fileref external-file

  • identifies the image file you wish to apply to the backplane frame of the plot. See also the IMAGESTYLE= option and Placing a Backplane Image on Graphs with Frames on page 115. The IFRAME= option is overridden by the NOIMAGEPRINT goption IMAGEPRINT on page 318.

    For Web output that is generated with the ACTIVEX or ACTXIMG device drivers,

    Not supported by: Java

IMAGESTYLE= TILE FIT

  • specifies whether to tile multiple instances of the image to fill the backplane frame (TILE) or to stretch a single instance of the image to fill the backplane frame (FIT). The TILE value is the default. See also the IFRAME= option.

    Not supported by: Java

LAUTOHREF= reference-line-type

  • specifies a line type for reference lines drawn at major tick marks on the horizontal axis, as specified by the AUTOHREF option. The reference-line-type value can be a whole number from 1 to 46. A value of 1 specifies a solid line; values 2 through 46 specify dashed lines. The default value 1 draws a solid line. To specify colors for these reference lines, use the CAUTOHREF= option. To specify labels for these reference lines, use the HAXIS= option.

LAUTOVREF= reference-line-type

  • specifies a line type for reference lines drawn at major tick marks on the vertical axis, as specified by the AUTOVREF option. The reference-line-type value can be a whole number from 1 to 46. A value of 1 specifies a solid line; values 2 through 46 specify dashed lines. The default value 1 draws a solid line. To specify colors for these reference lines, use the CAUTOVREF= option. To specify labels for these reference lines, use the VAXIS= option.

LEGEND LEGEND=LEGEND<1 99>

  • generates a legend or specifies the legend to use for the plot.

    • a PLOT statement that includes the OVERLAY option does not automatically generate a legend. In these plot types, use LEGEND to produce a default legend, or LEGEND=LEGEND n to assign a defined LEGEND statement to the plot. The default legend is centered below the axis frame and identifies which colors and plot symbols represent the y-variables that you specify for the plots.

    • a plot request of the form y-variable*x-variable=third-variable automatically generates a default legend that identifies which colors and plot symbols represent each value of the classification variable. In these plot types, override the default by using LEGEND=LEGEND n to assign a defined LEGEND statement to the plot.

  • If you use the SHAPE= option in a LEGEND statement, the value SYMBOL is valid. If you use the PLOT statement s AREAS= option, SHAPE=BAR is also valid.

    See also: LEGEND Statement on page 151.

    Featured in: Example 6 on page 1131.

LHREF= reference-line-type ( reference-line-type ) reference-line-type-list

LH= reference-line-type ( reference-line-type ) reference-line-type-list

  • specifies line types for reference lines drawn perpendicular to the horizontal axis. The reference-line-type value can be a whole number from 1 to 46. A value of 1 specifies a solid line; values 2 through 46 specify dashed lines. This option affects reference lines drawn with the AUTOHREF, HREF, and GRID options. Specifying a single line type without parentheses applies that line type to all reference lines. The LAUTOHREF= option overrides the LHREF= option for lines drawn with the AUTOHREF option. Specifying a single line type in parentheses applies that line type only to the first reference lines drawn with the HREF= option. Specifying a line-type list applies line types in sequence to successive reference lines drawn with the HREF= option. The syntax of the line type list is of the form ( type1 type2 typeN ). The default value 1 draws a solid line. To specify colors for these references lines, use the CHREF= option. To specify labels for these reference lines, use the HAXIS= option.

LVREF= reference-line-type ( reference-line-type ) reference-line-type-list

LV = reference-line-type ( reference-line-type ) reference-line-type-list

  • specifies line types for reference lines drawn perpendicular to the vertical axis. The reference-line-type value can be a whole number from 1 to 46. A value of 1 specifies a solid line; values 2 through 46 specify dashed lines. This option affects reference lines drawn with the AUTOVREF, VREF, and GRID options. Specifying a single line type without parentheses applies that line type to all reference lines. The LAUTOVREF= option overrides the LVREF= option for lines drawn with the AUTOVREF option. Specifying a single line type in parentheses applies that line type only to the first line drawn with the VREF= option. Specifying a line-type list applies line types in sequence to successive reference lines drawn with the VREF= option. The syntax of the line type list is of the form ( type1 type2 typeN ). The default value 1 draws a solid line. To specify colors for these references lines, use the CVREF= option. To specify labels for these reference lines, use the VAXIS= option.

    For needle plots that are generated with a Java or ActiveX device driver, the value of the LVREF= option is not applied to the default reference line that is drawn at zero when the minimum value of the vertical axis is less than zero. This line is solid (not dashed).

    Featured in: Example 5 on page 1129.

    Not supported by: Java (partial), ActiveX (partial)

NAME= entry-name

  • specifies the name of the catalog entry for the graph. The maximum length for entry-name is eight characters. The default name is GPLOT. If you specify DEVICE=ACTIXIMG or DEVICE=JAVAIMG, then the name that you specify will be used for the Java or ActiveX device driver image output even in the file exists. For all other devices, if the name duplicates an existing entry name, SAS/GRAPH adds a number to the duplicate name to create a unique entry, for example, GPLOT1.

NOAXIS

NOAXES

  • suppresses the axes, including axis lines, axis labels, all major and minor tick marks, and tick mark values.

NOLEGEND

  • suppresses the legend that is generated by a plot request of the type y-variable * x-variable = third-variable .

OVERLAY

  • places all the plots that are generated by the PLOT statement on one set of axes. The axes are scaled to include the minimum and maximum values of all of the variables, and the variable names or labels associated with the first pair of variables label the axes.

    The OVERLAY option produces a legend if you include the LEGEND or the LEGEND= n option in the PLOT statement.

    OVERLAY is not enabled with plot requests of the form y-variable * x-variable = third-variable . However, you can achieve an overlay effect by using a PLOT and PLOT2 statement.

    When generating output for the Web with the JAVA, JAVAMETA, or JAVAIMG device drivers, the OVERLAY option cannot be used in the PLOT statement in combination with the global statement SYMBOL. This applies only when the SYMBOL statement uses the INTERPOL= option, and when the INTERPOL= option has the values BOX, HILO, or STD. For Java output using the PLOT2 statement, INTERPOL=BOX HILO STD cannot be used in a SYMBOL statement, with or without the OVERLAY option.

    Featured in: Example 6 on page 1131 and Example 7 on page 1134.

    Not supported by: Java (partial)

REGEQN

  • displays the regression equation that is specified in the INTERPOL= option of the SYMBOL statement in the lower left hand corner of the plot. You cannot modify the format that is used for the equation.

    The GPLOT regression equation is computed from the screen coordinates of the markers. Therefore, a graph might not display if the chart area for the plot becomes so small that markers cannot be drawn because there are no coordinates from which to build the regression equation. In such cases, the regression equation is no longer meaningful.

    Featured in: Example 4 on page 1126.

    Not supported by: Java, ActiveX

SKIPMISS

  • breaks a plot line or an area fill at occurrences of missing values of the Y variable. By default, plot lines and area fills are not broken at missing values. SKIPMISS is available only with JOIN interpolation. If SKIPMISS is used, observations should be sorted by the independent (horizontal axis) variable. If the plot request is y-variable * x-variable = third-variable , observations should also be sorted by the values of the third variable.

    See also: About the Input Data Set on page 1086.

VAXIS= value-list AXIS<1 99>

  • specifies the major tick mark values for the vertical axis or assigns an axis definition. See the HAXIS= option for a description of the value-list . To assign labels to reference lines, use an axis definition that contains the REFLABEL= option. The labels will be applied in sequence to all reference lines defined with the AUTOVREF and VREF= options.

    For Web output that is generated with a Java or ActiveX device driver, certain options of the AXIS statement are not supported. For details, see AXIS Statement on page 124.

    Featured in: Example 4 on page 1126 and Example 5 on page 1129.

    Not supported by: Java (partial), ActiveX (partial)

VMINOR= number-of-minor-ticks

VM= number-of-minor-ticks

  • specifies the number of minor tick marks that are drawn between each major tick mark on the vertical axis. Minor tick marks are not labeled. The VMINOR= option overrides the NUMBER= suboption of the MINOR= option in an AXIS definition. You must specify a positive number.

    Featured in: Example 5 on page 1129.

VREF= value-list

  • draws one or more reference lines perpendicular to the vertical axis at points that are specified by the value-list . See the HAXIS= option for a description of the value-list . If the AREAS= option is also used, the filled areas cover the reference lines. To draw lines on top of the filled areas, use the ANNOTATE= option in either the PROC GPLOT statement or the PLOT statement. To specify colors for these reference lines, use the CVREF= option. To specify line types for these reference lines, use the LVREF= option. To specify labels for these reference lines, use the VAXIS= option.

    Featured in: Example 5 on page 1129.

VREVERSE

  • specifies that the order of the values on the vertical axis be reversed.

VZERO

  • specifies that tick marks on the vertical axis begin in the first position with a zero. The VZERO request is ignored if the vertical variable either contains negative values or has been ordered with the VAXIS= option or the ORDER= option in an AXIS statement.

Plot Requests with Multiple Variables

Plot requests with multiple variables produce a separate plot for every Y*X pair, unless you specify OVERLAY. For example, this statement produces four plots (the actual plots are produced on separate pages). See Figure 37.7 on page 1113

 plot (y b)*(x a); 
click to expand
Figure 37.7: Graphs Generated by Multiple Plot Requests

About SYMBOL Definitions

SYMBOL statements control the appearance of plot symbols and lines, and define interpolation methods. They can specify

  • the shape, size, and color of the plot symbols that mark the data points

  • plot line style, color, and width

  • an interpolation method for plotting data

  • how missing values are treated in interpolation calculations.

SYMBOL definitions are assigned either by default by the GPLOT procedure or explicitly with a plot request.

If no SYMBOL definition is currently in effect, the GPLOT procedure produces a scatter plot of the data points using the default plot symbol, the plus sign (+). If you need more than one SYMBOL definition, the procedure rotates through the current colors list to produce symbols of different colors. If the current colors list contains only one color, or if all the colors are used, additional plot symbols are used.

If SYMBOL definitions have been defined but not explicitly assigned by a plot request of the form y-variable * x-variable = n , the procedure assigns them in the order in which they are generated. For example, this statement creates three plots:

 plot y*x b*a s*r; 

The procedure assigns the first generated SYMBOL definition to Y*X, the second generated SYMBOL definition to B*A, and the third to S*R.

If more SYMBOL definitions are needed than have been defined, the procedure uses the default definitions for the plots that remain .

See SYMBOL Statement on page 183.

About Plot Requests that Assign a SYMBOL Definition

Plot requests of the form y-variable * x-variable = n are useful when you use the OVERLAY option to produce multiple plots on one graph and you want to assign a particular SYMBOL definition to each plot.

With plot requests of this type it is important to remember that a single SYMBOL statement can generate multiple SYMBOL definitions, so that the SYMBOL definition that is designated by n may not be the same as the SYMBOL statement of the same number. That is, the third SYMBOL definition is not necessarily the same as the SYMBOL3 statement. See SYMBOL Statement on page 183 for more information on the SYMBOL statement.

PLOT2 Statement

Produces one or more plots with the vertical axis on the right side of the graph against which a second variable can be plotted.

Requirements: You cannot use the PLOT2 statement alone. It can be used only with a PLOT or BUBBLE statement. At least one plot request is required.

Global statements: AXIS AXIS Statement on page 124, FOOTNOTE TITLE, FOOTNOTE, and NOTE Statements on page 210, LEGEND LEGEND Statement on page 151, PATTERN PATTERN Statement on page 169, SYMBOL SYMBOL Statement on page 183, TITLE TITLE, FOOTNOTE, and NOTE Statements on page 210

Description

The PLOT2 statement specifies one or more plot requests that name the horizontal and right vertical axis variables. This statement automatically

  • plots data points within the axes

  • scales the axes to include the maximum and minimum data values

  • labels each axis with the name of its variable and displays each major tick mark value.

You can use statement options to manipulate the axes and modify the appearance of your graph. You can use SYMBOL definitions to modify plot symbols for the data points, join data points, draw regression lines, plot confidence limits, or specify other types of interpolation. For more information on the SYMBOL statement see About SYMBOL Definitions on page 1114.

Note: When using PLOT2 to generate output with the JAVA or ACTIVEX device drivers, and when the global statement SYMBOL is used, the value of the SYMBOL statement option INTERPOL= cannot be BOX, STD, or HILO.

In addition, you can use global statements to modify the axes; add titles, footnotes, and notes to the plot; or modify the legend if one is generated by the plot. You can also use an Annotate data set to enhance the plot.

Syntax

PLOT2 plot-request(s) </ option(s) >;

option(s) can be one or more options from any or all of the following categories:

  • plot options:

    • AREAS= n

    • GRID

    • LEGEND LEGEND=LEGEND<1 99>

    • NOLEGEND

    • OVERLAY

    • REGEQN

    • SKIPMISS

  • appearance options:

    • ANNOTATE= Annotate-data-set

    • CAXIS= axis-color

    • CFRAME= background-color

    • COUTLINE= outline-color

    • CTEXT= text-color

    • FRAME NOFRAME

    • NOAXIS NOAXES

  • vertical axis options:

    • AUTOVREF

    • CAUTOVREF= reference-line-color

    • CVREF= reference-line-color ( reference-line-color ) reference-line-color-list

    • HREVERSE

    • LAUTOVREF= reference-line-type

    • LVREF= reference-line-type ( reference-line-type ) reference-line-type-list

    • VAXIS= value-list AXIS<1 99>

    • VMINOR= n

    • VREF= value-list

    • VREVERSE

    • VZERO

  • ODS options:

    • HTML= variable

    • HTML_LEGEND= variable

Required Arguments

plot-request(s)

  • each specifies the variables to plot and produces a separate graph, unless you specify OVERLAY. All variables must be in the input data set. Multiple plot requests are separated with blanks. A plot request can be any of these:

    y-variable * x-variable <= n >

    • plots the values of two variables and, optionally, assigns a SYMBOL definition to the plot.

      y-variable

      • variable plotted on the right vertical axis.

    • x-variable

      • variable plotted on the horizontal axis.

    • n

      • number of the n th generated SYMBOL definition.

  • ( y-variable(s) )*( x-variable(s) )

    • plots the values of two or more variable and produces a separate graph for each combination of Y and X variables.

      y-variable(s)

      • variables plotted on the right vertical axes.

    • x-variable(s)

      • variables plotted on the horizontal axes.

  • y-variable * x-variable = third-variable

    • plots the values of two variables against a third classification variable

      y-variable

      • variable plotted on the right vertical axis.

    • x-variable

      • variable plotted on the horizontal axis.

    • third-variable

      • classification variable against which y-variable and x-variable are plotted. Third-variable can be character or numeric, but numeric variables should contain discrete rather than continuous values, or should be formatted to provide discrete values.

    • For more information about plot requests, see PLOT Statement on page 1101.

  • In a PLOT2 plot request, the X variable for the horizontal axis must be the same as in the accompanying PLOT or BUBBLE statement. Typically, the Y variable for the right vertical axis is different.

Use the same types of plot requests with a PLOT2 statement that you use with a PLOT statement, but a PLOT2 statement always plots the values of y-variable on the right vertical axis.

Options

Options for the PLOT2 statement are identical to those for the PLOT statement except for these options, which are ignored if you specify them:

  • AUTOHREF

  • CAUTOHREF=

  • CHREF=

  • DESCRIPTION=

  • HAXIS=

  • HMINOR=

  • HREF=

  • HZERO=

  • IFRAME=

  • IMAGESTYLE =

  • LAUTOHREF=

  • LHREF=

  • NAME=

See PLOT Statement on page 1101 for descriptions of options that you can use with the PLOT2 statement.

Matching Plot Requests

The plot requests in both the PLOT and PLOT2 statements must be evenly matched as in this example:

 plot  y*x b*a;      plot2 y2*x b2*a; 

These statements produce two graphs, each with two vertical axes. The first pair of plot requests (Y*X and Y2*X) produce one graph in which X is plotted on the horizontal axis, Y is plotted on the left axis, and Y2 is plotted on the right axis. The second pair of plot requests (B*A and B2*A) produce another graph in which A is plotted on the horizontal axis, B is plotted on the left axis, and B2 is plotted on the right axis.

Using Multiple Plot Requests

Plot requests of the form ( y-variable(s) )*( x-variable(s)) . Both the PLOT and PLOT2 statements generate multiple graphs (the actual plots are produced on separate pages). See Figure 37.8 on page 1118

 plot (y b)*(x a);      plot2 (y2 b2)*(x a); 
click to expand
Figure 37.8: Diagram of Graphs Produced by Multiple Plot Requests in PLOT and PLOT2 Statements

Requesting Plots of Three Variables with a Legend

When both the PLOT and PLOT2 statements use plot requests of the form y-variable * x-variable = third-variable , each statement generates a separate legend. If the third variable has two values, these statements produce one graph with four sets of data points. See Figure 37.9 on page 1119. The figure assumes SYMBOL statements are used to specify the plot symbols that are shown and to connect the data points with straight lines.

click to expand
Figure 37.9: Diagram of Multiple Plots on One Graph
 plot y*x=z;      plot2 y2*x=z; 

Using a Second Vertical Axis

Displaying the Same Values in a Different Scale

If your data contain the same variable values in two different scales, such as height in inches and height in centimeters, you can display one scale of values on the left axis and the other scale of values on the right axis. If both vertical axes are calibrated so that they represent the same range of values, then for each observation of X the data points for Y and Y2 are the same.

For example, if Y is height in inches and Y2 is height in centimeters and if the Y axis values range from 0 to 84 inches and the Y2 axis values range from 0 to 213.36 centimeters, the plot will be like the diagram shown in Figure 37.10 on page 1119.

click to expand
Figure 37.10: Right Axis with Different Scale of Values

For plots such as these, the PLOT2 statement should use a SYMBOL statement that specifies INTERPOL=NONE and VALUE=NONE.

Displaying Different Values

If your data contain variables with different data values (such as height and weight), you can display one type of data on the left axis and another type of data on the right axis. Because the Y variable and the Y2 variable contain different data, two sets of data points are displayed on the graph. For example, if Y is height and Y2 is weight, the plot will be like the diagram in Figure 37.11 on page 1120.

click to expand
Figure 37.11: Right Axis with Different Values and Different Scale

Displaying the Same Scale on Both Axes

If your data contain two sets of values for the same type of data, you can use the PLOT2 statement to generate a right axis that is calibrated the same as the left axis so that the data points on the right of the graph are easier to read. For example, if Y is high temperatures and Y2 is low temperatures , you can create a graph like the diagram in Figure 37.12 on page 1120.

click to expand
Figure 37.12: Right Axis with Same Scale of Values

To scale both axes the same, specify the same range of values either with the VAXIS= option in both the PLOT and PLOT2 statements, or with AXIS statements.

Using PATTERN and SYMBOL Definitions

The PLOT2 statement uses PATTERN and SYMBOL definitions in the same way the PLOT statement does. These definitions are assigned in order first to the PLOT statement and then to the PLOT2 statement.

For more information, see About SYMBOL Definitions on page 1114.




SAS.GRAPH 9.1 Reference, Volumes I and II
SAS.GRAPH 9.1 Reference, Volumes I and II
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 342

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net