How do I use Proc Report in SAS? (With Examples)

Proc Report is a SAS procedure used to create reports from data stored in SAS data sets. It provides a flexible way to create reports that include titles, statistics, tables, and even graphics. It can also be used to summarize data in a variety of ways, such as finding averages, counts, and maximum and minimum values. To use Proc Report, you must first specify the data set you are using, the columns you want to display, and the order in which you want the columns to appear. You can also specify the order in which you want to sort the data and then use the “break” statement to group and summarize the data based on the criteria you set. For example, if you wanted to calculate the average salary for each department, you could use Proc Report to group the data by department and then calculate the average salary for each department.


You can use proc report in SAS to generate a report for a dataset in SAS with the exact formatting that you’d like.

This procedure uses the following basic syntax:

/*create report*/
proc report data=my_data;
run;

This will generate a report that displays the rows in a dataset exactly as they appear.

However, you can customize the output of the report in a variety of ways.

For example, we can use the following syntax to create a more customized report:

/*create customized report*/
title 'Player Statistics for Dallas Mavericks';
proc report data=my_data;
   where team='Mavs';
   column conf team points;
   define conf / display 'Conference' center;
run;

Here’s what each statement does:

  • title creates a title for the report
  • where filters the dataset to only contain rows where team is ‘Mavs’
  • column specifies which columns to display in the report in a certain order
  • display specifies the title to use for the column called conf and center specifies the text to be centered in the column

The following example shows how to use proc report in practice.

Note: Refer to the for a complete explanation of all the ways you can customize a report.

Example: Using Proc Report in SAS

Suppose we have the following dataset in SAS that contains information about various basketball players:

/*create dataset*/
data my_data;
    input team $ points rebounds conf $;
    datalines;
Celtics 12 5 East
Celtics 14 7 East
Celtics 15 8 East
Celtics 18 13 East
Mavs 31 12 West
Mavs 32 6 West
Mavs 35 4 West
Mavs 36 10 West
Mavs 40 12 West
;
run;

/*view dataset*/
proc print data=my_data;

We can use proc report in the following manner to print the entire dataset as it appears:

/*create report that displays entire dataset*/
proc report data=my_data;
run;

The report simply contains the entire dataset.

However, we can use proc report to generate a customized report by using the following syntax:

/*create customized report*/
title 'Player Statistics for Dallas Mavericks';
proc report data=my_data;
   where team='Mavs';
   column conf team points;
   define conf / display 'Conference' center;
run;

Notice that this report contains the following differences compared to the original report:

  • This report has a title
  • This report only contains rows where team is ‘Mavs’
  • This report only contains the conf, team, and points columns
  • This report uses ‘Conference’ as the title for conf and center-aligns the values in the conf column

This is just a simple example of how to create a customized report using proc report in SAS.

Feel free to explore the to see how you can further customize the output and generate a report that appears exactly how you’d like in SAS.

The following tutorials explain how to perform other common tasks in SAS:

x