Hello,
I am using the following code to produce titles in RTF, but when I open the RTF document, the first title stops before CAXX-X. I've attached an image to show what is happening. Please can you help? Many thanks, in advance.
goptions reset = all; * Resetting title, i.e. the SAS System;
ods escapechar = "~";
options orientation = landscape;
title1 j=l 'Summary of Change from Baseline and Percentage Change from Baseline in CAXX-X Tumor Marker (U/L)' j=r "~{pageof}";
title2 "ITT Population" j=r "&timdat.";
title3 "AAA-BB-CCCC – Phase 2" j=r "PDPM";
I am just guessing here, as can't test at the moment, but when you write out to RTF, and then load in Word, Word itself sections out titles into a left box, a center box and a middle box. So I am wondering if the fact that you have a j=1 and j=r on the same line is causing Word to truncate at the centered box. Is there a reason to have page in the title, in all clinical outputs I have seen, Page x of y is a footnote, generally on its own row, same with date/time of run e.g.:
Summary of ...
ITT Population
----------
----------
Last run: ddmmyy
Page x of y
Thank you @RW9. Yes it's because I have the the Page x of y on the right hand side. That also is how they want the report. Have you got any idea how to include it on the same line please? I guess when I done it in the past, I may have calculated the spaces in the report and then concatenated title1 with the Page x of y, so that the Page x of y appeared on the right hand side, and the full title was shown.
Notice that box can be resized by dragging the right border
All we have to do is figure out how to do that with SAS.
Thank you @data_null__. I ended up using this solution in the end because I needed to do it programmatically.
%let ls = 136;
%let title1 = Summary of Change from Baseline and Percentage Change from Baseline in CAXX-X Tumor Marker (U/L);
%let tit1 = %nrbquote(&title1 %sysfunc(repeat(%str( ),%eval(&ls - %length(&title1) -12))) ~{pageof});
goptions reset = all; * Resetting title, i.e. the SAS System;
ods escapechar = "~";
options orientation = landscape;
title1 "&tit1.";
@djrisks yes programmatically. I expect there is a way to include some in-line RTF code in the title statement to set the cell size but I don't know what that is. I bet Cynthia knows.
The RTF code looks like this from my example. If you change 7554 to say 13554 the left cell is enlarged and you get the desired result. Editing the RTF is the last resort but "everyone" I know does it all the time. 🙂
{\par} \pard\trowd\trkeep\trqc \cltxlrtb\clvertalt\clcbpat8\clpadt10\clpadft3\clpadr10\clpadfr3\cellx7554 \cltxlrtb\clvertalt\clcbpat8\clpadt10\clpadft3\clpadr10\clpadfr3\cellx15118 \pard\plain\intbl\b\i\sb10\sa10\ql\f1\fs26\cf1{Summary of Change from Baseline and Percentage Change from Baseline in CAXX-X Tumor Marker (U/L)\cell} \pard\plain\intbl\b\i\sb10\sa10\qr\f1\fs26\cf1{{\field{\*\fldinst { PAGE }}}{ of }{\field{\*\fldinst { NUMPAGES }}}\cell} {\row}
Okay great, thank you for this tip too 🙂
HI,
Unfortunately, nothing you do in SAS code for RTF will allow you to "drag" the title table borders. The only way I know of to impact the RTF is to explicitly change the sizes as you suggested -- some people will post-process the RTF file (which is just ASCII text) with a program.
My other suggestion is to pad the long title with non-breaking spaces; or to put the page x of y on title1, by itself, then to put the long title on title2.
cynthia
Hi Cynthia,
Thank you for letting me know and for your suggestions.
Many thanks,
Kriss
Well, this should work (supported by: http://www.lexjansen.com/phuse/2007/cs/CS08.pdf):
ods escapechar="^" noresults; title1 "^S={just=left} Summary of Change from Baseline and Percentage Change from Baseline in CAXX-X Tumor Marker (U/L) ^S={just=right} ^{pageof}"; title2 "ITT Population" ; title3 "AAA-BB-CCCC – Phase 2" j=r "PDPM"; options orientation=landscape; ods rtf file="s:\temp\rob\temp.rtf"; proc print data=sashelp.class; run; ods rtf close;
I.e. putting style information in the title. However it seems to be ignoring the style information in my SAS setup, but that might just be my SAS setup! Try it. This should also work, but for some reason my SAS is only recognising the escape character sometimes?
ods escapechar='#'; ods noresults; title1 "#R/RTF{\ql} Summary of Change from Baseline and Percentage Change from Baseline in CAXX-X Tumor Marker (U/L) #R/RTF{\qr} #{page} of #{lastpage}"; title2 "ITT Population" ; title3 "AAA-BB-CCCC – Phase 2" j=r "PDPM"; options orientation=landscape; ods rtf file="s:\temp\rob\temp.rtf" bodytitle; proc print data=sashelp.class; run; ods rtf close;
Can't help any more at the mo, will have a look tomorrow when I can get a fresh SAS session.
Thank you for this. I think it's so close!!! I tried your code, and I also slightly modified the code, to match similar code that I have but it's still doesn't work for some reason. The page numbers do not go to the right hand side.
title1 "Summary of Change from Baseline and Percentage Change from Baseline in CAXX-X Tumor Marker (U/L) ~{style [textalign=right]} ~{pageof}";
Are you using ODS RTF or ODS tagsets.RTF to generate your output?
There are differences between the two and a change might help. Maybe. No promise.
Thanks, I'm using ODS RTF...
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.