BookmarkSubscribeRSS Feed
eduar78
Calcite | Level 5
What is the following section accomplishing? 
PROC TABULATE DATA = new FORMAT=DOLLAR11. STYLE={BACKGROUND=WHITE FOREGROUND=BLUE JUST=CENTER};
   CLASS productName  year mnth;
   VAR productSales;
   KEYLABEL ALL='Totals';
   TABLE productName = '' ALL, ((year='Year'*mnth='Month' ALL)*productSales='' *SUM='');
RUN;

What is the following section accomplishing?

2 REPLIES 2
ballardw
Super User

Your best answer would be to run the code with a data set.

No section "section below" was provided so no response.

 

It would really help to indicate which parts you have questions about.

In general this is producing summary rows based on the Product name variable values with columns of mnth nested under year plus a year total..

Each cell represents the sum of the productsales variable for the intersection of productname and year/mnth (or year/all) combination.

the All will provide a row at the bottom for a total of all productname categorires

Cynthia_sas
Diamond | Level 26

Hi:

  Imagine that you have data like this:

3 values for the PRODUCT variable: Dress, Sandal and Slipper

1 value for the YEAR variable: 2018

3 values for the MNTH variable: 4, 5, 6

a SALES variable

 

  Your code would produce a table like this:

 

tabulate_syntax.png.

 

You have code that produces a 2 dimensional table. The specification before the comma in the TABLE statement tells PROC TABULATE how to structure the ROW dimension. The specification AFTER the comma in the TABLE statement tells PROC TABULATE how to structure the COLUMN dimension. The ALL has been used in both dimensions for the end of row grand total and the end of column grand totals.

 

If you are going to post code, it helps to post data with the code. If you can't post your data, then make up some fake data or use one of the SASHELP datasets.

 

Hope this helps,

Cynthia

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 2 replies
  • 982 views
  • 0 likes
  • 3 in conversation