The SAS Output Delivery System and reporting techniques

Advantages of Proc Report vs proc tabulate

Posts: 69

Advantages of Proc Report vs proc tabulate

Can anyone tell me what exactly is the difference between Proc Report and Proc Tabulate?
Posts: 8,744

Re: Advantages of Proc Report vs proc tabulate

Proc Tabulate only produces summary reports, based on class and analysis variables. These summary reports are always tabular in structure, with 3 possible dimensions -- page, row and column dimension.

Proc Report produces both "detail" and summary reports. A detail report is a report where one report row represents one observation from the input data set. A summary report is a report where one report row represents a group of observations. Both detail reports and summary reports can have inter-group or overall report summary lines added to the report.

For example, if you have 100 employees spread across 3 states and 5 departments, a report that listed each employee and their salary would be a DETAIL report. It would have at least 100 report rows if you picked all employees. On the other hand, a summary report of average salaries for each state would NOT have 100 report rows -- it would only have 3 report rows -- one for each state. Or if you summarized by STATE and DEPARTMENT, you might have one row for every unique combination of STATE and DEPARTMENT, but not more than 15 (3 states *5 departments), unless you added summary rows (total for each state, total for each department or overall total) to the report.

There are too many features of each procedure to list here. It takes a 3 day class to provide thorough coverage of ODS, PROC TABULATE and PROC REPORT. I suggest you take some familiar data and experiment with REPORT versus TABULATE syntax. Or, you can search for more papers like these:

Posts: 0

Re: Advantages of Proc Report vs proc tabulate

Proc tabulate produces cross tabular reports and proc report produces simple table reports.

I tend to create a lot of reports which involve calculations based on other columns within the report. This is tricky to do in proc tabulate or sometimes impossible. Proc report gives you the ability to use the compute syntax allowing you to do calculations.

Having said this i tend to summarize a lot of my data in proc report, output a data table then turn this round into a proc tabulate if you want a cross tabulate report.

Hope this helps make up your mind, but both reports offer different things you just need to think about how your data is organized to start with and how complex calculations are that you need.
Posts: 8,744

Re: Advantages of Proc Report vs proc tabulate

PROC REPORT also supports cross-tabular table creation with the ACROSS usage in the DEFINE statement. As you can see, both procedures are capable of producing the same cross-tabular report. The fact is that for simple cross-tabs, you could use either procedure. For more complicated cross-tabs -- where there are a LOT of nestings in the row and column dimension, my tendency is to use PROC TABULATE.


proc sort out=shoes;
by region product;
where region in ('Asia', 'Canada', 'Pacific') and
product contains 'Dress' or product contains 'Casual';

ods listing close;
ods html file='c:\temp\report_cross.html' style=sasweb;
proc report data=shoes nowd
title '1) With Proc Report';
column region product,(sales returns) ('Total' sales=totsales returns=totreturns);
define region /group style(column)=Header;
define product / across;
define sales / sum 'Sales';
define returns / sum 'Returns';
define totsales / sum 'Sales';
define totreturns / sum 'Returns';
rbreak after / summarize;
compute after;
region = 'Total';

proc tabulate data=shoes f=dollar14.0;
title '2) With Proc Tabulate';
class region product;
var sales returns;
table region all*{s=Header},
product*(sales returns) all*(sales returns) /
keylabel sum=' '
all = 'Total';
label sales = 'Sales'
returns = 'Returns';

ods html close;
Ask a Question
Discussion stats
  • 3 replies
  • 3 in conversation