The SAS Output Delivery System and reporting techniques

selected summarizations on PROC REPORT

Reply
Super Contributor
Posts: 318

selected summarizations on PROC REPORT

Hi,

I have this sample dataset. What I want to happen on my proc report is that I on the row for the totals,  I only want a value displayed for the column two and column one should not have a summary value. Is this possible? Please see script below and current and desired results. Thanks!

data test;

    input nm $ one two;

    datalines;

one 1 10

two 2 20

three 3 30

;

proc report data=test;

    column nm one two ;

    define nm / display;

    define one / analysis sum;

    define two / analysis sum;

    rbreak after / summarize;

    compute after;

        if _break_ = '_RBREAK_' then do;

            nm = 'Total';

        end;

    endcomp;

run;

quit;

Current Output

nmonetwo
one110
two220
three330
total660

Desired Output

nmonetwo
one110
two220
three330
total
60
SAS Super FREQ
Posts: 8,743

selected summarizations on PROC REPORT

Hi:

  If variable ONE has a usage of SUM ANALYSIS, it will be summarized during break processing. If variable ONE has a usage of DISPLAY, it will NOT be summarized at break processing. This is a simple fix and understanding the difference between DISPLAY and SUM is fundamental to how PROC REPORT decides which columns get summarized or not.

cynthia

Super User
Posts: 9,681

selected summarizations on PROC REPORT

Sure. Of course.

data test;
    input nm $ one two;
    datalines;
one 1 10
two 2 20
three 3 30
;
run;

 
option missing='';
proc report data=test  nowd;
    column nm one two ;
    define nm / display;
    define one / analysis sum;
    define two / analysis sum;
    rbreak after / summarize;
    compute after;
        if _break_ = '_RBREAK_' then do;
            nm = 'Total'; call missing(one.sum);
        end;
    endcomp;
run;

Ksharp

Ask a Question
Discussion stats
  • 2 replies
  • 144 views
  • 0 likes
  • 3 in conversation