The SAS Output Delivery System and reporting techniques

delete empty lines

Reply
Occasional Contributor
Posts: 9

delete empty lines

hi! QQ截图20130711110026.jpg

how to delete the empty lines after the proc report table?

here is my code.

ods rtf file="C:\temp\report.rtf" bodytitle STARTPAGE=no  HOST  NOKEEPN NOOUTLINE NOLSTPIPE style=rtf;

proc report data=sashelp.class nowd SPANROWS      style=printer headline headskip;

quit;

proc report data=sashelp.class nowd SPANROWS   style=printer headline headskip;

quit;

ods rtf close;

Super Contributor
Posts: 297

Re: delete empty lines

Do you want the 2 tables you are generating to have the appearance of a single table?

Occasional Contributor
Posts: 9

Re: delete empty lines

No,still is two tables. just delete the middle empty lines.

Super Contributor
Posts: 297

Re: delete empty lines

My second post should do that for you.

Super Contributor
Posts: 297

Re: delete empty lines

The following article and macro may be of some assistance to you.

http://www.lexjansen.com/pharmasug/2005/applicationsdevelopment/ad16.pdf

The following adaption appears to work:

ods rtf  startpage = no bodytitle file="e:\report1.rtf" bodytitle STARTPAGE=no  HOST  NOKEEPN NOOUTLINE NOLSTPIPE style=rtf;

ods escapechar = '^';

proc report data=sashelp.class nowd SPANROWS      style=printer headline headskip;

quit;

proc report data=sashelp.class nowd SPANROWS   style=printer headline headskip;

quit;

ods rtf close;

%Macro glue(in=, out=);

%local QueueSize;

%let QueueSize=5;

filename infile "&in";

filename outfile "&out";

data _TMPDSN;

length rtfcode $32000;

infile infile; * original rtf tables created by ODS;

input;

rtfcode=_infile_;

length=length(trim(rtfcode));

run;

data _null_;

file outfile; * rtf stack table with no gaps between child tables;

set _TMPDSN end=last;

array queue{&QueueSize} $32000 _temporary_;

retain queue;

retain count 0;

count = count + 1;

queue[count] = rtfcode;

if count = &QueueSize then do;

found = 0;

if (queue{1} = '\pard{\par}' and

queue{2} = '{\par}{\pard\plain\qc{' and

queue{3} = '}\par}{\par}' and

queue{4} = ' ') then do;

if (compress(translate(queue{&QueueSize},"", "0123456789")) =

'\sect\sectd\linex\endnhere\sbknone\headery\footery\marglsxn\margrsxn\margtsxn\margbsx

n') then found=1;

end;

if found then do;

count=0;

end; else do;

put queue{1};

do i = 2 to &QueueSize;

queue[i-1]=queue;

end;

count = count -1;

end;

end;

if last then do;

do i = 1 to count;

put queue{i};

end;

end;

run;

%Mend glue;

%glue(in=e:\report1.rtf,out=e:\report2.rtf);

Highlighted
Occasional Contributor
Posts: 7

Re: delete empty lines

I used %glue, however, it did not work. 

Ask a Question
Discussion stats
  • 5 replies
  • 1169 views
  • 0 likes
  • 3 in conversation