Previous Page | Next Page

The SGPLOT Procedure


Identifies the data set that contains the plot variables. The statement also gives you the option to specify a description, write template code to a file, control the uniformity of axes, and control automatic legends and automatic attributes.
Requirements: An input data set is required.


PROC SGPLOT <DATA= input-data-set>
< DESCRIPTION="text-string">
<TMPLOUT= "filename">



specifies whether plots are drawn with unique attributes in the graph. By default, the SGPLOT procedure automatically assigns unique attributes in many situations, depending on the types of plots that you specify. If the plots do not have unique attributes by default, then the CYCLEATTRS option assigns unique attributes to each plot in the graph. The NOCYCLEATTRS option prevents the procedure from assigning unique attributes.

For example, if you specify the CYCLEATTRS option and you create a graph with a SERIES statement and a SCATTER statement, then the two plots will have different colors.

If you specify the NOCYCLEATTRS option, then plots have the same attributes unless you specify appearance options such as the LINEATTRS= option.


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

DESCRIPTION= "text-string"

specifies a description for the output image. The description identifies the image in the following locations:

  • the Results window

  • the alternate text for the image in HTML output

  • the table of contents that is created by the CONTENTS option in an ODS statement

The default description is "The SGPLOT Procedure".

Note:   You can disable the alternate text in HTML output by specifying an empty string. That is, DESCRIPTION="" .  [cautionend]

Note:   The name of the output image is specified by the IMAGENAME= option in the ODS GRAPHICS statement.  [cautionend]

Alias: DES

disables automatic legends from being generated. By default, legends are created automatically for some plots, depending on their content. This option has no effect if you specify a KEYLEGEND statement.

TMPLOUT= "filename"

writes the Graph Template Language code for your graph to a file.

Writing your template code to a file can be useful for building larger Graph Template Language definitions.


specifies how to control axis scaling and marker attributes when you use a BY statement.

Specify one of the following values:


specifies that both the legend group values and the axis scaling are shared between all of the levels of the BY variable(s).


specifies that the legend group values are shared between all of the levels of the BY variable(s).


specifies that the axis scaling is shared between all of the levels of the BY variable(s).

By default, each level of the BY variable(s) can have different legend group values and different axis scaling.

Note:   This option has no effect if you do not use a BY statement.  [cautionend]

Previous Page | Next Page | Top of Page