Help using Base SAS procedures

proc report: suppressing summarization

Accepted Solution Solved
Reply
New Contributor
Posts: 2
Accepted Solution

proc report: suppressing summarization

Is it possible to suppress the summary line when it equals the grouping result (>> Wien)?

Thank you

data t1;

land='F'; city='Paris'; value=100; output;

land='F'; city='Lyon'; value=200; output;

land='D'; city='Berlin'; value=100; output;

land='D'; city='Hamburg'; value=200; output;

land='A'; city='Wien'; value=100; output;

run;

proc report data=t1;

column land city value;

define land / group;

define city / group;

define value / sum;

break after land / summarize;

run;

Result:

land   city    value

A      Wien    100

A              100      >> I would like to suppress this row

D      Berlin  100

       Hamburg 200

D              300

F      Lyon    200

       Paris   100

F              300


Accepted Solutions
Solution
‎09-09-2011 07:23 AM
Respected Advisor
Posts: 3,799

Re: proc report: suppressing summarization

Posted in reply to ahnungslos

I'm not good with PROC REPORT, but this seems to work.

data t1;

   length land $8;

   land='F'; city='Paris'; value=100; output;

   land='F'; city='Lyon'; value=200; output;

   land='D'; city='Berlin'; value=100; output;

   land='D'; city='Hamburg'; value=200; output;

   land='A'; city='Wien'; value=100; output;

   run;

options missing=' ';

proc report data=t1 nowd list headline;

   column land city value value=n;

   define land / group;

   define city / group;

   define value / sum;

   define n / n noprint;

   break after land / summarize suppress;

   compute before land;

      rland = land;

      endcomp;

   compute after land;

      *rc = seenum(value.sum);

      *rc = seenum(n);

      msg = ' ';

      if n gt 1 then do;

         land = catx(' ',rland,'Total');

         l = 1;

         end;

      else do;

         value.sum=.;

         l=0;

         end;

      line msg $varying1. l;

      endcomp;

   run;

View solution in original post


All Replies
Solution
‎09-09-2011 07:23 AM
Respected Advisor
Posts: 3,799

Re: proc report: suppressing summarization

Posted in reply to ahnungslos

I'm not good with PROC REPORT, but this seems to work.

data t1;

   length land $8;

   land='F'; city='Paris'; value=100; output;

   land='F'; city='Lyon'; value=200; output;

   land='D'; city='Berlin'; value=100; output;

   land='D'; city='Hamburg'; value=200; output;

   land='A'; city='Wien'; value=100; output;

   run;

options missing=' ';

proc report data=t1 nowd list headline;

   column land city value value=n;

   define land / group;

   define city / group;

   define value / sum;

   define n / n noprint;

   break after land / summarize suppress;

   compute before land;

      rland = land;

      endcomp;

   compute after land;

      *rc = seenum(value.sum);

      *rc = seenum(n);

      msg = ' ';

      if n gt 1 then do;

         land = catx(' ',rland,'Total');

         l = 1;

         end;

      else do;

         value.sum=.;

         l=0;

         end;

      line msg $varying1. l;

      endcomp;

   run;

Super User
Posts: 10,020

proc report: suppressing summarization

Posted in reply to ahnungslos

Null's code is great, I almost forgot this skill. Thanks Null to remind me .

data t1;
land='F'; city='Paris'; value=100; output;
land='F'; city='Lyon'; value=200; output;
land='D'; city='Berlin'; value=100; output;
land='D'; city='Hamburg'; value=200; output;
land='A'; city='Wien'; value=100; output;
run;
options missing=' ';
proc report data=t1  nowd;
column land city value;
define land / group;
define city / group;
define value / sum;
compute  value;
 if land='A' and _break_='land' then call missing(land,city,value.sum,_break_);
endcomp;
break after land / summarize;
run;

Ksharp

🔒 This topic is solved and locked.

Need further help from the community? Please ask a new question.

Discussion stats
  • 2 replies
  • 115 views
  • 3 likes
  • 3 in conversation