BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hi,
When I use ods rtf, I have trouble to figure out how to keep the blanks I need.
For title example, I want
' ... this is a second title'
but the blanks be trim and return
'this is a second title'.

The other is very common requirements which I can do in listing but not rtf.
i want
'Gerder'
' ... n'
' ... mean'

and ods reture
'Gerder'
'n'
'mean'

Does anyone can help me with this? Thanks so much.

Mark
2 REPLIES 2
Cynthia_sas
SAS Super FREQ
Hi:
There is a style attribute called "ASIS" which must be set to ON in order for leading blanks to be respected. For example, in the program below, the regions for Asia, Canada and Africa are formatted to have leading spaces and TITLE2 is formatted to have leading spaces. The ODS ESCAPECHAR is used to specify a style attribute override in the format and/or in the TITLE statement.

In addition, a few other techniques are shown that may be useful (getting Page X of Y page numbering and left, center or right justifying the title).

Remember that in a proportional spaced font, it is possible that padding a line with leading spaces may or may not cause each value in a cell to "line up" with the value above or below it.

There are other techniques you can use in RTF, that involve RTF control strings, but they require slightly different treatement with ODS and may or may not be allowed for use with your company's standards for reporting.

The reason that padding with spaces works with the LISTING destination is that with LISTING or monospace-font output, the letter 'i' takes up the same amount of space in a cell or in a row of text as the letter 'w' (and a single hit of the space bar takes up the same amount of space as a single letter):
[pre]
iiiiiiiiiiiiiiiiiiii
wwwwwwwwwwwwwwwwwwww
[/pre]

But, in a proportional spaced font, the letter i takes up less space than the letter w.
iiiiiiiiiiiiiiiiiiii
wwwwwwwwwwwwwwwwwwww

In the 2 lines below, I entered 10 hits of the space bar after the dash on each line. And you can see that they are largely compressed using a proportional spaced font. The word 'If" takes up the same amount of space as the letter W on the line underneath:
- If you can see the spaces...
- What the spaces do....

Yet, if I show both those lines in a monospace font:
[pre]
- If you can see the spaces...
- What the spaces do....
[/pre]

You can see the 10 spaces in each line.

At any rate, the program (below) may give you some ideas of how to handle your reports. If you need to produce the standard type of clinical trial demographic report, I have several examples of that in my paper, 'Creating Complex Reports', available from:
http://www.lexjansen.com/pharmasug/2008/sas/sa08.pdf (paper)
http://support.sas.com/rnd/papers/sgf2008/complex_reports.zip (programs)

And this paper talks about the use of ODS ESCAPECHAR:
http://www2.sas.com/proceedings/forum2007/099-2007.pdf

cynthia

[pre]
options nodate nonumber orientation=portrait;

proc format;
value $ls 'Asia' = '^S={asis=on} Asia'
'Africa' = '^S={asis=on} Africa'
'Canada' = '^S={asis=on} Canada';
run;

ods rtf file='dostuff.rtf';
ods escapechar='^';
title1 j=l 'Left Justified';
title2 j=l '^S={asis=on} 5 Leading Spaces';
title3 j=r 'Right Justified';
title4 j=c 'Center Justified';
footnote j=c 'Page ^{pageof}';

proc tabulate data=sashelp.shoes;
where region in ('Asia', 'Africa', 'Canada', 'Pacific',
'United States', 'South America');
title5 j=c 'Only Indent Some Regions';
var sales;
class region;
table region,
sales*(sum mean);
format region $ls.;
run;

proc print data=sashelp.class;
title5 j=c 'This is another page';
run;

proc print data=sashelp.shoes(obs=30);
title5 j=c 'This is another page for shoes';
run;

ods rtf close;
[/pre]
deleted_user
Not applicable
Thanks so much Cynthia! Message was edited by: markmark

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!

New Learning Events in April

 

Join us for two new fee-based courses: Administrative Healthcare Data and SAS via Live Web Monday-Thursday, April 24-27 from 1:00 to 4:30 PM ET each day. And Administrative Healthcare Data and SAS: Hands-On Programming Workshop via Live Web on Friday, April 28 from 9:00 AM to 5:00 PM ET.

LEARN MORE

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