BookmarkSubscribeRSS Feed
Nalla
Calcite | Level 5

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.

Thanks,

Nalla

7 REPLIES 7
ballardw
Super User

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.

Cynthia_sas
SAS Super FREQ

Hi:

  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.

cynthia

data_null__
Jade | Level 19

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.

Spacing

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

Nalla
Calcite | Level 5

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.

Thanks,

Nallademog.PNG

RW9
Diamond | Level 26 RW9
Diamond | Level 26

Hi,

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

     end;

     else put buffer;

run;

Nalla
Calcite | Level 5

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.

Thanks,

Nalla.

RW9
Diamond | Level 26 RW9
Diamond | Level 26

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.

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
  • 7 replies
  • 5018 views
  • 9 likes
  • 5 in conversation