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
SAS Super FREQ

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
SAS Super FREQ

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

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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