Pie Chart Task

About the Pie Chart Task

The Pie Chart task creates pie charts that represent the relative contribution of the parts to the whole by displaying data as wedge-shaped "slices" of a circle. Each slice represents a category of data. The size of a slice represents the contribution of the data to the total chart statistic.

Example: Pie Chart That Shows Total MSRP for Each Car Type by Region

In this example, you want to compare the manufacturer’s suggested retail price (MSRP) for each car type grouped by region of origin. The resulting pie chart consists of six rings—one for each car type. The rings are then subset into the MSRP values for the three regions: Asia, Europe, and USA. Using this chart, you can compare the total MSRP values for each region. The ring for the SUV car type shows that the USA has the highest MSRP and that Europe has the lowest MSRP.
To create this example:
  1. In the Tasks section, expand the Graph folder and double-click Pie Chart. The user interface for the Pie Chart task opens.
  2. On the Data tab, select the SASHELP.CARS data set.
  3. Assign columns to these roles:
    Role
    Column Name
    Category variable
    Origin
    Response variable
    MSRP
    Group variable
    Type
  4. To run the task, click Submit SAS Code.
Here is the result:
Pie Chart

Assigning Data to Roles

You can subset the data in the input data set by applying an SQL WHERE clause. In the Where string box, enter your valid SQL syntax. Operands that are character strings must be enclosed in single or double quotation marks. To view this WHERE clause with the resulting graph, select the Include as footnote check box.
To run the Pie Chart task, you must assign a column to the Category variable role.
Option Name
Description
Role
Category variable
specifies the variable that classifies the observations into distinct subsets.
Response variable
specifies a numeric response variable for the plot.
Group variable
specifies a variable that is used to group the data.
URL 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.
Note: If the task generates an “Other” slice in the pie chart, there is not a URL associated with this slice. Therefore, this slice does not contain a link.
Orientation
Starting point
specifies where to create the first slice in the pie chart. The remaining slices appear counterclockwise.
Center the first slice
specifies whether to offset the first slice.

Setting Options

Option Name
Description
Title and Footnote
You can specify a custom title and footnote for the output. You can also specify the font size for this text.
Pie Details
Fill transparency
specifies the degree of transparency for the plot. The range is 0 (completely opaque) to 1 (completely transparent).
Data skin
specifies a special effect to be used on all filled bars.
Pie Labels
Location
specifies whether to display the label inside or outside the slice in the pie chart. By default, the Pie Chart task determines the best location for the slice.
Set label font size
enables you to specify the font size of the label for each slice.
Graph Size
You can specify the width and height of the graph in inches, centimeters, or pixels.