Creating Bar and Pie Charts Using SAS Enterprise Guide

This section discusses the means by which bar and pie charts were created with SAS IT Resource Management 2.7 and the recommended means by which they are created using SAS IT Resource Management 3.2.

About Bar and Pie Charts

The following table shows the eight chart types that are available in SAS IT Resource Management 2.7 and the corresponding SAS Enterprise Guide task that is available to generate those chart types in SAS IT Resource Management 3.2.
SAS IT Resource Management 2.7 Chart Types and Corresponding SAS Enterprise Guide Tasks
Chart Type
SAS Enterprise Guide Task
Vertical Bar
Bar Chart task
Horizontal Bar
Bar Chart task
Vertical Bar 3-D
Bar Chart task
Horizontal Bar 3-D
Bar Chart task
Pie
Pie Chart task
Pie 3-D
Pie Chart task
Star
Bar Chart task - Appearance Options, Shape
Block
Bar Chart task - 3-D vertical bar chart
In SAS Enterprise Guide, the bar orientations (vertical and horizontal) are task subtype options that are available in the Bar Chart task. The bar dimensions (two-dimensional and three-dimensional) are appearance options in the Bar Chart and Pie Chart tasks.
This section provides more details about the SAS IT Resource Management 2.7 macros that create various types of bar and pie charts and the equivalent SAS Enterprise Guide steps that are required to re-create these types of reports.
The %CPCHART macro creates the following three bar chart types:
  • one analysis column and one class column (Example 1)
  • one analysis column, one class column, and one group column (Example 2)
  • one analysis column, one class column, and one subgroup column (Example 3)
The %CPCCHRT macro creates the following four bar chart types:
  • multiple analysis columns (Example 4)
  • multiple analysis columns and one group column (Example 5)
  • multiple analysis columns, one group column, and one subgroup column (Example 6)
  • multiple analysis columns, one group column, and one stack column (Example 7)
The %CPCHART macro creates a pie chart of one analysis column and one class column (Example 8).
The %CPCCHRT macro creates a pie chart type of multiple analysis columns (Example 9).
The following sections show how to re-create these bar chart and pie chart types using SAS Enterprise Guide.

Bar Chart and Pie Chart Notes

Here are some notes that you might consider when working with bar charts and pie charts:
  • Do not confuse the Group bars by role that is available in some chart tasks, with the Group charts by role. The Group charts by role is a role that is available in most report tasks. It enables you to create a different report page for each value of the Group charts by column.
  • The Transpose task can be substituted for the Stack Columns task. For more information about the differences between the Stack Columns task and the Transpose task, see SAS Enterprise Guide Help.
  • The graph examples in the following sections typically show two analysis columns wherever multiple analysis columns are supported.
  • Some graph titles might refer to SAS IT Resource Management 2.7 terminology to help you make the transition from 2.7 to 3.2. For example, a class column that is assigned to a subgroup role in 2.7 might be assigned to a stack role in 3.2 to achieve the same results.

Example 1

Bar Chart with One Analysis Column and One Class Column

Bar Chart with One Analysis Column and One Class Column
  1. Select the Bar Chart task.
  2. Select the Simple Vertical Bar chart type.
  3. Assign one analysis column to the Sum of role.
  4. Assign one class column to the Column to chart role.
  5. (Optional) Assign one or more class columns to the Group charts by role.

Example 2

Bar Chart with One Analysis Column, One Class Column, and One Group Column

Bar Chart with One Analysis Column, One Class Column, and One Group Column
  1. Select the Bar Chart task.
  2. Select the Grouped Vertical Bar chart type.
  3. Assign one analysis column to the Sum of role.
  4. Assign one class column to the Column to chart role.
  5. Assign one class column to the Group bars by role.
  6. (Optional) Assign one or more class columns to the Group charts by role.

Example 3

Bar Chart with One Analysis Column, One Class Column, and One Subgroup Column

Bar Chart with One Analysis Column, One Class Column, and One Subgroup Column
  1. Select the Bar Chart task.
  2. Select the Stacked Vertical Bar chart type.
  3. Assign one analysis column to the Sum of role.
  4. Assign one class column to the Column to chart role.
  5. Assign one class column to the Stack role.
  6. (Optional) Assign one or more class columns to the Group charts by role.

