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?
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
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:
.
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
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Get started using SAS Studio to write, run and debug your SAS programs.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.