Bar Charts

 < Day Day Up > 



To create a bar chart, select Graphs Bar Chart. Select Horizontal...or Vertical...to create a horizontal or a vertical bar chart.

click to expand
Figure 5.1: Vertical Bar Chart Dialog

Select variables from the candidate list and click on the Chart button to create bar charts of those variables.

Select 2-D or 3-D under Bar type to specify whether you want to display a two-dimensional or a three-dimensional chart.

Select a variable from the candidate list and click on the Group By button to add the variable to be used as a grouping variable in the bar chart. This organizes the bars into groups based on the values of the grouping variable.

Select a variable from the candidate list and click on the Stack By button to add the variable to be used as a stacking variable in the bar chart. Using a stacking variable subdivides, or stacks segments of, each bar based on the contribution of the stacking variable.

Bar Chart Options

Click on the Options button to display the Bar Chart Options dialog. In the Bar Chart Options dialog, you can control the appearance of your horizontal or vertical bar chart. Click OK to save your changes.

Number of Bars

The Number of Bars tab enables you to specify the number of bars in the chart and the order in which they are displayed.

click to expand
Figure 5.2: Number of Bars Tab

Select Default number of bars to display a default number of bars based on the chart variable. Select N bars and select a number from the list to specify the number of bars to be displayed. Select Bar for each discrete level to display a bar for each discrete level of the chart variable. If there is only one chart variable, select Bars for specified levels and click on the Specify button to provide a list of midpoints or to specify a range of numeric values, or to provide a list of character values.

Under Order of bars, select Default, Ascending, or Descending to display your data in default order, ascending order of bar length, or descending order of bar length.

Bar Values

The Bar Values tab enables you to control the type of information that is displayed by each bar by specifying the statistic to display in the chart and any additional variable to use in computing the statistic.

click to expand
Figure 5.3: Bar Values Tab

If you do not specify an analysis variable, you can select frequency, percent, cumulative percent, or cumulative frequency as the statistic to chart. Each bar represents the selected statistic for the current midpoint value of the chart variable.

If you specify an analysis variable, you can select sum or average as the statistic to chart. Each bar displays the sum or average of the analysis variable for the current midpoint value of the chart variable.

Appearance

The Appearance tab enables you to select colors and fonts.

click to expand
Figure 5.4: Appearance Tab

Under Bar outline, click on the Color button and select a color for the outline of the bar from the Color Attributes dialog. Specify the width of the bar outline in pixels in the Width: selector.

Under Bar text, click on the Color button and select a color for the chart text from the Color Attributes dialog. Specify the height of the text in cells in the Height: selector. Select a font by clicking on the arrow next to the Font: selector.

Under Change bar appearance with change in, you can track changes in the chart or group variable values by color, or you can choose to have all bars remain the same color. If you choose All bars the same, you can specify the color to be used.

Statistics

The Statistics tab enables you to specify the display of statistics in horizontal and vertical bar charts.

click to expand
Figure 5.5: Statistics Tab

If the chart is a vertical bar chart, the Vertical bar statistics section is clickable and the Horizontal bar statistics section is greyed. Select Display statistics if you want statistics to be displayed in the chart, and specify whether the statistics should be displayed inside or outside the bars of the chart. Select the statistic to be displayed from the list.

If the chart is a horizontal bar chart, the Horizontal bar statistics section is clickable and the Vertical bar statistics section is greyed. Select Display no statistics to hide statistics from display. Select Display default statistics to display the statistics that have been applied to the chart. To display one statistic, select Display one statistic, and select the statistic to be displayed from the list.

Details

The Details tab enables you to specify reference lines and frame options.

click to expand
Figure 5.6: Details Tab

Under Reference lines, you can select whether to display no reference lines, or display reference lines in front of or behind the bars in the chart.

Under Frame options, when you select Draw frame on axis, you can click on the Frame Fill Color button and select a color for the frame from the Color Attributes dialog.

Bar Chart Titles

Click on the Titles button to display the Titles dialog.

click to expand
Figure 5.7: Titles Dialog, Bar Chart Tab

