Previous Page | Next Page

The SGPLOT Procedure

NEEDLE Statement


Creates a plot with needles connecting each point to the baseline.
Restriction: The vertical axis that is used with the NEEDLE statement cannot be a discrete axis.


Syntax

NEEDLE X= variable Y= numeric-variable </ option(s)>;

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


Required Arguments

X= variable

specifies the variable for the x axis.

Y= numeric-variable

specifies the variable for the y axis.


Options

BASELINE= numeric-value

specifies a value on the Y axis for the baseline.

DATALABEL <= variable>

displays a label for each data point. If you specify a variable, the values of that variable are used for the data labels. If you do not specify a variable, then the values of the Y variable are used for the data labels.

GROUP= variable

specifies a variable that is used to group the data. A separate plot is created for each unique value of the grouping variable. The plot elements for each group value are automatically distinguished by different visual attributes.

LEGENDLABEL=" "text-string"

specifies a label that identifies the needle plot in the legend. By default, the label of the Y variable or the group value for each marker is used.

Interaction: The LEGENDLABEL= option has no effect if you also specify the GROUP= option in the same plot statement.
LINEATTRS= style-element <(options)> | (options)

specifies the appearance of the needle lines. You can specify the appearance by using a style element or by using suboptions. If you specify a style element, you can additionally specify suboptions to override specific appearance attributes.

options can be one or more of the following:

COLOR= color

specifies the color of the line. For more information about specifying colors, see SAS/GRAPH Colors and Images in the SAS/GRAPH: Reference, Second Edition.

Default: For ungrouped data, the default color is specified by the ContrastColor attribute of the GraphDataDefault style element in the current style.

For grouped data, the default color is specified by the ContrastColor attribute of the GraphData1 ... GraphDatan style elements in the current style.

PATTERN= line-pattern

specifies the line pattern for the line. You can reference SAS patterns by number or by name. See Line Patterns for a list of line patterns.

Default: For ungrouped data, the default line pattern is specified by the LineStyle attribute of the GraphDataDefault style element in the current style.

For grouped data, the default line pattern is specified by the LineStyle attribute of the GraphData1 ... GraphDatan style elements in the current style.

THICKNESS= n <units>

specifies the thickness of the line. You can also specify the unit of measure. The default unit is pixels. See Units of Measurement for a list of the measurement units that are supported.

Default: For ungrouped data, the default line thickness is specified by the LineThickness attribute of the GraphDataDefault style element in the current style.

For grouped data, the default line thickness is specified by the LineThickness attribute of the GraphData1 ... GraphDatan style elements in the current style.

MARKERATTRS= style-element <(options)> | (options)

specifies the appearance of the markers in the plot. This option has no effect unless you also specify the MARKERS option. You can specify the appearance by using a style element or by using suboptions. If you specify a style element, you can additionally specify suboptions to override specific appearance attributes.

options can be one or more of the following:

COLOR= color

specifies the color of the markers. For more information about specifying colors, see SAS/GRAPH Colors and Images in the SAS/GRAPH: Reference, Second Edition.

Default: For ungrouped data, the default color is specified by the ContrastColor attribute of the GraphDataDefault style element in the current style.

For grouped data, the default color is specified by the ContrastColor attribute of the GraphData1 ... GraphDatan style elements in the current style.

SIZE= n <units >

specifies the size of the markers. You can also specify the unit of measurement. The default unit is pixels. See Units of Measurement for a list of the measurement units that are supported.

Default: The default marker size is specified by the MarkerSize attribute of the GraphDataDefault style element in the current style.
SYMBOL= symbol-name

specifies the symbol for the markers. See Marker Symbols for a list of valid marker symbols.

Default: For ungrouped data, the default marker symbol is specified by the MarkerSymbol attribute of the GraphDataDefault style element in the current style.

For grouped data, the default marker symbol is specified by the MarkerSymbol attribute of the GraphData1 ... GraphDatan style elements in the current style.

MARKERS

adds markers to the tips of the needles.

NAME= "text-string"

specifies a name for the plot. You can use the name to refer to this plot in other statements.

NOMISSINGGROUP

specifies that missing values of the group variable are not included in the plot.

Restriction: This option is available with SAS 9.2 Phase 2 and later.
TRANSPARENCY= numeric-value

specifies the degree of transparency for the needle plot. Specify a value from 0.0 (completely opaque) to 1.0 (completely transparent).

Default: 0.0
URL= character-variable

specifies a character variable that contains URLs for web pages to be displayed when parts of the plot are selected within an HTML page.

Interaction: This option affects graphics output that is created through the ODS HTML destination only.

This option has no effect unless you also specify IMAGEMAP in the ODS GRAPHICS statement.

Default: By default, no HTML links are created.
X2AXIS

assigns the X variable to the secondary (top) horizontal axis.

Y2AXIS

assigns the Y variable to the secondary (right) vertical axis.

Previous Page | Next Page | Top of Page