Example 4

Bar Chart with Two Analysis Columns

Bar Chart with Two Analysis Columns
  1. Select the Bar Chart task.
  2. Select the Multiple Measures Vertical Group chart type.
  3. Assign the columns that you want to chart to the Sum of role.
  4. (Optional) Assign one or more class columns to the Group charts by role.

Example 5

Bar Chart with Two Analysis Columns and One Group Column

Bar Chart with Two Analysis Columns and One Group Column
  1. Select the Bar Chart task.
  2. Select the Multiple Measures Vertical Group chart type.
  3. Assign the columns that you want to chart to the Sum of role.
  4. Assign one class column to the Column to chart role.
  5. (Optional) Assign one or more class columns to the Group charts by role.

Example 6

Bar Chart with Two Analysis Columns, One Group Column, and One Subgroup Column

Bar Chart with Two Analysis Columns, One Group Column, and One Subgroup Column
  1. Select the Stack Columns task located in the Data category to transpose your data.
  2. Assign the two analysis columns that you want to chart to the Columns to Stack role.
  3. Assign all of the class columns used in your report (including Group charts by columns) to the Group Analysis by role.
  4. Rename your new column labels. For information about how to do this, see Stack Columns Task (Reference 1).
  5. Run the Stack Columns task to transpose your data.
  6. Select the Bar Chart task.
  7. Select the Grouped/Stacked Vertical Bar chart type.
  8. Assign the new transposed analysis column to the Sum of role.
  9. Assign the new transposed class column to the Column to chart role.
  10. Assign one class column to the Group bars by role.
  11. Assign one class column to the Stack role.
  12. (Optional) Assign one or more class columns to the Group charts by role.
Note: The difference between this bar chart example and Example 7 is in the column role assignments.

Example 7

Bar Chart with Two Analysis Columns, One Group Column, and One Stack Column

Bar Chart with Two Analysis Columns, One Group Column, and One Stack Column
  1. Select the Stack Columns task located in the Data category to transpose your data.
  2. Assign the two analysis columns that you want to chart to the Columns to Stack role.
  3. Assign all of the class columns used in your report (including Group charts by columns) to the Group Analysis by role.
  4. Rename your new column labels. For information about how to do this, see Stack Columns Task (Reference 1).
  5. Run the Stack Columns task to transpose your data.
  6. Select the Bar Chart task.
  7. Select the Grouped/Stacked Vertical Bar or the Grouped/Stacked Horizontal Bar chart type.
  8. Assign the new transposed analysis column to the Sum of role.
  9. Assign one class column to the Column to chart role.
  10. Assign one class column to the Group bars by role.
  11. Assign the new transposed class column to the Stack role.
  12. (Optional) Assign one or more class columns to the Group charts by role.
Note: The difference between this bar chart example and Example 6 is in the column role assignments.

Example 8

Pie Chart with One Analysis Column and One Class Column

Pie Chart with One Analysis Column and One Class Column
  1. Select the Pie Chart task.
  2. Select the Simple Pie chart type.
  3. Assign one analysis column to the Sum of role.
  4. Assign one class column to the Column to chart role.
  5. (Optional) Assign one or more class columns to the Group charts by role.

Example 9

Pie Chart with Two Analysis Columns

Pie Chart with Two Analysis Columns
  1. Select the Stack Columns task located in the Data category to transpose your data.
  2. Assign the two analysis columns that you want to chart to the Columns to Stack role.
  3. Assign all of the class columns used in your report (including Group charts by columns) to the Group Analysis by role.
  4. Rename your new column labels. For information about how to do this, see Stack Columns Task (Reference 1).
  5. Run the Stack Columns task to transpose your data.
  6. Select the Pie Chart task.
  7. Select the Simple Pie chart type.
  8. Assign the new transposed analysis column to the Sum of role.
  9. Assign the new transposed class column to the Column to chart role.
  10. (Optional) Assign one or more class columns to the Group charts by role.