Procedure Syntax


Requirements:

  • One BAR statement

Global statements: AXIS, FOOTNOTE, GOPTIONS, PATTERN, TITLE

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

Supports:

  • RUN- group processing

  • Output Delivery System (ODS)

Not supported by: Java

PROC GBARLINE <DATA= input-data-set >

  • <ANNOTATE= Annotate-data-set >

  • <IMAGEMAP= output-data-set >;

BAR bar-variable </ option(s) >;

< PLOT </ option(s) >;>

PROC GBARLINE Statement

Identifies the data set containing the chart variables . Optionally specifies annotation.

Requirements: An input data set is required.

Not supported by: Java

Syntax

  • PROC GBARLINE <DATA= input-data-set >

    • <ANNOTATE= Annotate-data-set >

    • <IMAGEMAP= output-data-set >;

Options

PROC GBARLINE statement options affect all graphs produced by the procedure.

ANNOTATE= Annotate-data-set

ANNO= Annotate-data-set

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

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

DATA= input-data-set

  • specifies the SAS data set that contains the variable(s) to chart. By default, the procedure uses the most recently created SAS data set.

    See also: SAS Data Sets on page 29 and About the Bar Variable on page 742

IMAGEMAP= output-data-set

  • creates a temporary SAS data set that is used to generate an image map in an HTML output file. The information in the image map data set includes the shape and coordinates of the elements in the graph and drill-down URLs that have been associated with those elements. The drill-down URLs are provided by one or two variables in the input data set. These variables are identified to the GBARLINE procedure with the HTML= option.

    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); 

BAR Statement

Creates vertical bar charts in which the height of the bars represents the value of the bar statistic for each category of data.

Requirements: One bar variable is required.

Global statements: AXIS, FOOTNOTE, PATTERN, TITLE

Supports: Drill-down functionality

Not supported by: Java

Description

The BAR statement specifies the variable that defines the categories of data to chart. These statements automatically

  • determine the midpoints

  • calculate the bar statistic for each midpoint (the default is FREQ)

  • scale the response axis and the bars according to the statistic value

  • determine bar width and spacing

  • assign patterns to the bars; the default bar pattern is SOLID

  • draw a frame around the axis area using the first color in the colors list.

You can use statement options to select or order the midpoints (bars), to control the tick marks on the response axis, to change the type of bar statistic, to display specific statistics, and to modify the appearance of the chart. You can also specify additional variables by which to sum the data.

In addition, you can

  • use global statements to modify the axes and the bar patterns. See Chapter 7, SAS/GRAPH Statements, on page 121 for more information.

  • add titles and footnotes to the chart. See TITLE, FOOTNOTE, and NOTE Statements on page 210 for more information.

  • use an Annotate data set to enhance the chart. See Chapter 24, Using Annotate Data Sets, on page 587 for more information.

  • display an image in the background of the chart. See IBACK on page 317 for more information.

  • display images in the bars of the chart. See the IMAGE= option on page 171 for the PATTERN statement.

Syntax

  • BAR bar-variable </ option(s) >;

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

  • appearance options

    • ANNOTATE= Annotate-data-set

      CAUTOREF= reference-line-color

      CAXIS= axis-color

      CERROR= error-bar-color

      CFRAME= background-color

      COUTLINE= bar-outline-color SAME

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

      CTEXT= text-color

      FRAME NOFRAME

      FRONTREF

      LAUTOREF= reference-line-type

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

      PATTERNID=BY MIDPOINT

      SPACE= bar-spacing

      WIDTH= bar-width

      WOUTLINE= bar-outline-width

  • statistic options

    • CFREQ

      CLM= confidence-level

      CPERCENT

      ERRORBARS=BARS BOTH TOP

      FREQ

      FREQ= numeric-variable

      INSIDE= statistic

      MEAN

      OUTSIDE= statistic

      PERCENT

      SUM

      SUMVAR= summary-variable

      TYPE= statistic

  • midpoint options

    • DISCRETE

      LEVELS= number-of-midpoints

      MIDPOINTS= value-list

      MIDPOINTS=OLD

      MISSING

  • axes options

    • ASCENDING

      AUTOREF

      AXIS=AXIS<1...99>

      CLIPREF

      DESCENDING

      MAXIS=AXIS<1...99>

      MINOR= number-of-minor- ticks

      NOAXIS

      NOBASEREF

      NOZERO

      RANGE

      RAXIS= value-list AXIS<1...99>

      REF= value-list

  • catalog entry description options

    • DESCRIPTION= entry-description

    • NAME= string

  • ODS options

    • HTML= variable

Required Arguments

