The SAS Output Delivery System and reporting techniques

Proc Report: Summarize only certain groups

Reply
Frequent Contributor
Posts: 96

Proc Report: Summarize only certain groups

[ Edited ]

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;

 

Super User
Posts: 9,856

Re: Proc Report: Summarize only certain groups

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

Ask a Question
Discussion stats
  • 1 reply
  • 227 views
  • 0 likes
  • 2 in conversation