BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
djbateman
Lapis Lazuli | Level 10

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;
1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

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."
       }

View solution in original post

2 REPLIES 2
Tom
Super User Tom
Super User

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."
       }
djbateman
Lapis Lazuli | Level 10

That did the trick!  There seem to be too many options.  I wish it was more consistent.  But thank you for your help!

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

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!

Register now

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 3589 views
  • 0 likes
  • 2 in conversation