bar-variable

  • specifies the variable that defines the categories of data to chart. The variable must be in the input data set.

    See also: About the Bar Variable on page 742

Options

Options in the BAR 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. For details on specifying colors, see Chapter 6, SAS/GRAPH Colors and Images, on page 91. For details on specifying images, see Specifying Images in SAS/GRAPH Programs on page 106. For a complete description of the graphics options, see Chapter 8, Graphics Options and Device Parameters Dictionary, on page 261.

ANNOTATE= Annotate-data-set

ANNO= Annotate-data-set

  • specifies a data set to annotate charts produced by the BAR statement.

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

ASCENDING

  • arranges the bars in ascending order of the value of the bar statistic. By default, bars are arranged in ascending order of midpoint value, without regard to the lengths of the bars. ASCENDING reorders the bars from shortest to longest. The ordering is left to right.

    ASCENDING overrides any midpoint order specified in the MIDPOINTS= option or specified in the ORDER= option in an AXIS statement assigned to the midpoint axis.

AUTOREF

  • draws a reference line at each major tick mark on the chart (left) response axis. To draw reference lines at specific points on the response axis, use the REF= option.

    By default, reference lines are drawn in front of the bars. To draw reference lines behind the bars, use the CLIPREF option.

AXIS=AXIS<1...99>

  • See RAXIS= on page 761.

CAUTOREF= reference-line-color

  • specifies the color of reference lines drawn at major tick marks, as determined by the AUTOREF option. The default color is either the value of the CAXIS= option or the first color in the color list. To specify a line type for these reference lines, use the LAUTOREF= option.

CAXIS= axis-color

  • specifies a color for the response and midpoint axis lines and for the default axis area frame. If you omit the CAXIS= option, PROC GBARLINE searches for a color specification in this order:

    1. the COLOR= option in AXIS definitions

    2. the first color in the colors list (the default).

CERROR= error-bar-color

  • specifies the color of error bars. The default is the color of the response axis, which is controlled by the CAXIS= option.

CFRAME= background-color

CFR= background-color

  • specifies the color with which to fill the axis area.

    The axis area color does not affect the frame color, which is always the same as the midpoint axis line color and controlled by the CAXIS= option. By default, the axis area is not filled.

    The CFRAME= option is overridden by the NOFRAME option.

    Note: If the background color, the bar color, and the outline color are the same, then you will not be able to distinguish the bars.

CFREQ

  • displays the cumulative frequency statistic above the bars. A maximum of two statistics can be printed. This option is ignored if the bars are too narrow to avoid overlapping values or if the FREQ option is specified.

    See also: About Chart Statistics on page 745 and Displaying Statistics In Bar Line Charts on page 763

CLIPREF

  • clips the reference lines at the bars. This makes the reference lines appear to be behind the bars.

CLM= confidence-level

  • specifies the confidence intervals to use when drawing error bars. Values for confidence-level must be greater than or equal to 50 and strictly less than 100. The default is 95. See ERRORBAR= for details on how error bars are computed and drawn.

COUTLINE= bar-outline-color SAME

  • outlines all bars or bar segments using the specified color. SAME specifies that the outline color of a bar is the same as the interior pattern color.

    The default outline color depends on the PATTERN statement:

    • If you do not specify a PATTERN statement, the default outline color is black for the ActiveX device. Otherwise , the default outline color is the foreground color (the first color in the colors list).

    • If you specify the PATTERN statement or the V6COMP graphics option, the default is COUTLINE=SAME.

  • The COUTLINE= option is not valid when SHAPE=CYLINDER.

  • See also: Controlling Bar Line Chart Patterns, Colors, and Images on page 764 and About Patterns on page 748

CPERCENT

CPCT

  • displays the cumulative percentage statistic above the bars. A maximum of two statistics can be printed. This option is ignored if the bars are too narrow to avoid overlapping values or if the FREQ, CFREQ, or PERCENT option is specified.

    See also: About Chart Statistics on page 745 and Displaying Statistics In Bar Line Charts on page 763

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

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

  • specifies colors for reference lines. Specifying a single color without parentheses applies that color to all reference lines, including lines drawn with the AUTOREF and REF= options. The CAUTOREF= option overrides the CREF= reference line color for reference lines drawn with the AUTOREF option. Specifying a single color in parentheses applies that color only to the first reference line drawn with the REF= option. Specifying a reference color list applies colors in sequence to successive lines drawn with the REF= 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 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 LREF= option.