In the Global tab, you can specify titles that are displayed on all output. These titles are saved across Analyst sessions.

In the Bar Chart tab, you can specify titles for the bar chart. Select the box next to Override global titles to exclude the global titles from the bar chart results.

In the Settings tab, you can specify whether or not to include the date, the page numbers, and a filter description.

Bar Chart Variables

Click on the Variables button to display the Bar Chart Variables dialog.

click to expand
Figure 5.8: Vertical Bar Chart— Variables Dialog

BY group variables separate the data set into groups of observations. Separate analyses are performed for each group and displayed in separate charts. For example, you could use a BY group variable to perform separate analyses on females and males. Specify BY group variables by selecting them in the candidate list and clicking on the BY Group button.

Example: Create a 3-D Bar Chart

Open the Fitness Data Set

In this example, you create a bar chart using the Fitness data set. To open the Fitness data set, follow these steps:

  1. Select Tools Sample Data...

  2. Select Fitness.

  3. Click OK to create the sample data set in your Sasuser directory.

  4. Select File Open By SAS Name...

  5. Select Sasuser from the list of Libraries.

  6. Select Fitness from the list of members.

  7. Click OK to bring the Fitness data set into the data table.

Specify Chart and Grouping Variables

To create a 3-D vertical bar chart that compares among experimental groups the average amount of oxygen consumed given the time it takes to run 1.5 miles, follow these steps:

  1. Select Graphs Bar Chart Vertical... to display the Vertical Bar Chart dialog.

  2. Select runtime from the candidate list, and click Chart to make minutes to run 1.5 miles the charted variable.

  3. Under Bar type, select 3-D to make the bar chart three-dimensional.

  4. To compare among experimental groups, select group from the candidate list and click Group By.

click to expand
Figure 5.9: Chart and Grouping Variables

Specify Bar Chart Options

To specify your bar chart options, such as the number and appearance of the bars, follow these steps.

  1. Click on the Options button to display the Bar Chart Options dialog.

  2. Under Number of bars, select N bars, and click on the down arrow until N = 3. Because a grouping variable was specified, bars for three runtime midpoints are displayed for each value of the experimental group.

    click to expand
    Figure 5.10: Number of Bars

  3. Select the Bar Values tab. Under Analysis variables, select oxygen from the candidate list and click on the Analysis button to make oxygen consumption your analysis variable.

  4. Under Statistic to chart, select Average to display the average oxygen consumption per runtime.

    click to expand
    Figure 5.11: Bar Values

  5. Select the Appearance tab. Under Bar outline, click on the Color button. Select White from the Color Attributes list to make the bar outlines white.

    click to expand
    Figure 5.12: Bar Outlines

    Click OK to close the Color Attributes window and return to the Bar Chart Options dialog.

  6. Still on the Appearance tab, select Group variable value under Change bar appearance with change in.

    click to expand
    Figure 5.13: Bar Appearance

  7. Click OK to return to the Vertical Bar Chart dialog.

Specify Bar Chart Titles

To specify the titles for your bar chart, follow these steps:

  1. Click on the Titles button in the Vertical Bar Chart dialog.

  2. In the Bar Chart tab, type Runtime and Oxygen Consumed in the first field.

    click to expand
    Figure 5.14: Bar Chart Title

  3. Click on the Global tab. Type Fitness Report in the first field. This global title is saved across all Analyst sessions until you change it.

    click to expand
    Figure 5.15: Global Title

  4. Click OK to save your title changes.

Generate Bar Chart

To display your bar chart, click OK in the Vertical Bar Chart dialog.

click to expand
Figure 5.16: Vertical Bar Chart

As expected, larger amounts of oxygen are consumed by faster runners. Experimental group does not appear to affect this relationship or the average amount of oxygen consumed. No members of experimental group 2 were among the slowest runners.



 < Day Day Up > 



SAS Institute - The Analyst Application
The Analyst Application, Second Edition
ISBN: 158025991X
EAN: 2147483647
Year: 2003
Pages: 116

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net