BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
bs0409
Calcite | Level 5

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..


1 ACCEPTED SOLUTION

Accepted Solutions
Cynthia_sas
Diamond | Level 26

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

1 REPLY 1
Cynthia_sas
Diamond | Level 26

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

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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