CTEXT= text-color

  • specifies the color of all text on the chart that is not otherwise assigned a color. Text includes axis values and axis labels in the response and midpoint axes; and the displayed statistics. For the ActiveX device, the default color is black. For other devices, if you omit the CTEXT= option, PROC GBARLINE searches for a color specification in this order:

    1. the CTEXT= option in a GOPTIONS statement

    2. the first color in the colors list (the default).

  • The CTEXT= option overrides the color specification for the axis label and the tick mark values in the COLOR= option in an AXIS definition assigned to an axis.

    The CTEXT= option is overridden by the COLOR= suboption of a LABEL= or VALUE= option in an AXIS definition assigned to an axis. In this case the suboption determines the color of the axis label or the color of the tick mark values, respectively.

DESCENDING

  • arranges the bars in descending order of the value of the bar statistic. By default, bars are arranged in ascending order of midpoint value, without regard to the lengths of the bars. DESCENDING reorders the bars from longest to shortest. The ordering is left to right.

    DESCENDING overrides any midpoint order that is specified with the MIDPOINTS= option or that is specified in the ORDER= option in an AXIS statement assigned to the midpoint axis.

DESCRIPTION= entry-description

DES= entry-description

  • specifies the description of the catalog entry for the chart. The maximum length for the entry-description is 256 characters . The description does not appear on the chart. By default, the GBARLINE procedure assigns a description of the form GBARLINE CHART OF variable , where variable is the name of the bar 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. Refer to the description of the options on page 222 and to 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 each of the following:

    • the "description" portion of the Results window

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

    • the Table of Contents that is generated when you use CONTENTS= on an ODS statement (see Linking to Output through a Table of Contents on page 495), assuming the GBARLINE output is generated while the contents page is open

    • the Description field of the PROC GREPLAY window.

DISCRETE

  • treats a numeric bar variable as a discrete variable rather than as a continuous variable. The GBARLINE procedure creates a separate midpoint and, hence, a separate bar for each unique value of the bar variable. If the bar variable has a format associated with it, then each formatted value is treated as a midpoint.

    The LEVELS= option is ignored when you use DISCRETE. The MIDPOINTS= option overrides DISCRETE. The ORDER= option in an AXIS statement that is assigned to the midpoint axis can rearrange or exclude discrete midpoint values.

ERRORBAR=BARS BOTH TOP

  • draws confidence intervals for either of the following:

    • the mean of the SUMVAR= variable for each midpoint if you specify TYPE=MEAN

    • the percentage of observations assigned to each midpoint if you specify TYPE=PCT with no SUMVAR= option.

  • The ERRORBAR= option cannot be used with values of the TYPE= option other than MEAN or PCT. Valid values for ERRORBAR= are:

    BARS

    • draws error bars as bars half the width of the main bars.

  • BOTH

    • draws error bars as two ticks joined by a line (default).

  • TOP

    • draws the error bar as a tick for the upper confidence limit that is joined to the top of the bar by a line.

  • By default, ERRORBAR= uses a confidence level of 95 percent. You can specify different confidence levels with the CLM= option.

    When you use ERRORBAR= with TYPE=PCT, the confidence interval is based on a normal approximation . Let TOTAL be the total number of observations, and PCT be the percentage assigned to a given midpoint. The standard error of the percentage is approximated as

     APSTDERR=100 * SQRT((PCT/100) * (1--(PCT/100)) / TOTAL); 

    Let LEVEL be the confidence level specified using the CLM= option, with a default value of 95. The upper confidence limit for the percentage is computed as

     UCLP = PCT + APSTDERR * PROBIT( 1-(1-LEVEL/100)/2 ); 

    The lower confidence limit for the percentage is computed as

     LCLP = PCT - APSTDERR * PROBIT( 1-(1-LEVEL/100)/2 ); 

    When you use ERRORBAR= with TYPE=MEAN, the sum variable must have at least two non-missing values for each midpoint. Let N be the number of observations assigned to a midpoint, MEAN be the mean of those observations, and STD be the standard deviation of the observations. The standard error of the mean is computed as

     STDERR = STD / SQRT(N); 

    Let LEVEL be the confidence level specified using the CLM= option, with a default value of 95. The upper confidence limit for the mean is computed as

     UCLM = MEAN + STDERR * TINV( 1-(1-LEVEL/100)/2, N-1); 

    The lower confidence limit for the mean is computed as

     LCLM = MEAN - STDERR * TINV( 1-(1-LEVEL/100)/2, N-1); 
  • If you want the error bars to represent a given number C of standard errors instead of a confidence interval, and if the number of observations assigned to each midpoint is the same, then you can find the appropriate value for the CLM= option by running a DATA step. For example, if you want error bars that represent one standard error (C=1) with a sample size of N , you can run the following DATA step to compute the appropriate value for the CLM= option and assign that value to a macro variable &LEVEL:

     data null;  c=1;  n = 10;  level = 100 * (1 -2*(1-probt( c, n-1)));  put all;  call symput('level',put(level,best12.));  run; 

    Then when you run the GBARLINE procedure, you can specify CLM=&LEVEL.

    Note that this trick does not work precisely if different midpoints have different numbers of observations. However, choosing an average value for N may yield sufficiently accurate results for graphical purposes if the sample sizes are large or do not vary much.

