BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
ahnungslos
Calcite | Level 5

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

1 ACCEPTED SOLUTION

Accepted Solutions
data_null__
Jade | Level 19

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

2 REPLIES 2
data_null__
Jade | Level 19

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;

Ksharp
Super User

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

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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