The SAS Output Delivery System and reporting techniques

Headline equivalent when using RTF

Reply
Super Contributor
Posts: 252

Headline equivalent when using RTF

Hello,

Can you please help me to produce a blank line in Proc Report after all the column headers and between the first row of the data for every page? Similarly to what the Headline option does for traditional SAS monospace output.

I've tried using the Pretext option, within my define statement but this does not work. i.e. style(header)=[pretext="*\line"].

Many thanks in advance for your help!

Super User
Super User
Posts: 7,682

Re: Headline equivalent when using RTF

Can you illustrate what you mean.  Headline underlines the headers, and it should work exactly the same in RTF.  Do you mean headskip?  Maybe just put an escape char in with a blank:

ods escapechar="^";

...

define firstcolomn / "Hello~World^{newline}";

Super Contributor
Posts: 252

Re: Headline equivalent when using RTF

Sorry I do actually mean the headskip Option:

An example is so I can obtain the following output:

Name       Gender


Alice         F

Amy          F

Andy         F

Currently I get the output below:

Name       Gender

Alice         F

Amy          F

Andy         F

Thank you Reeza. I believe your suggestion will produce the following output because I have used something similar elsewhere but used ^\line instead of ^{newline}?

Name       Gender

______________

Alice         F

Amy          F

Andy         F

Super User
Super User
Posts: 7,682

Re: Headline equivalent when using RTF

I would note, I am not Reeza.  I see, the simplest way to do it would be in a compute block:

proc report...;

     columns...;

     define ...;

     break after pge / page;   /* Note that pge is a variable defined by you for page splitting, you could use another variable, depends on your data */

     compute before pge;

          line ' ';

     endcomp;

run;

Super Contributor
Posts: 252

Re: Headline equivalent when using RTF

Sorry and thank you RW9.

The code you provided does help when I create my own page breaks. However if I do not create the page break in the correct place, the page doesn't break properly. Please see my example below. Is there a way that the breaks can be honoured, otherwise, can I create the headskip functionality without using break after / page?

Thank you.

goptions reset = all;

data cars;
  set sashelp.cars;
  constant = "constant";
  if _n_ >= 1 and _n_ <= 20 then p = "Page 1";
  else if _n_ >= 21 and _n_ <= 40 then p = "Page 2";
  else if _n_ >= 41 and _n_ <= 60 then p = "Page 3";
  if _n_ <= 60;
  keep  constant make model type p;
run;

ods escapechar = "*";


*Setting up output template, so that output is similar to the output proced by %openOut1*;

proc template;
  define style Styles.rtf_kriss;
    parent = styles.X_rtf;
      style body from body /
        marginleft = 34.5mm
        marginright = 34.0mm
        margintop = 18.2mm
        marginbottom = 14.2mm;
 
      style fonts from fonts;

      style table from table /
        frame = void
        rules = group
        backgroundcolor = white
        borderspacing = 0pt
        cellpadding = 0pt;

      class color_list /
        'bg' = white
        'fg' = black
        'bgH' = white
        'link' = black;
  end;
run;


ods listing close;
ods rtf file='U:\indent_text5.rtf' startpage=no style=styles.rtf_kriss;
ods escapechar='^';

proc report data=cars
     style(report)={width=100%} nowd;
  column  make model type p;

  define p / order;
  break after p / page;
  compute before p;
    line " ";
  endcomp;
run;

ods rtf close;

Super User
Super User
Posts: 7,682

Re: Headline equivalent when using RTF

I would recommend that you create page breaks yourself, I always do on my outputs.  I.e. drop the startpage=no. 

If you want a line inserted then you need to have some sort of grouping so that report knows where to insert the line, i.e. do you want the line before each make?  You can't say before each page, as your no defining pages.  Think of it this way, if you did it via datastep, how would you know when to put a blank line in the dataset.

Super Contributor
Posts: 252

Re: Headline equivalent when using RTF

Thank you for this. In the end I created the blank lines I wanted within the datastep.

Super User
Posts: 9,856

Re: Headline equivalent when using RTF

style(report)=[pretext="*\line"]. ???

Super Contributor
Posts: 252

Re: Headline equivalent when using RTF

Thank you. Unfortunately that does not work...

Super User
Posts: 9,856

Re: Headline equivalent when using RTF

How about this one ?

Code: Program

proc report data=sashelp.class nowd;
compute before;
line ' ';
endcomp;
run;
Ask a Question
Discussion stats
  • 9 replies
  • 855 views
  • 7 likes
  • 3 in conversation