Help using Base SAS procedures

Proc Report help

Accepted Solution Solved
Reply
N/A
Posts: 1
Accepted Solution

Proc Report help

Can anyone tell me the proc report version of the following code?

proc tabulate data=abc;

class rule1 rule2 rule3;

var profit;

table rule1 rule2 rule3, profit*sum;

run;

Here rule1,rule2 and rule3 are binary variables with values 0,1. profit is continuous variable.

Thanks in advance..



Accepted Solutions
Solution
‎07-15-2013 07:03 PM
SAS Super FREQ
Posts: 8,868

Re: Proc Report help

Hi,

  With TABULATE, you are "stacking" the table for RULE1 on top of the table for RULE2 on top of the table for RULE3. This is a unique capability of PROC TABULATE. It really doesn't matter that your "RULE" variables are binary variables or not. For example, look at this output from TABULATE where the variables shown in the row dimension are NOT binary variables. PROC TABULATE is stacking the table for COUNTRY on top of the table for PRODUCT, on top of the table for DIVISION.

  There is no direct PROC REPORT ability such as TABULATE has to "stack" items in the row dimension of a table. You would have to restructure your data to even come close to what TABULATE is doing. For example, PROC REPORT would not be able to do this type of report, such as I shown in the screen shot, without restructuring the data in SASHELP.PRDSALE.

cynthia


tabulate_stacking_example.png

View solution in original post


All Replies
Solution
‎07-15-2013 07:03 PM
SAS Super FREQ
Posts: 8,868

Re: Proc Report help

Hi,

  With TABULATE, you are "stacking" the table for RULE1 on top of the table for RULE2 on top of the table for RULE3. This is a unique capability of PROC TABULATE. It really doesn't matter that your "RULE" variables are binary variables or not. For example, look at this output from TABULATE where the variables shown in the row dimension are NOT binary variables. PROC TABULATE is stacking the table for COUNTRY on top of the table for PRODUCT, on top of the table for DIVISION.

  There is no direct PROC REPORT ability such as TABULATE has to "stack" items in the row dimension of a table. You would have to restructure your data to even come close to what TABULATE is doing. For example, PROC REPORT would not be able to do this type of report, such as I shown in the screen shot, without restructuring the data in SASHELP.PRDSALE.

cynthia


tabulate_stacking_example.png
🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 1 reply
  • 161 views
  • 0 likes
  • 2 in conversation