I want to add a topline above "TRT" row for the table. I tried style(report) and style(header), they both did not add the line in the correct position. Here is my program:
ods rtf file='c:\temp\temp.rtf' startpage=no style=journal bodytitle; proc report data=final nowindows headline headskip split = '|' missing style(report)={FONTSIZE = 10pt} ; column trt tptn tpt ("(*ESC*)S={borderbottomcolor=black borderbottomwidth=2} TRT" n3 mean3 sd3 median3 min3 max3 GeomMean3 CV3); define trt/group noprint; define tptn/order order=internal noprint; define tpt/group "Time Point" style=[just=l cellwidth=15%]; ..... run; ods rtf close.
and my table looks like
What I want is
How should I modify the program? Thank you.
data class;
set sashelp.class;
length agegr1 $7;
if age<13 then agegr1 = '<13';
else if age < 15 then agegr1 = '13-<15';
else agegr1='>=15';
run;
proc sort data=class;
by agegr1;
run;
data final;
set class;
by agegr1;
if first.agegr1 then page+1;
run;
ods rtf file="./temp.rtf" style=RTFStyle;
PROC REPORT data=final headline headskip nowd split="~" spacing=0 missing
style(header) = {vjust = middle font_size = 8pt font_face="Courier New"}
style(column) = {just=l vjust = middle font_size = 8pt font_face="Courier New"}
style(report) = {rules = groups frame = void cellpadding = 1 font_face="Courier New"}
style(lines) = {font_size = 8pt} ;
column page name sex ("^S={borderbottomcolor=black borderbottomwidth=1} Baseline Characteristics" age height weight) agegr1;
define name / order order = internal style(header)=[just=l] style(column)=[just=l cellwidth=20%];
define page / order order = internal noprint;
define agegr1 / noprint;
define sex / style(header)=[just=l] style(column)=[just = l cellwidth=19%];
define age /style(column) = {just=c cellwidth = 20%};
define height / style(column) = {just=c cellwidth = 20%};
define weight / style(column) = {just=c cellwidth = 20%};
compute before _page_ /style=[borderbottomcolor=black borderbottomwidth=1];
len=length(agegr1);
line @1 "Age Group: " agegr1 $varying.len;
endcomp;
break after page / page;
run;
ods rtf close;
Can you try adding a style to the compute before _page_ block?
That would be better if you could post some test data.
And I could not replicate your problem by your code.
And the following code is an alternative way to get what you want.
ods rtf file='c:\temp\temp.rtf' startpage=no style=journal bodytitle;
proc report data=sashelp.heart(obs=10) nowindows headline headskip split = '|' missing
style(report)={FONTSIZE = 10pt outputwidth=100%}
;
column status sex bp_status
("(*ESC*)R'\brdrb\brdrs\brdrw15' TRT" weight height ageatstart);
define status/group noprint;
define sex/order order=internal noprint;
define bp_status/group "Time Point" style=[just=l cellwidth=15%];
run;
ods rtf close;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.