Chapter Contents


Doing More with SAS/ASSIST Software

Doing More with Bar Charts

You can use Bar Charts on the Graphics menu to create horizontal or vertical simple bar charts, stacked bar charts, grouped bar charts, and grouped and stacked bar charts. In the "Graphics" chapter of Getting Started with the SAS System Using SAS/ASSIST Software, you learned how to create a bar chart. This section describes some of the more advanced options available when generating bar charts.

Generating a Bar Chart with the Mean Displayed

In this section you create a vertical bar chart showing the mean weight by age in the CLASS data set. You choose to have the mean of each bar displayed above the bar, adjust the fill patterns of the bars, add a title to the chart, and change the font of the title.

Setting Up the Bar Chart

  1. To display the Bar Charts window, follow this selection path:

    Bar Charts
    The Bar Charts window appears.

    Bar Charts Window


  2. Select Vertical and 2D.

  3. Use the Table button to select the SASUSER.CLASS table.

  4. Select Bar values. The Bar/Slice Values window appears.

    Bar/Slice Values Window


  5. Select Mean as the statistic you want the bars to represent. By selecting Mean, each bar represents the mean of the analysis variable. You must select an analysis column if you select Sum or Mean as the bar value.

  6. Use the Analysis column button to select the WEIGHT column.

  7. Select OK to return to the Bar Charts window.

  8. Use the Chart column button to select the AGE column.

Customizing the Bar Chart with Additional Options and Titles

  1. Select Additional options. The Additional Options window appears.

  2. Select General options. The General Options window appears.

    General Options Window


  3. Select Mean as the statistic to display above the bars for the vertical bar chart.

  4. Select OK to return to the Additional Options window.

  5. Select Color and pattern options. The Color and Pattern Options window appears.

    Color and Pattern Options Window


  6. For the 1ST and 4TH areas, select Cross as the pattern.

    For the 2ND and 5TH areas, leave the pattern as Solid.

    For the 3RD and 6TH areas, select Empty as the pattern.

    The pattern selected by default for the bars is Solid. If you print a black and white graphic as shown in this book, you can use the pattern options to distinguish one bar from another.

    If you print a color graphic, you can use colors to distinguish one bar from another. To display a list of valid colors, type ? in the first position of the Color field and press ENTER. Select the color you want to use.

  7. Select OK to return to the Additional Options window.

  8. Select Number of bars. The Midpoint Values window appears.

    Midpoint Values Window


  9. Select Use each discrete chart variable value. The Additional Options window reappears.

    You select Use each discrete chart variable value to display one bar for each age represented in the CLASS data set (11, 12, 13, 14, 15, and 16). The default for the number of bars is Let the number of midpoints default, which lets the procedure determine the number of midpoints (bars) for the chart column. Each midpoint represents a median of a range of values. In this example, if you use Let the number of midpoints default, the bars represent the midpoints of the AGE variable (11.4, 12.6, 13.8, 15, and 16.2).

    The window that appears when you select Number of bars is different for numeric and character chart columns.

  10. Select Goback to return to the Bar Charts window.

  11. To display the Title 1 window, follow this selection path starting from the Bar Charts window:

    Title 1

    Title 1 Window


  12. Type Mean Weight by Age as the title for the plot.

    Note:   Titles carry over from one report or graphic to another. If you do not type a title and a title was selected previously in the current SAS/ASSIST session, the previous title automatically appears on this graphic.  [cautionend]

  13. Select Font.

    The Font List window appears.

    Font List Window


  14. Select Italic as the font for Title 1; the Title 1 window reappears.

    Select OK twice to return to the Bar Charts window.

Running the Bar Chart

  1. Select Submit from the Run menu. The bar chart appears in the GRAPH window.

    Bar Chart Output


  2. To return to the Bar Charts window from the GRAPH window, follow this selection path:


Other Bar Chart Options

Three-dimensional Bar Charts

By selecting 3D in the Bar Charts window, you can create three-dimensional bar charts, as shown in the following example.

Three-dimensional Bar Chart Output


Grouping and Stacking

By assigning a column to Stacking column or Grouping column, you can create bar charts that show more interesting relationship in your data. For example, if you assign the SEX column to Grouping column in the previous example, you create a bar graph that separates the data for males and females:

Grouped Bar Chart Output


Similarly, if you assign the SEX column to Stacking column and use frequency for Bar values, you can create a bar chart with males and females distinguished in the same bar for each age:

Stacked Bar Chart Output


You can also combine stacking and grouping to create grouped stacked bar charts.

Horizontal Bar Charts

By selecting Horizontal on the Bar Charts window, you can create bar charts with the bars running horizontally rather than vertically. Grouping and stacking options are also available for horizontal bar charts. Instead of being able to display a particular statistic for each bar (as in the vertical bar chart example earlier in this section), you can select Display statistics on the General Options window, which causes statistics to be displayed to the right of the bar chart.

Horizontal Bar Chart Output


Other Options

By choosing items on the Additional Options menu, you can add a reference line to your bar chart; change the color, size, and font of the label text; change the appearance of the axes; and change the appearance of the legend.

Chapter Contents



Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.