BookmarkSubscribeRSS Feed
sunilpusarla
Fluorite | Level 6

Hi There,

I am using SAS 9.3 M1. I am unsuccessful in using the spanrows option in a plain rtf (no tagsets) output. It is working wonderful in the pdf destination but not with the rtf. It is combining all the rows into one cell but when the page breaks the row is not appearing in the new page. Is there any other option/statement I need to use with? Your advice will be appreciated.

Below is a sample test code.

data class30;

set sashelp.class;

do check = 1 to 30;

output;

end;

run;

ods rtf file ="&outpath.\class30.rtf";

proc report data=class30 nowd out=show spanrows;

column age name check sex;

define age /order;

define name / order ;

run;

ods rtf close;

Thanks,

Sunil

3 REPLIES 3
Cynthia_sas
SAS Super FREQ

Hi:

  It is strange that you do not want to use TAGSETS.RTF. Is there a reason for this requirement? That is really the solution to your issue in this case. If you run the code (a modification of your  test), you will see exactly the output you want from the TAGSETS.RTF destination. Because TAGSETS.RTF does vertical measurement, and inserts explicit page breaks, Word knows exactly where to put the page break and the value repeats across pages. See the example in the attached screenshot, where the rows for Thomas split across pages. This output was created using TAGSETS.RTF.

cynthia

data class30;

set sashelp.class;

do check = 1 to 30;

    output;

end;

run;

 

ods pdf file="c:\temp\class30.pdf";

ods rtf file ="c:\temp\class30.rtf";

ods tagsets.rtf file ="c:\temp\class30tr.rtf"

    options(doc='help' continue_tag='no');

proc report data=class30 nowd spanrows;

column age name check sex;

define age /order;

define name / order ;

run;

ods _all_ close;


tagsets_rtf_spanrows.png
sunilpusarla
Fluorite | Level 6

Thank you very much Cynthia. I will try using the tagsets. The reason I did not use tagsets is with plain RTF, I am getting everything what I require except the spanning of rows. Initially when I tried using the tagsets, I got all wierd page breaks, "Continued" text, and rtf codes (ex: \tq\b, \tqr\tx14050 ) etc. These did not happen after I shifted to plain rtf. (I am creating a define file where I am including multiple proc reports with different options for each (ex: startpage), under single ODS sandwich to have a single file).

Sunil

Abby19
Fluorite | Level 6

Hi Cynthia,

 

I can't use the tagsets option as we have an organization-wide RTF-setup macro. Is there a way around that, so that I can use SPANROWS option to repeat group/order variables? 

 

With my existing code, (without tagset RTF), Order variables are not being repeated at new page beginnings even with the SPANROWS option.

 

Below is a sample code:

 


** ----------------------------------------------------------------------**
** Generating Listing                                                    **
** --------------------------------------------------------------------- **;
%rtfsetup(dshdft=hdft,progid=L-PD);
proc report data=final nowindows headline headskip split="|" spacing=1 missing style(report)={outputwidth=&outwidth}
 style(header)={protectspecialchars=off} spanrows;
 columns  col1 col2 col3 col4 col5;

 define col1 /order order=data style={cellwidth = 4% just=l protectspecialchars=off} "Subject";
 define col2 /order order=data style={cellwidth = 4% just=l protectspecialchars=off} "Major/Minor";
 define col3 /order order=data style(header)={cellwidth = 22% just=c protectspecialchars=off} style(column)={just=l} "Description";
 define col4 /order order=data style={cellwidth = 6% just=c protectspecialchars=off} "Date"; 
 define col5 /order order=data style={cellwidth = 10% just=l protectspecialchars=off} "Type";
 
 compute after col5;
   line "";
 endcomp;
run;
 
In the above code:
 
col1 and col2 are supposed to be repeating variables. But in this situation, they don't repeat when there a page break after first page. Other columns - col3 to col5 - do appear in the new page.
 
Any help is much appreciated. Without this we manually calculate lines in page based on the width of each column, and the number of line each column takes.
 

Thanks,

Abby

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
  • 3 replies
  • 1874 views
  • 1 like
  • 3 in conversation