The SAS Output Delivery System and reporting techniques

Control Line Spacing in tagsets.rtf

Occasional Contributor
Posts: 8

Control Line Spacing in tagsets.rtf

Dear All,

How to control line spacing in tagsets.rtf destination with Proc REPORT. I have tried using PADDING = Option, PADDINGTOP = Option & PADDINGBOTTOM = Option.

All the above mentioned, seems to be controlling before and after spacing within a cell(Paragraph > Spacing> Before & After).

My requirement is,

Line spacing "Exactly"=10 pt

Before spacing= 0pt

After Spacing = 0pt

How I can achieve this. Please advice.



Super User
Posts: 10,550

Re: Control Line Spacing in tagsets.rtf

When you get to wanting that level of control you will likely need to use raw rtf.

Starting point is to generate the general output of about one page. The edit it in a word processing program and save as RTF.

Look at the resulting file in a text editor, the SAS program editors will work if nothing else. Compare the original RTF and the Edited version looking for different tags.

How to get them into to the procedure output may have a number of options depending on your approach but I haven't played with the line spacing so can't give more than that.

Posts: 8,745

Re: Control Line Spacing in tagsets.rtf


  ODS RTF may not allow you this level of control. It is possible that TAGSETS.RTF might allow you this level of control. The determining factors are:

1) is there an RTF control for doing what you want to do. RTF files are designed to be opened with Microsoft Word, whether Word built these controls into the RTF spec is something you would need to research. Reverse engineering, such as BallardW suggested is one way. Reading the RTF spec or the O'Riley book is another way.

2) if there is no way in ODS RTF to control these settings and there IS an RTF spec for "exactly 10pt as line spacing, etc", then you MIGHT be able to alter TAGSETS.RTF to generate the RTF control strings that you need. But you have to know WHAT the right strings are and THEN, you have to modify the TAGSET template to insert those control strings in the right place.

  An alternate approach would be to create the ODS RTF file with SAS and then "post-process" the RTF file using VB or VBA to set the spacing to be exactly what you want. For help or pointers about modifying the TAGSET template, there are some user group papers on the subject, but your best bet is to work with Tech Support. Learning PROC TEMPLATE for coding TAGSET template changes is not something you just dash off like a PROC PRINT.


Respected Advisor
Posts: 3,777

Re: Control Line Spacing in tagsets.rtf

These RTF control words seem to related to your issue.  How are they defined in your RTF file?  You will need to look using and text editor.


\sbNSpace before (the default is 0).
\saNSpace after (the default is 0).
\slNSpace between lines. If this control word is missing or if \sl1000 is used, the line spacing is automatically determined by the tallest character in the line; if N is a positive value, this size is used only if it is taller than the tallest character (otherwise, the tallest character is used); if N is a negative value, the absolute value of N is used, even if it is shorter than the tallest character.
\slmultNLine spacing multiple. Indicates that the current line spacing is a multiple of "Single" line spacing. This control word can follow only the \sl control word and works in conjunction with it.

0 "At Least" or "Exactly" line spacing.

1 Multiple line spacing, relative to "Single."

Occasional Contributor
Posts: 8

Re: Control Line Spacing in tagsets.rtf

Thanks all for very informative answers. You provides lot of option to look into this issue, but it is not possible to create line spacing through "post-process" (using VB or VBA or manual edit), since the requirement is to complete the task by SAS programming itself. As mentioned above, if I have to use the control word "\slN" for linespacing, where I have to call this control (I mean which option to use in PROC REPORT or Tagsets.rtf style template). I have attached the current program as image below. Please suggest where the control word can be fit into the program.



Super User
Super User
Posts: 7,430

Re: Control Line Spacing in tagsets.rtf


You do not need to use any other tool than SAS to edit RTF files.  They are flat text based format.  If you open an RTF in Notepad, you will see simple text with markup codes.  Then It is simply a matter of adding or removing the specific RTF text to achieve the results you want.

data _null_;

     length buffer $2000.;

     infile "...rtf";

     file "...rtf";

     input buffer $;

     if ... do your logic to find place to insert spacing...;

          put buffer;

          put ...rtf code here...;


     else put buffer;


Occasional Contributor
Posts: 8

Re: Control Line Spacing in tagsets.rtf

Thank you RW9. Its really helpful and working for me to solve Page X of Y issue instead. I have achieved the line spacing exactly equal to 10pt  by giving the code

style(column)=[PROTECTSPECIALCHARS=off pretext='\sl-200 '] in PROC REPORT part of each column. Is it possible to apply this style in Titles and Footnotes statements too? 

One more query in mind is, is it possible to apply line spacing code in PROC template part, so that  I can apply the above, globally anywhere(Title, body or Footnote)  of the report table. Please suggest.



Super User
Super User
Posts: 7,430

Re: Control Line Spacing in tagsets.rtf

Well, its a bit hard to say.  Templates don't seem to be documented anywhere of what does what, its a real missing element in the SAS documentation.  All I can suggest is that you have a look at the template code and all its parents and see what options there are.  I don't have access to SAS right now, but you can look by right clicking on Results on the left (in results folder) and selecting Templates.  The default style and look through the elements there.

Ask a Question
Discussion stats
  • 7 replies
  • 5 in conversation