I am trying to add a simple summary line to my report. I am sure this will be an easy fix.
I have a list of races and counts per race. I want to add a line that says "Total" in the race column and the sum of the counts in the count column. I also want that total line to be bold. Here is what I have attempted. I can't get the "Total" text to appear, and I don't know where to start to make it bold.
data race;
input race $ count;
flag='x';
cards;
White 1006
Asian 28
Black 98
Other 4
Unknown 20
;
run;
proc report data=race nowindows;
column flag race count;
define flag / group noprint;
define race / display left 'Racial Group';
define count / sum 'Number of Subjects';
break after flag / summarize;
compute after flag;
race='Total';
endcomp;
run;
Desired outcome:
Racial Group | Number of Subjects |
---|---|
White | 1006 |
Asian | 28 |
Black | 98 |
Other | 4 |
Unknown | 20 |
Total | 1156 |
You can use RBREAK and omit the dummy variable.
You can use CALL DEFINE.
You can use RBREAK and omit the dummy variable.
Hi,
Even more streamlined syntax, without using CALL DEFINE is possible.
cynthia
ods html file='c:\temp\total.html' style=sasweb;
proc report data=race nowd
style(summary)={font_weight=bold foreground=green};
column race count;
define race / display left 'Racial Group';
define count / sum 'Number of Subjects';
rbreak after / summarize;
compute after;
race='Total';
endcomp;
run;
ods html close;
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!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.