The SAS Output Delivery System and reporting techniques

Differences between Proc Report and Proc Tabulate

Posts: 69

Differences between Proc Report and Proc Tabulate

Could any tell me the major differences between Proc Report and Proc Tabulate.
And also how could i highlight a cell using proc report and proc tabulate.

Thanks & Regards,
Posts: 9,371

Re: Differences between Proc Report and Proc Tabulate

Posted in reply to Siddhartha
Proc Report and Proc Tabulate can both be used to create summary tables. Proc Report has the added feature of being able to create detail tables, as well. Proc Report has some of the power of a DATA step program, in that REPORT allows you to calculate a new report item (like BONUSAMT) in a COMPUTE block -- something which TABULATE will not do.

It's easier, or maybe just different, to get many crossings in the row and column dimension with TABULATE. TABULATE produces 3 dimensions of reports -- PAGE, ROW and COLUMN dimension using a TABLE statement along with a CLASS and VAR statement. REPORT does everything with a COLUMN statement and DEFINE statements, along with COMPUTE blocks.

With PROC REPORT, you can write lines between groups (such as "Good job on Sales this quarter, Department 99" or "Focus on improving sales, Department 45") with the LINE statement-- whereas with TABULATE, you cannot do this.

The following code example shows approximately the same table for both REPORT and TABULATE, the basic highlighting of PREDICT and ACTUAL is done, in this case, with a user-defined format. With PROC REPORT, you could also highlight a cell, or an entire row using the CALL DEFINE statement, too.

proc format;
value salef 21000-22000 = 'yellow'
22000<-23000 = 'pink';

ods listing close;

ods html file='hilight.html' style=sasweb;

title 'Proc Report';
proc report data=sashelp.prdsale nowd;
column country product region,('Sales' predict actual);
define country /group;
define product /group;
define region /across ;
define predict / sum 'Predicted'
define actual /sum 'Actual'
rbreak after / summarize;

title 'Proc Tabulate';
proc tabulate data=sashelp.prdsale f=dollar12.2;
class country region product;
var predict actual ;
table country * product all,
region*Sum*(predict actual)*{s={background=salef.}};
keylabel Sum='Sales'
ods html close;
Not applicable
Posts: 0

Re: Differences between Proc Report and Proc Tabulate

Posted in reply to Cynthia_sas

How do you format the ALL='Total' statement in your proc tabulate?

I have ALL='Total Congestion Revenue' but cannot figure out how to adjust the font_size. Thanks for any help. I'm sure this is a drop in a bucket for some around here. I am new to this...

B Message was edited by: BS_CISO
Posts: 9,371

Re: Differences between Proc Report and Proc Tabulate

Posted in reply to deleted_user
There are 2 different ways to change the ALL summary:
1) change the header for "all"
2) change the data cells for the summary

table country * product all *{s={font_size=16pt background=yellow}},
region*Sum*(predict actual)*{s={background=salef.}}
/ style_precedence=row;
keylabel Sum='Sales'
keyword ALL / style={background=purple foreground=white};

The KEYWORD statement will change the style of the header label for ALL and the style in the table statement (crossed with ALL) will change the data cells in the summary produced by ALL. In addition, since the style crossing happens in the row dimension, you want the style of the row to take precedence over the style of the column -- for the cell where row and column intersect.

Ask a Question
Discussion stats
  • 3 replies
  • 3 in conversation