FRAME NOFRAME

FR NOFR

  • specifies whether the axis area frame is drawn. The default is FRAME, which draws a frame around the axis area. Specifying NOFRAME removes the axis area frame, including any background color or image. To remove one or more axis elements, use either the AXIS statement or the NOAXIS option.

    The NOFRAME option overrides the CFRAME= option and IBACK on page 317.

    The color of the frame or backplane outline is the color of the midpoint axis, which is determined by the CAXIS= option.

    If the V6COMP graphics option is in effect, the default value for GRSEGs is NOFRAME. See Version 6 Patterns on page 749 for more information.

FREQ

  • displays the frequency statistic above the bars. Non-integer values are rounded down to the nearest integer. A maximum of two statistics can be printed. This option is ignored if the bars are too narrow to avoid overlapping values. This option overrides the CFREQ, PERCENT, CPERCENT, SUM, and MEAN options.

    See also: About Chart Statistics on page 745 and Displaying Statistics In Bar Line Charts on page 763

FREQ= numeric-variable

  • specifies a variable whose values weight the contribution of each observation in the computation of the bar statistic. Each observation is counted the number of times that is specified by the value of numeric-variable for that observation. If the value of numeric-variable is missing, 0, or negative, then the observation is not used in the statistic calculation. Non-integer values of numeric-variable are truncated to integers. The FREQ= option is valid with all bar statistics.

    Because you cannot use TYPE=PERCENT, TYPE=CPERCENT, TYPE=FREQ, or TYPE=CFREQ with the SUMVAR= option, you must use the FREQ= option to calculate percentages, cumulative percentages, frequencies, or cumulative frequencies based on a sum.

    The statistics will not be affected by applying a format to numeric-variable .

    Not supported by: ActiveX, Java

    See also: Calculating Weighted Statistics on page 746

FRONTREF

  • specifies that reference lines drawn by the AUTOREF or REF= options should be drawn in front of the bars.

HTML= variable

  • identifies the variable in the input data set whose values create links in the HTML file created by the ODS statement. These links are associated with the bars and point to the data or graph you wish to display when the user drills down on the area. The values of variable can be up to 1024 characters long. Characters after the 1024-character limit (including any closing quotes) are truncated.

INSIDE= statistic

  • displays the values of the specified statistic inside the bars. Statistic can be one of the following:

    • FREQ

    • CFREQ

    • PERCENT PCT

    • CPERCENT CPCT

    • SUM

    • MEAN

  • To display statistics with INSIDE=SUM or INSIDE=MEAN, you must also specify the SUMVAR= option.

    See also: About Chart Statistics on page 745 and Displaying Statistics In Bar Line Charts on page 763

LAUTOREF= reference-line-type

  • specifies a line type for reference lines drawn at major tick marks, as specified by the AUTOREF 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 CAUTOREF= option.

LEVELS= number-of-midpoints

  • specifies the number of midpoints for a numeric bar variable. The range for each midpoint is calculated automatically, using the algorithm in Terrell and Scott (1985). The LEVELS= option is ignored if

    • the bar variable is character type

    • the DISCRETE option is used

    • the MIDPOINTS= option is used.

  • Featured in: Example 1 on page 768

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

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

  • specifies line types for reference lines. Line types are specified as whole numbers from 1 to 46, with 1 representing a solid line and the other values representing dashed lines. Specifying a line type without parentheses applies that type to all reference lines drawn with the AUTOREF and REF= options. Note that the LAUTOREF= option overrides LREF= reference-line-type for reference lines drawn with the AUTOREF option. Specifying a single line type in parentheses applies that line type to the first reference line drawn with the REF= option. Specifying a line type list applies line types in sequence to successive reference lines drawn with the REF= option. The syntax of the line-type list is of the form ( type1 type2 ... typeN ). The default line type is specified by the AXIS statement's STYLE= option. By default, STYLE=1, a solid line. To specify colors for these reference lines, use the CREF= option.

MAXIS=AXIS<1...99>

  • assigns the specified AXIS definition to the midpoint axis. The MAXIS= option is ignored if the specified AXIS definition does not exist.

    See also: AXIS Statement on page 124 and About Midpoints on page 742

