A question about dealing blank in ods rtf

Reply
N/A
Posts: 0

A question about dealing blank in ods rtf

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
SAS Super FREQ
Posts: 8,814

Re: A question about dealing blank in ods rtf

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]
N/A
Posts: 0

Re: A question about dealing blank in ods rtf

Thanks so much Cynthia! Message was edited by: markmark
Ask a Question
Discussion stats
  • 2 replies
  • 339 views
  • 0 likes
  • 2 in conversation