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;
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;
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.