MEAN

  • displays the mean statistic above the bars. A maximum of two statistics can be printed. This option is ignored if the bars are too narrow to avoid overlapping values or if the FREQ, CFREQ, PERCENT, CPERCENT, or SUM option is specified. MEAN is ignored unless you also use the SUMVAR= option.

    See also: About Chart Statistics on page 745 and Displaying Statistics In Bar Line Charts on page 763

MIDPOINTS= value-list

  • specifies the midpoint values for the bars. The way you specify value-list depends on the type of the bar variable.

    • For numeric bar 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.

      By default, numeric variable values are treated as continuous (if you omit the DISCRETE option), and

      • the lowest midpoint consolidates all data points from negative infinity to the median of the first two midpoints

      • the highest midpoint consolidates all data points from the median of the last two midpoints up to infinity

      • all other values in value-list specify the median of a range of values, and the GBARLINE procedure calculates the midpoint values.

    • If you include the DISCRETE option, then each value in value-list specifies a unique numeric value.

    • For character bar 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 ORDER= on page 130.

    If the value-list for either type of variable specifies so many midpoints that the axis values overwrite each other, then the values may be unreadable. In this case the procedure writes a warning to the SAS log. On many devices, this problem can be corrected by either adjusting the size of the text with the HTEXT= graphics option or by increasing the number of cells in your graphics display using the HPOS= and VPOS= graphics options.

    The ORDER= option in the AXIS statement overrides the order specified in the MIDPOINTS= option. The BAR statement options ASCENDING and DESCENDING also override both the MIDPOINTS= and ORDER= options in the AXIS statement.

    See also: About Midpoints on page 742

MIDPOINTS=OLD

  • generates default midpoints using the Nelder algorithm ( Applied Statistics 25:94 “7, 1976). The MIDPOINTS=OLD option is ignored unless the bar variable is numeric.

MINOR= number-of-minor-ticks

  • specifies the number of minor tick marks between each major tick mark on the bar response axis.

    The MINOR= option in a bar chart statement overrides the number of minor tick marks specified in the MINOR= option in an AXIS definition assigned to the response axis with the RAXIS= option.

MISSING

  • accepts a missing value as a valid midpoint for the bar variable. By default, observations with missing values are ignored.

NAME= string

  • specifies the name of the catalog entry for the graph. The maximum length for entry-name is eight characters. The default name is GBARLIN. If the name duplicates an existing entry name, then SAS/GRAPH software uses a number to generate a unique name ”for example, GBARLIN1.

NOAXIS

  • suppresses all axes, including axis lines, axis labels, axis values, and all major and minor tick marks. If you specify an axis definition with the MAXIS= or RAXIS= options, then the axes are generated as defined in the AXIS statement, but then all lines, labels, values, and tick marks are suppressed. Therefore, axis statement options such as ORDER=, LENGTH=, and OFFSET= will still be used.

    To remove only selected axis elements such as lines, values, or labels, use specific AXIS statement options.

    NOAXIS does not suppress either the default frame or an axis area fill requested by the CFRAME= option. To remove the axis frame, use the NOFRAME option in the procedure.

NOBASEREF

  • suppresses the zero reference line when the SUM or MEAN bar statistic has negative values.

NOZERO

  • suppresses any midpoints for which there are no corresponding values of the bar variable and, hence, no bar.

    Note: If a bar is omitted and if you have also specified bar labels with the VALUE= option in an AXIS statement, then the labels can be shifted and not displayed with the correct bar.

OUTSIDE= statistic

  • displays the values of the specified statistic above the bars. Statistic can be one of the following:

    • FREQ

    • CFREQ

    • PERCENT PCT

    • CPERCENT CPCT

    • SUM

    • MEAN

  • To display statistics with OUTSIDE=SUM or OUTSIDE=MEAN, you must also specify the SUMVAR= option.

    See also: About Chart Statistics on page 745 and Displaying Statistics In Bar Line Charts on page 763

PATTERNID=BY MIDPOINT

  • specifies the way fill patterns are assigned. By default, PATTERNID=MIDPOINT. Values for PATTERNID= are as follows :

    BY

    • changes patterns each time the value of the BY variable changes. All bars use the same pattern if the GBARLINE procedure does not include a BY statement.

  • MIDPOINT

    • changes patterns every time the midpoint value changes.

  • See also: Controlling Bar Line Chart Patterns, Colors, and Images on page 764

PERCENT

PCT

  • displays the percentages of observations having a given value for the bar variable above the bars. A maximum of two statistics can be printed. This option is ignored if the bars are too narrow to avoid overlapping values or if the FREQ or CFREQ option is specified.

    See also: About Chart Statistics on page 745 and Displaying Statistics In Bar Line Charts on page 763

