Table of Contents
Proc Tabulate is a powerful tool in SAS that allows users to create highly customizable tables for data analysis and reporting purposes. It offers a variety of options for organizing and summarizing data, such as grouping, sorting, and calculating statistics. With Proc Tabulate, users can easily compare and contrast different variables, identify patterns and trends, and present data in a clear and concise manner. Some examples of utilizing Proc Tabulate in SAS include creating frequency tables, contingency tables, and summary tables for descriptive statistics. It can also be used for creating pivot tables, which allow for dynamic rearrangement of data for deeper analysis. Additionally, Proc Tabulate can be used for creating custom reports by incorporating formatting options, labels, and titles. Overall, Proc Tabulate is a versatile and efficient tool for data manipulation and presentation in SAS.
Use Proc Tabulate in SAS (With Examples)
You can use proc tabulate in SAS to quickly display for one or more variables in a tabular format.
The following examples show how to use this procedure with the following dataset that shows the total points scored by 12 different basketball players:
/*create dataset*/
data my_data;
input team $ position $ points;
datalines;
A Guard 15
A Guard 12
A Guard 29
A Forward 13
A Forward 9
A Forward 16
B Guard 25
B Guard 20
C Guard 34
C Forward 19
C Forward 3
C Forward 8
;
run;
/*view dataset*/
proc printdata=my_data;

Example 1: Proc Tabulate with One Variable
We can use the following code to calculate descriptive statistics for the points variable:
/*create table that displays descriptive stats for points variable*/
proc tabulatedata=my_data;
var points;
table points * (N Min Q1 Median Mean Q3 Max);
run;
Note: The values inside the parenthesis tell SAS which descriptive statistics to calculate for points.
Here are some of the most commonly used descriptive statistics:
- N: The total number of observations
- Min: The minimum value
- Q1: The value for the first quantile (i.e. the 25th percentile)
- Median: The median value
- Mean: The mean value
- Q3: The value for the third quantile (i.e. the 75th percentile)
- Max: The maximum value
From the output we can see:
- The total observations is 12.
- The minimum value for points is 3.
- The number of points at the 25th percentile is 10.5.
- The median number of points is 15.5.
- The mean number of points is 16.92.
- The number of points at the 75th percentile is 22.5.
- The maximum number of points is 34.
From these five values we can gain a pretty good understanding of the distribution of values for the Weight variable.
Example 2: Proc Tabulate with Two Variables
We can use the following code to calculate descriptive statistics for the points variable, grouped by the team variable:
/*create table that displays descriptive stats for points, grouped by team*/
proc tabulatedata=my_data;
class team;
var points;
table team, points * (N Min Q1 Median Mean Q3 Max);run; 
The resulting table shows the descriptive statistics of points for each of the three teams.
For example:
- Team A has 6 observations.
- The minimum value for points on team A is 9.
- The number of points on team A at the 25th percentile is 12.
- The median number of points on team A is 14.
And so on.
Example 3: Proc Tabulate with Three Variables
We can use the following code to calculate descriptive statistics for the points variable, grouped by the team and position variables:
/*create table that shows descriptive stats for points, grouped by team and position*/
proc tabulatedata=my_data; class team position;
var points;
table team, position * points * (N Min Q1 Median Mean Q3 Max);
run;
The resulting table shows the descriptive statistics for points, grouped by team and position.
Note that the cells for team “B” and position “Forward” are empty because there were no players on team B who had a position of Forward.
Additional Resources
The following tutorials explain how to perform other common tasks in SAS:
Cite this article
stats writer (2024). How can I utilize Proc Tabulate in SAS? Can you provide some examples?. PSYCHOLOGICAL SCALES. Retrieved from https://scales.arabpsychology.com/stats/how-can-i-utilize-proc-tabulate-in-sas-can-you-provide-some-examples/
stats writer. "How can I utilize Proc Tabulate in SAS? Can you provide some examples?." PSYCHOLOGICAL SCALES, 1 Jul. 2024, https://scales.arabpsychology.com/stats/how-can-i-utilize-proc-tabulate-in-sas-can-you-provide-some-examples/.
stats writer. "How can I utilize Proc Tabulate in SAS? Can you provide some examples?." PSYCHOLOGICAL SCALES, 2024. https://scales.arabpsychology.com/stats/how-can-i-utilize-proc-tabulate-in-sas-can-you-provide-some-examples/.
stats writer (2024) 'How can I utilize Proc Tabulate in SAS? Can you provide some examples?', PSYCHOLOGICAL SCALES. Available at: https://scales.arabpsychology.com/stats/how-can-i-utilize-proc-tabulate-in-sas-can-you-provide-some-examples/.
[1] stats writer, "How can I utilize Proc Tabulate in SAS? Can you provide some examples?," PSYCHOLOGICAL SCALES, vol. X, no. Y, ص Z-Z, July, 2024.
stats writer. How can I utilize Proc Tabulate in SAS? Can you provide some examples?. PSYCHOLOGICAL SCALES. 2024;vol(issue):pages.
