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;
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—just $795!
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.
Ready to level-up your skills? Choose your own adventure.