RANGE

  • displays on the axis of the chart the range of numeric values represented by each bar. In the graphics output, the less-than symbol (<) and the less-than -or-equal-to symbol (<=) are used to accurately specify the starting and ending values of each range. The RANGE option has no affect on axes that represent character data. By default, the values shown on the axis are determined by the value of the MIDPOINTS= option on page 759. If specified, the DISCRETE option on page 756 overrides the RANGE option.

RAXIS= value-list AXIS<1...99>

AXIS= value-list AXIS<1...99>

  • specifies values for the major tick mark divisions on the response axis or assigns the specified AXIS definition to the axis. See the MIDPOINTS= option on page 759 for a description of value-list . By default, the GBARLINE procedure scales the response axis automatically and provides an appropriate number of tick marks.

    You can specify negative values, but negative values are reasonable only when TYPE=SUM or TYPE=MEAN and one or more of the sums or means are less than 0. Frequency and percentage values are never less than 0.

    For lists of values, a separate major tick mark is created for each individual value. A warning message is written to the SAS log if the values are not evenly spaced .

    If the values represented by the bars are larger than the highest tick mark value, then the bars are truncated at the highest tick mark.

    See also: AXIS Statement on page 124

REF= value-list

  • draws reference lines at the specified points on the bar response axis. See the MIDPOINTS= option on page 759 for a description of value-list .

    Values can be listed in any order, but should be within the range of values represented by the response axis. A warning is written to the SAS log if any of the points are off of the axis, and no reference line is drawn for such points. You can use the AUTOREF option to draw reference lines automatically at all of the major tick marks.

SPACE= bar-spacing

  • specifies the amount of space between individual bars. Bar-spacing can be any non-negative number, including decimal values. Units are character cells. By default, the GBARLINE procedure calculates spacing based on the size of the axis area and the number of bars on the chart. Use SPACE=0 to leave no space between adjacent bars.

    The SPACE= option is ignored if the specified spacing requests a chart that is too large to fit in the space available for the midpoint axis, and a warning message is issued.

SUM

  • displays the sum statistic above the bars. A maximum of two statistics can be printed. This option is ignored if the bars are too narrow to avoid overlapping values or if the FREQ, CFREQ, PERCENT, or CPERCENT option is specified. SUM is ignored unless you also use the SUMVAR= option.

    See also: About Chart Statistics on page 745 and Displaying Statistics In Bar Line Charts on page 763

SUMVAR= summary-variable

  • specifies a numeric variable for sum or mean calculations. The GBARLINE procedure calculates the sum or, if requested, the mean of summary-variable for each midpoint. The resulting statistics are represented by the length of the bars along the response axis, and they are displayed at major tick marks.

    When you use the SUMVAR= option, the TYPE= option must be either SUM or MEAN. With the SUMVAR= option, the default is TYPE=SUM.

    Featured in: Example 1 on page 768

TYPE= statistic

  • specifies the bar statistic.

    • If the SUMVAR= option is not used, statistic can be one of the following:

      • FREQ

        • frequency (the default)

      • CFREQ

        • cumulative frequency

      • PERCENT PCT

        • percentage

      • CPERCENT CPCT

        • cumulative percentage

    • If the SUMVAR= option is used, statistic can be:

      • SUM

        • sum (the default)

      • MEAN

        • mean

  • Because you cannot use TYPE=FREQ, TYPE=CFREQ, TYPE=PERCENT, or TYPE=CPERCENT with the SUMVAR= option, you must use the FREQ= option to calculate percentages, cumulative percentages, frequencies, or cumulative frequencies based on a sum. See also Calculating Weighted Statistics on page 746.

    See also: About Chart Statistics on page 745 for a complete description of statistic types

WIDTH= bar-width

  • specifies the width of the bars. By default, the GBARLINE procedure selects a bar width that accommodates the midpoint values displayed on the midpoint axis using a hardware font and a height of one cell . Units for bar-width are character cells. The value for bar-width must be greater than 0, but it does not have to be an integer, for example,

     bar site / width=1.5; 

    If the requested bar width results in a chart that is too large to fit in the space available for the midpoint axis, then the procedure issues a warning in the log and ignores the WIDTH= specification. If the specified width is too narrow, the procedure may display the midpoint values vertically.

WOUTLINE= bar-outline-width

  • specifies the width of the bar outline in pixels.

The Bar Statistic and the Response Axis

In bar line charts, the scale of values of the bar statistic is displayed on the left response axis. By default, the response axis is divided into evenly spaced intervals identified with major tick marks that are labeled with the corresponding statistic value. Minor tick marks are evenly distributed between the major tick marks unless a log axis has been requested. For sum and mean statistics, the major tick marks are labeled with values of the SUMVAR= variable (formatted if the variable has an associated format). The response axis is also labeled with the statistic type.

