BookmarkSubscribeRSS Feed
morglum
Quartz | Level 8

Hi everyone,

I would like to add a "group total" row, but only for groups that have more than one row.

 

For example, I would like to remove the total row for group 3 below.

 

 

How can I do this?

Thanks

 

 

data test;
  infile datalines dlm=',' dsd;
  input group user sales ;
return;
datalines;
1,1,1
1,2,2
1,3,5
2,4,3
2,5,3
2,6,4
3,7,4
;
run;

proc report data=test;
columns group user sales;
define group / group;
define user /display;
define sales / analysis sum;
break after group /summarize;

run; quit;

 

1 REPLY 1
Ksharp
Super User

Not in this way , But for Line statement.

 

 

data test;
  infile datalines dlm=',' dsd;
  input group user sales ;
return;
datalines;
1,1,1
1,2,2
1,3,5
2,4,3
2,5,3
2,6,4
3,7,4
;
run;
proc report data=test nowd;
columns group user sales;
define group / group;
define user /display;
define sales / analysis sum;
compute after group;
len=ifn(group=3,0,100);
text='Total:'||repeat(' ',40)||put(sales.sum,best10. -l);
line  text $varying100. len;
endcomp;
run; 

 

x.png

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 1752 views
  • 0 likes
  • 2 in conversation