0

using the SAS help data prdsale as an example, I would like a single table showing the SUM of predicted and actual sales for each country/region. I'm happy with the final table, except I can't get a total column that sums the value of both types of products. Instead, it simply gives a COUNT of the number of observations.

(note, for this data set, there are 240 observations for each country and region)

Current code

proc tabulate data=sashelp.prdsale;
    title 'Predicted and actual sales';
    class country region prodtype;
    var predict actual;
    table country*region,
        sum='Sum predict'*predict*prodtype all="Total"
        sum='Sum actual'*actual*prodtype all="Total";
run;
title;

Result generated

I would like the total column to be a SUM for furniture + office.

Thank you

Sproodle
  • 25
  • 4

1 Answers1

0

I assume you just want to replace ALL with the actual analysis variable, PREDICT or ACTUAL.

table country*region,
    sum='Sum predict'*predict*prodtype predict*sum="Total"
    sum='Sum actual'*actual*prodtype actual*sum="Total"
;

enter image description here

Tom
  • 47,574
  • 2
  • 16
  • 29