Displaying Statistics In Bar Line Charts

Statistic values on bar line charts are not printed by default, so you must explicitly request a statistic with the FREQ, CFREQ, PERCENT, CPERCENT, SUM, MEAN, INSIDE=, or OUTSIDE= option.

For graphs generated with the ActiveX device, you can display one statistic for each bar. For graphs generated with other devices, you can display up to two statistics for each bar. Statistics can be displayed either above the bars or inside the bars.

To specify a statistic that you want to display above the bars, specify the statistic option (FREQ, CFREQ, PERCENT, CPERCENT, SUM, or MEAN) or specify OUTSIDE= statistic . To specify a statistic that you want to display inside the bars, specify INSIDE= statistic .

For graphs generated with the ActiveX device, the OUTSIDE= option overrides INSIDE=, and INSIDE= overrides the FREQ, CFREQ, PERCENT, CPERCENT, SUM, and MEAN options. For graphs generated with other devices, the individual statistic options override the OUTSIDE= option.

If more than one statistic option is specified, only the highest priority statistic is displayed. The priority order, from highest to lowest, is as follows:

  1. FREQ

  2. CFREQ

  3. PERCENT

  4. CPERCENT

  5. SUM

  6. MEAN

The bars must be wide enough to accommodate the text. You can adjust the width of the bars with the WIDTH= option. To control the font and size of the text, use the HTEXT= and FTEXT= graphics options.

Ordering and Selecting Midpoints

To rearrange character or discrete numeric midpoint values or to select ranges for numeric values, use the MIDPOINTS= option. Remember that although changing the number of midpoints for numeric variables may change the range of values for individual midpoints, it does not change the range of values for the chart as a whole. For details, see About Midpoints on page 742.

Like the MIDPOINTS= option, the ORDER= option in the AXIS statement can rearrange the order of the midpoints or suppress the display of discrete numeric or character values. However, the ORDER= option cannot calculate the midpoints for a continuous numeric variable, or exclude values from the calculations. For details, see the description of the ORDER= option on page 130.

Controlling Bar Line Chart Patterns, Colors, and Images

Default Patterns and Outlines

Each bar in a bar line chart is filled with a pattern. By default, the procedure

  • fills the bars with bar patterns, beginning with the default fill, SOLID, and rotating it through the colors list. When the solid patterns are exhausted, the procedure selects the next default bar pattern (empty) and rotates it through the colors list. It continues in this fashion until all of the required patterns have been assigned.

    If you use the device's default colors and the first color in the list is either black or white, then the procedure does not create a pattern in that color. If you specify a colors list with the COLORS= graphics option, then the procedure uses all the colors in the list to generate the patterns.

  • outlines bars using the first color in the colors list.

See About Patterns on page 748 for more information on how the GBARLINE procedure assigns default patterns and outlines.

User-Defined Patterns

To override the default patterns and select fills and colors for the bars, use the PATTERN statement. Only solid and empty bar patterns are valid; all other pattern fills are ignored. For a complete description of all bar patterns, see the VALUE= option on page 171.

Whenever you use PATTERN statements, the default pattern outline color changes to SAME. That is, the outline color is the same as the fill color. To specify the outline color, use the COUTLINE= option (see COUTLINE= on page 754).

When Patterns Change

The PATTERNID= option controls when the pattern changes. By default, PATTERNID=MIDPOINT, which specifies that the pattern changes every time the midpoint value changes.

Instead of changing the pattern for each midpoint, you can change the pattern for each BY group by changing the value of the PATTERNID= option. See the PATTERNID= option on page 761 for details.

Axis Color

By default, axis elements use the first color in the colors list or the colors that are specified by AXIS statement color options. However, BAR statement options can also control the color of the axis lines, text, and frame.

To change the color of...

Use this option...

the axis text

CTEXT=

the axis lines

CAXIS=

the area within the frame

CFRAME=

Adding Images to Bar Line Charts

You can apply images to the bars and to the backplane frame of bar line charts developed with the BAR statement. For details, see Specifying Images in SAS/GRAPH Programs on page 106.

PLOT Statement

Creates a plot overlay on top of the bar line chart.

Requirements: If specified, the PLOT statement must be specified after the BAR statement.

Global statements: AXIS, FOOTNOTE, PATTERN, SYMBOL, TITLE

Supports: Drill-down functionality

Not supported by: Java

Description

The PLOT statement specifies one plot request. This statement automatically

  • scales the plot response (right) axis to include the maximum and minimum data values

  • plots data points within the axis

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

