I am writing a report to an RTF file using ODS RTF. I was using PDF, but it was decided that the client wanted RTF. I am using a PRETEXT statement in PROC REPORT. However, when I was using ODS PDF, I simply put "~n" to get a new line in the pretext text (where the tilda is my escapechar). When I switch to RTF, that doesn't seem to work. I just prints "~n" along with the regular text in a single line. Is there something different I should be using? I have tried /line/ and ~{newline}. Neither seems to work. Any ideas?
/*****************************************/
/*** Create the SAS log error report ***/
/*****************************************/
ods escapechar='~';
ods listing close;
ods rtf file="&outputdir.\ZCHECKLOG.rtf" style=MonoChromePrinter;
title1 h=0.5 j=l 'Vertex Pharmaceuticals Incorporated' j=r 'Page ~{thispage}';
proc report data=final_t center nowindows headline headskip spacing=1 split='^' missing
style(header)={fontsize=9pt} style(report)={font=('Arial',9pt,bold italic) pretext="SAS Log Report for Directory ~n &logdir. ~n Run Date: &sysdate9."};
column filename cat1 cat2 cat3 cat4 cat5;
define filename / order order=data width=45 left "File Name";
define cat1 / display center width=5 "Errors";
define cat2 / display center width=5 "Warnings";
define cat3 / display center width=5 "Uninitialized^Variables";
define cat4 / display center width=5 "Merge^Notes";
define cat5 / display center width=5 "Invalid^Data";
compute cat1;
if cat1>0 then call define(_col_,"style","style={background=red}");
endcomp;
compute cat2;
if cat2>0 then call define(_col_,"style","style={background=red}");
endcomp;
compute cat3;
if cat3>0 then call define(_col_,"style","style={background=yellow}");
endcomp;
compute cat4;
if cat4>0 then call define(_col_,"style","style={background=yellow}");
endcomp;
compute cat5;
if cat5>0 then call define(_col_,"style","style={background=yellow}");
endcomp;
run;
ods rtf close;
ods listing;
RTF commands start with backslash. Try \line.
style(report)={font=('Arial',9pt,bold italic)
pretext="SAS Log Report for Directory{\line}&logdir.{\line}Run Date: &sysdate9."
}
RTF commands start with backslash. Try \line.
style(report)={font=('Arial',9pt,bold italic)
pretext="SAS Log Report for Directory{\line}&logdir.{\line}Run Date: &sysdate9."
}
That did the trick! There seem to be too many options. I wish it was more consistent. But thank you for your help!
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.