SGPLOT Procedure

PROC SGPLOT Statement

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.
Requirement: An input data set is required.

Syntax

PROC SGPLOT <DATA= input-data-set>
<CYCLEATTRS | NOCYCLEATTRS>
< DATTRMAP= "attribute-map-data-set " >
< DESCRIPTION=“text-string” >
<NOAUTOLEGEND>
< PAD= dimension <units> | (pad-options)>
< SGANNO= "annotation-data-set " >
<TMPLOUT= “filename”>
<UNIFORM= GROUP | SCALE | ALL | XSCALE | YSCALE | XSCALEGROUP | YSCALEGROUP>;

Summary of Optional Arguments

specifies whether plots are drawn with unique attributes in the graph.
specifies the SAS data set that contains the variables to process.
specifies the SG attribute map data set that you want to use with the SGSCATTER procedure.
specifies a description for the output image.
disables automatic legends from being generated.
specifies the amount of extra space that is reserved inside the border of an annotated graph.
specifies the SG annotation data set that you want to use.
writes the Graph Template Language code for your graph to a file.
specifies how to control axis scaling and marker attributes when you use a BY statement.

Optional Arguments

CYCLEATTRS | NOCYCLEATTRS
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.
DATA=input-data-set
specifies the SAS data set that contains the variables to process. By default, the procedure uses the most recently created SAS data set.
DATTRMAP= attribute-map-data-set
specifies the SG attribute map data set that you want to use with the SGSCATTER procedure. You specify this option only if you are using an attribute map to control visual attributes of the graph. For more information, see Using SG Attribute Maps to Control Visual Attributes.
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”.
Alias:DES
Notes:The name of the output image is specified by the IMAGENAME= option in the ODS GRAPHICS statement.

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

NOAUTOLEGEND
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.
PAD= dimension<units> | (pad-options)
specifies the amount of extra space that is reserved inside the border of an annotated graph.
You specify this option only if you are using the SG annotation feature to annotate your graph. For more information, see Annotating ODS Graphics.
This option creates margins around the graph for company logos, annotated notes, and so on. You can also specify the unit of measurement. The default unit is pixels. For a list of measurement units that are supported, see Units of Measurement.
Use pad options to create non-uniform padding. Edges that are not assigned padding are padded with the default amount.
pad-options can be one or more of the following:
LEFT= dimension<units>
specifies the amount of extra space to add to the left edge.
RIGHT= dimension<units>
specifies the amount of extra space to add to the right edge.
TOP= dimension<units>
specifies the amount of extra space to add to the top edge.
BOTTOM= dimension<units>
specifies the amount of extra space to add to the bottom edge.
SGANNO= annotation-data-set
specifies the SG annotation data set that you want to use. You specify this option only if you are using the SG annotation feature to annotate your graph. For more information, see Annotating ODS Graphics.
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.
Restriction:Graphs that contain summarized data (for example, bar, line, and dot) do not generate a useable template. For summarized data, the procedure sets internal values for one or more variables, and these internal values do not exist in the data set that is used with the procedure.
UNIFORM= GROUP | SCALE | ALL | XSCALE | YSCALE | XSCALEGROUP | YSCALEGROUP
specifies how to control axis scaling and marker attributes when you use a BY statement.
Specify one of the following values:
ALL
specifies that both the legend group values and the axis scaling are shared between all of the levels of the BY variable or variables.
GROUP
specifies that the legend group values are shared between all of the levels of the BY variable or variables. This option is applicable only when the GROUP= option is specified for the plot.
SCALE
specifies that the axis scaling is shared between all of the levels of the BY variable or variables.
XSCALE
specifies that the X axis scaling is shared between all of the levels of the BY variable or variables. The Y axes are unaffected.
YSCALE
specifies that the Y axis scaling is shared between all of the levels of the BY variable or variables. The X axes are unaffected.
XSCALEGROUP
specifies that both the legend group values and the X axis scaling are shared between all of the levels of the BY variable or variables. The Y axes are unaffected. This option is applicable only when the GROUP= option is specified for the plot.
YSCALEGROUP
specifies that both the legend group values and the Y axis scaling are shared between all of the levels of the BY variable or variables. The X axes are unaffected. This option is applicable only when the GROUP= option is specified for the plot.
By default, each level of the BY variable or variables can have different legend group values and different axis scaling.
Interaction:This option has no effect if you do not use a BY statement.