data test;
length ctr $25.;
infile datalines;
input ctr $ Division $ cnt cnt2;
return;
datalines;
Timely Central 5 15
Timely Northern 1 12
Not_Timely Central 3 154
Timely Atlantic 15 66
Not_Timely Atlantic 1 66
Not_Timely Atlantic 2 66
Timely Central 25 66
Timely Central 6 666
Timely Northern 11 42
;
run;
proc report = test nowd style(summary)=Header;
column ctr Division cnt cnt2 rtot;
define ctr /group ;
define Division /group ;
define cnt /sum f=comma6.;
define cnt2 /sum f=comma6.;
define RTot /computed f=comma16. "Row Totals";
compute RTot;
RTot=sum(cnt.sum,cnt2.sum);/*row_tot*/
endcomp;
compute before;
sum=cnt.sum;
sum=cnt2.sum;
endcomp;
compute after;
ctr='Grand Total';
endcomp;
rbreak after /summarize;
run;
I want to place a group total after ctr changes. There are two possibilities (timely and not_timely) I want to place row total after each instance
Add next line before the rbreak line:
break after ctr / ol summarize skip;
Add next line before the rbreak line:
break after ctr / ol summarize skip;
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.