BookmarkSubscribeRSS Feed
oujiang
Calcite | Level 5

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;

5 REPLIES 5
Scott_Mitchell
Quartz | Level 8

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

oujiang
Calcite | Level 5

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

Scott_Mitchell
Quartz | Level 8

My second post should do that for you.

Scott_Mitchell
Quartz | Level 8

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

annaliseshen
Fluorite | Level 6

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

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 5 replies
  • 2849 views
  • 0 likes
  • 3 in conversation