BookmarkSubscribeRSS Feed
djrisks
Barite | Level 11

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!

9 REPLIES 9
RW9
Diamond | Level 26 RW9
Diamond | Level 26

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}";

djrisks
Barite | Level 11

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

RW9
Diamond | Level 26 RW9
Diamond | Level 26

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;

djrisks
Barite | Level 11

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;

RW9
Diamond | Level 26 RW9
Diamond | Level 26

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.

djrisks
Barite | Level 11

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

Ksharp
Super User

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

djrisks
Barite | Level 11

Thank you. Unfortunately that does not work...

Ksharp
Super User

How about this one ?

Code: Program

proc report data=sashelp.class nowd;
compute before;
line ' ';
endcomp;
run;

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
  • 9 replies
  • 2303 views
  • 7 likes
  • 3 in conversation