You can use statement options to specify a plot variable, manipulate the plot response axis, 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, or specify other types of interpolations. For more information on the SYMBOL statement, see SYMBOL Statement on page 183.

In addition, you can use global statements to modify the axis, or add titles, footnotes, and notes to the plot.

Syntax

PLOT </ options(s) >;

The PLOT statement is optional, but if specified, it must follow the BAR statement. If you do not specify a PLOT statement, GBARLINE generates only a bar chart and duplicates the bar response axis (left axis) as the plot response axis (right axis).

To specify a variable to plot, use the SUMVAR= option. If you do not specify a plot variable, GBARLINE uses the bar variable as the plot variable. For more information, see About the Plot Variable on page 745 and the description of the SUMVAR= option.

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

  • appearance options:

    • NOLINE

      NOMARKER

  • statistic options:

    • CFREQ

      CPERCENT

      FREQ

      FREQ= numeric-variable

      MEAN

      PERCENT

      SUM

      SUMVAR= plot-variable

      TYPE= statistic

  • axes options:

    • ASCENDING

      AXIS=AXIS<1...99>

      DESCENDING

      RAXIS= value-list AXIS<1...99>

      MINOR= number-of-minor-ticks

  • ODS options:

    • HTML= variable

Options

  • You can specify as many options as you want and list them in any order.

ASCENDING

  • joins the plot points in ascending order of the value of the plot statistic. By default, data points are joined in ascending order of the midpoint value.

AXIS=AXIS<1...99>

  • See RAXIS= on page 767.

DESCENDING

  • joins the plot points in descending order of the value of the plot statistic. By default, plot points are arranged in ascending order of the midpoint value.

FREQ= numeric-variable

  • specifies a variable whose values weight the contribution of each observation in the computation of the plot statistic. Each observation is counted the number of times that is specified by the value of numeric-variable for that observation. If the value of numeric-variable is missing, 0, or negative, then the observation is not used in the statistic calculation. Non-integer values of numeric-variable are truncated to integers. The FREQ= option is valid with all plot statistics.

    Because you cannot use TYPE=PERCENT, TYPE=CPERCENT, TYPE=FREQ, or TYPE=CFREQ with the SUMVAR= option, you must use the FREQ= option to calculate percentages, cumulative percentages, frequencies, or cumulative frequencies based on a sum.

    The statistics will not be affected by applying a format to numeric-variable .

    Not supported by: ActiveX, Java

HTML= variable

  • identifies the variable in the input data set whose values create links in the HTML file created by the ODS statement. These links are associated with the plot points. 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 values of variable can be up to 1024 characters long. Characters after the 1024-character limit (including any closing quotes) are truncated.

    Note: This option is supported only by the ActiveX device drivers.

MINOR= number-of-minor-ticks

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

NOLINE

  • suppresses the drawing of the line plot overlay, regardless of what is specified in the SYMBOL statement.

NOMARKER

  • suppressed the drawing of the marker symbol, regardless of what is specified in the SYMBOL statement.

RAXIS= value-list AXIS<1...99>

AXIS= value-list AXIS<1...99>

  • specifies the major tick mark values for the plot (right) response axis or assigns an AXIS definition.

    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 >

SUMVAR= plot-variable

  • specifies the variable to plot. Plot-variable , if specified, must be numeric. The GBARLINE procedure calculates the sum or, if requested, the mean of plot-variable for each midpoint.

    When you use the SUMVAR= option, the TYPE= option must be either SUM or MEAN. With the SUMVAR= option, the default is TYPE=SUM.

    Featured in: Example 1 on page 768

    See also: About the Plot Variable on page 745

TYPE= statistic

  • specifies the plot statistic.

    • If the SUMVAR= option is not used, statistic can be one of the following:

      FREQ

      • frequency (the default)

    • CFREQ

      • cumulative frequency

    • PERCENT PCT

      • percentage

    • CPERCENT CPCT

      • cumulative percentage

    • If SUMVAR= is used, statistic can be one of the following:

      SUM

      • sum (the default)

    • MEAN

      • mean

  • Because you cannot use TYPE=FREQ, TYPE=CFREQ, TYPE=PERCENT, or TYPE=CPERCENT with SUMVAR=, you must use FREQ= to calculate percentages or frequencies based on a sum.

    See also: About Chart Statistics on page 745 and Calculating Weighted Statistics on page 746

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 GBARLINE procedure or explicitly with a plot request.

If no SYMBOL definition is currently in effect, the GBARLINE procedure produces a join interpolation using the default plot symbol. The default plot symbol for ActiveX device drivers is the square. For other devices, the default symbol is the plus sign (+).

See SYMBOL Statement on page 183 for a complete discussion of the features of the SYMBOL statement.




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