As you can see here, the last word of lines that should fit on a single line is always put on a single line. Any idea what I can do to fix this?
ods rtf file="c:\temp\temp.rtf" ;
ods listing close;
ods html close;
title1;
OPTIONS NODATE NONUMBER;
essential sas ods pdf;
ods escapechar = '^';
proc report data=sashelp.class nowd;
column
age name
height weight;
define age / order 'Laboratory Test';
define name / display 'The Name';
define height / display 'height';
define weight / display 'weight';
run;
ods rtf text=' ' ;
ods rtf text='^S={fontsize = 8pt}Notes:' ;
ods rtf text="^S={indent=.12in fontsize = 8pt} This is the first line of notes" ;
ods rtf text=
"^S={indent=.12in fontsize = 8pt}X. This is a longer line of notes.";
ods rtf text=
"^S={indent=.12in fontsize = 8pt}X. What kind of witchcraft is this?";
ods rtf text=
"^S={indent=.12in fontsize = 8pt}X. I'm cold.";
ods rtf text=
"^S={indent=.12in fontsize = 8pt}X. This is a longer line of notes.This is a longer line of notes.This is a longer line of notes.This is a longer line of notes.This is a longer line of notes.This is a longer line of notes.This is a longer line of notes.This is a longer line of notes.This is a longer line of notes.This is a longer line of notes.This is a longer line of notes.This is a longer line of notes.This is a longer line of notes.";
ods rtf close;
It wouldn't surprise me. I don't think ods text is used that way, basically it puts a line of text out, plus all the associated tags. Why can you not use footnotes? If you have to do this, then use one ods rtf text statement and put the newlines in yourself:
ods rtf text="^S={fontsize = 8pt}Notes: Notes^{newline}^S={indent=.12in fontsize = 8pt} This is the first line of notes";
Although I still think footnotes is probably a better way to go.
It wouldn't surprise me. I don't think ods text is used that way, basically it puts a line of text out, plus all the associated tags. Why can you not use footnotes? If you have to do this, then use one ods rtf text statement and put the newlines in yourself:
ods rtf text="^S={fontsize = 8pt}Notes: Notes^{newline}^S={indent=.12in fontsize = 8pt} This is the first line of notes";
Although I still think footnotes is probably a better way to go.
Hi RW9,
Thanks for replying! It is better (no new line), but I'm not there yet as I lose the indentation.
The reason I don't want to use footnotes is that I want the notes to be right below the report, not at the bottom of the page. Also, if the report spans multiple pages, I'd rather only have the notes once, at the very end of the table.
ods rtf file="c:\temp\temp.rtf" ;
ods listing close;
ods html close;
title1;
footnote1 ;
footnote2 ;
OPTIONS NODATE NONUMBER; * enelver date et numéro de page de l output. trouvé dans 271-2012
essential sas ods pdf;
ods escapechar = '^';
*note : le truc pour les spanned header de colonnes vient de Beyond the Basics: Advanced PROC REPORT Tips and Tricks ";
proc report data=sashelp.class nowd;
column
age name
height weight;
define age / order 'Laboratory Test';
define name / display 'The Name';
define height / display 'height';
define weight / display 'weight';
run;
ods rtf text="^S={fontsize = 8pt}
^{newline}
Notes: ^{newline}
^S={indent=.12in}X. This is the first line of notes. ^{newline}
^S={indent=.12in}X. This is a longer line of notes. ^{newline}
^S={indent=.12in}X. What kind of witchcraft is this? ^{newline}
^S={indent=.12in}X. I'm cold.^{newline}
^S={indent=.12in}X. This is a longer line of notes.This is a longer line of notes.This is a longer line of notes.This is a longer line of notes.This is a longer line of notes.This is a longer line of notes.This is a longer line of notes.This is a longer line of notes.This is a longer line of notes.This is a longer line of notes.This is a longer line of notes.This is a longer line of notes.This is a longer line of notes.";
ods rtf close;
Have you investigated using Style={Posttext = "This is a line"} for this? While there seem to be obnoxious bits about posttext not recognizing escapechar stuff I have found it to often be preferable to the ODS Text. Such as not table border behaviors and appears closer to the table ignoring the PARSKIP setting that causes the ODS Text to be 2 "lines" below the table in RTF.
Hi Ballardw,
Thanks for replying! I havent investigated this option, and I am not sure where I could implement it. Could you give me a quick pointer (or MWE) for this? Is it done in the proc Report as a "Compute after", or outside the proc report?
thanks!
I have no idea what MWE may be but POSTTEXT and PRETEXT are style elements. So they could be be placed in anyplace that affects a table. That could be on the Proc statement or in Proc tabulate in the options for a specific table, which is where I use both Pretext, to get a this table only "Title", or Posttext for "Footnote". I spend more time with Proc Tabulate than Report so I don't have a handy Proc Report example but here are two examples, one with posttext and the other with pretext. The NEWLINE in the post text are partially so the width of the text approximates the width of the table in the output destination. The second also shows the use of POSTTEXT to create a single "footnote" that is common to four tables.
proc tabulate data=fpfs.data&LastDataYear ; Title "Primary Source of Payment"; class sop; classlev sop /Style={width=1.5in &CommonStyle}; format sop $fp_soprep.; table sop='' all='Total', n='#'*[style={width=0.5in &CommonStyle}]*f=comma7. colpctn='%'*[style={width=0.5in &CommonStyle}]*f=f3.0 /style={Fontsize=8pt fontweight=medium Posttext="Note: Source of payment is the expected ^{newline} source of payment at the time of visit^{newline}and may not represent the actual source.^{newline}Count is visits."}; run;title; proc tabulate data=fpfs.services; var service: cserve: referr: InitAnnual Breast Pap Genitalia Hormone Larc EC CC PregTest PreconC PregC STDTreat HIVTest CTage /Style={width=1.5in &CommonStyle} ; table InitAnnual Breast Pap Genitalia, sum='#'*[style={width=0.5in &CommonStyle}]*f=comma7. mean='%'*[style={width=0.5in &CommonStyle}]*f=perc_no_dec. /style={Pretext='Physical Examinations'}; table Hormone Larc EC CC, sum=''*[style={width=0.5in &CommonStyle}]*f=comma7. mean=''*[style={width=0.5in &CommonStyle}]*f=perc_no_dec. /style={Pretext='Contraceptive Services'}; table PregTest PreconC PregC, sum=''*[style={width=0.5in &CommonStyle}]*f=comma7. mean=''*[style={width=0.5in &CommonStyle}]*f=perc_no_dec. /style={Pretext='Pregnancy Services'}; table Service29 CTAGE Service28 STDTreat HIVTest, sum=''*[style={width=0.5in &CommonStyle}]*f=comma7. mean=''*[style={width=0.5in &CommonStyle}]*f=perc_no_dec. /style={Pretext='STD/HIV Services' Posttext="^{fontweight=Light}*^{unicode '0009'x}Includes female clients only^{newline}**^{unicode '0009'x}Includes male clients only^{newline}***^{unicode '0009'x}Includes female and male clients" } ; /* NOTE: the ^{unicode '0009'x} above inserts a TAB character, spacing will depend on viewer*/ label Service29 = 'Chlamydia test***' Service28 = 'Gonorrhea test***' Cserve9 = 'STD/HIV counseling***' ; run;
Hi Ballardw,
I use MWE for "minimal working example", and you did provide that, thanks! 🙂
I added posttext to the following proc report example style. It does add "footnotes" to the proc report, but I doesnt do the newline / indentation. Instead it writes "newline" in text. 2I think this is what you alluded you when you mentionned "posttext not recognizing escapechars" ?
thanks again for helping!
ods rtf file="c:\temp\temp.rtf" ;
ods escapechar = '^';
proc report data=sashelp.class nowd
style(report)=
[posttext=
"^{newline}
Notes: ^{newline}
^S={indent=.12in}X. This is the first line of notes. ^{newline}
^S={indent=.12in}X. This is a longer line of notes. ^{newline}
^S={indent=.12in}X. What kind of witchcraft is this? ^{newline}
"];
column
age name
height weight;
define age / order 'Laboratory Test';
define name / display 'The Name';
define height / display 'height';
define weight / display 'weight';
run;
ods rtf close;
TAGSETS.RTF recognizes the escapechar and you may want options(tables_off='NOTE USER_TEXT') if you use that tagset instead of ODS RTF.
I never tried that Tagset, I'll have to investigate if it's worth learning yet another tagset just for footnotes. I 'll probably just put them at the bottom of the page if neeed be.
I've accepted this as a solution, but it is missing information on how to add indentation to the lines following the first one. Simply use tabs and set its width. The code below indents by 1/8" using ^R/RTF'\tx180\tab'
ods rtf text="^S={fontsize = 8pt}^{newline}
Notes:^{newline}
^R/RTF'\tx180\tab' 1. First line of notes.^{newline}
^R/RTF'\tx180\tab' 2. Second line of notes.^{newline}
^R/RTF'\tx180\tab' 3. Third line of notes.^{newline}
";
If you are using RTF destination. You could try to add RTF Control Words .
http://support.sas.com//rnd/base/ods/templateFAQ/Template_rtf.html#control
ods rtf file="/folders/myfolders/temp.rtf" ;
ods listing close;
ods html close;
title1;
OPTIONS NODATE NONUMBER leftmargin=0.2 cm rightmargin=0.2 cm;
ods escapechar = '^';
proc report data=sashelp.class nowd;
column
age name
height weight;
define age / order 'Laboratory Test';
define name / display 'The Name';
define height / display 'height';
define weight / display 'weight';
run;
ods rtf text=' ' ;
ods rtf text='^S={fontsize = 8pt}Notes:' ;
ods rtf text="^S={indent=.12in fontsize = 8pt} This is the first line of notes" ;
ods rtf text=
"^S={indent=.12in fontsize = 8pt}X. This is a longer line of notes.";
ods rtf text=
"^S={indent=.12in fontsize = 8pt}X. What kind of witchcraft is this?";
ods rtf text=
"^S={indent=.12in fontsize = 8pt}X. I'm cold.";
ods rtf text=
"^S={indent=.12in fontsize = 8pt}X. This is a longer line of notes.This is a longer line of notes.This is a longer line of notes.This is a longer line of notes.^R/RTF'\line\tab\tab\tab' This is a longer line of notes. This is a longer line of notes.This is a longer line of notes.This is a longer line of notes.This is a longer line of notes.This is a longer line of notes.This is a longer line of notes.This is a longer line of notes.This is a longer line of notes.";
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.