BookmarkSubscribeRSS Feed
djrisks
Barite | Level 11

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";


titles.PNG
12 REPLIES 12
RW9
Diamond | Level 26 RW9
Diamond | Level 26

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

djrisks
Barite | Level 11

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.

 

data_null__
Jade | Level 19

Notice that box can be resized by dragging the right borderCapture.PNG

All we have to do is figure out how to do that with SAS.

Capture.PNG

djrisks
Barite | Level 11

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

data_null__
Jade | Level 19

@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}

 

djrisks
Barite | Level 11

Okay great, thank you for this tip too 🙂

Cynthia_sas
SAS Super FREQ

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

djrisks
Barite | Level 11

Hi Cynthia,

 

Thank you for letting me know and for your suggestions.

 

Many thanks,


Kriss

RW9
Diamond | Level 26 RW9
Diamond | Level 26

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.

 

djrisks
Barite | Level 11

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

ballardw
Super User

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.

djrisks
Barite | Level 11

Thanks, I'm using ODS RTF...

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 12 replies
  • 2495 views
  • 6 likes
  • 5 in conversation