hi!
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;
Do you want the 2 tables you are generating to have the appearance of a single table?
No,still is two tables. just delete the middle empty lines.
My second post should do that for you.
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);
I used %glue, however, it did not work.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.