Table of Contents
“SAS is a powerful statistical software that allows users to efficiently create visual representations of data, such as pie charts. To create a pie chart in SAS, users can utilize the PROC GCHART procedure, which offers a variety of customizable options for creating high-quality and informative pie charts. With the ability to input data directly from SAS datasets, users can easily generate pie charts that accurately display the distribution of categorical variables. Additionally, SAS provides comprehensive documentation and user support to assist in creating visually appealing and informative pie charts for effective data analysis.”
Create Pie Charts in SAS (4 Examples)
You can use the PIE statement within PROC GCHART in SAS to create pie charts.
The following examples show how to create four different types of pie charts using the following dataset that contains information about various basketball players:
/*create dataset*/
data my_data;
input team $ points;
datalines;
Mavs 14
Mavs 22
Mavs 19
Mavs 31
Heat 14
Heat 25
Warriors 31
Warriors 35
Warriors 36
Jazz 29
;
run;
/*view dataset*/
proc printdata=my_data;

Example 1: Create Pie Chart of Frequencies
The following code shows how to create a pie chart that displays the frequency of each unique value in the team column:
proc gchartdata=my_data;
pie team;
run;
quit;
The slices in the pie chart represent the frequency of each unique value in the team column.
Example 2: Create Pie Chart of Sums
The following code shows how to use the SUMVAR statement to create a pie chart that displays the sum of values in the points column for each unique value in the team column:
proc gchartdata=my_data;
pie team / sumvar=points;
run;
quit;
The slices in the pie chart represent the sum of values in the points column for each unique value in the team column.
Example 3: Create Pie Chart with Exploding Slice
The following code shows how to use the EXPLODE statement to create a pie chart that displays the sum of values in the points column for each unique value in the team column with a particular slice “exploded” away from the other slices:
proc gchartdata=my_data;
pie team / sumvar=points explode='Jazz';
run;
quit;
Notice that the slice for the Jazz has been exploded away from the other slices.
This can be particularly useful if you want to create a pie chart and make one of the slices stand out for some reason.
Example 4: Create Pie Chart with Custom Labels
The following code shows how to use the PLABEL statement to create a pie chart with labels that have increased font size and a red font color:
proc gchartdata=my_data;
pie team / sumvar=points plabel=(h=1.5 color=red);;
run;
quit;
Note that the h argument specified the font size and the color argument specified the font color.
The following tutorials explain how to create other charts in SAS:
Cite this article
stats writer (2024). How can I create pie charts in SAS?. PSYCHOLOGICAL SCALES. Retrieved from https://scales.arabpsychology.com/stats/how-can-i-create-pie-charts-in-sas/
stats writer. "How can I create pie charts in SAS?." PSYCHOLOGICAL SCALES, 23 Jun. 2024, https://scales.arabpsychology.com/stats/how-can-i-create-pie-charts-in-sas/.
stats writer. "How can I create pie charts in SAS?." PSYCHOLOGICAL SCALES, 2024. https://scales.arabpsychology.com/stats/how-can-i-create-pie-charts-in-sas/.
stats writer (2024) 'How can I create pie charts in SAS?', PSYCHOLOGICAL SCALES. Available at: https://scales.arabpsychology.com/stats/how-can-i-create-pie-charts-in-sas/.
[1] stats writer, "How can I create pie charts in SAS?," PSYCHOLOGICAL SCALES, vol. X, no. Y, ص Z-Z, June, 2024.
stats writer. How can I create pie charts in SAS?. PSYCHOLOGICAL SCALES. 2024;vol(issue):pages.
