| Return to SAS 9
|
The measured RTF tagset is production for SAS 9.2. For background on how it differs from traditional ODS RTF, see Measured Markup with ODS TAGSETS.RTF. See also a SUGI 31 paper, Teaching Your RTF Tagset to Do Clever Tricks (.pdf), together with its SAS 9.2 example, tagset, and output (.zip).
The Parskip style element can be used to change the spacing between tables.
ods listing close;
proc template;
define style test1;
parent=styles.rtf;
style parskip / fontsize = 40pt;
end;
run;
proc template;
define style test2;
parent=styles.rtf;
style parskip / fontsize = 1pt;
end;
run;
data temp; do i = 1 to 70; output; end; run;
ods tagsets.rtf file="mparskip.rtf" OPTIONS(SECT="NONE") STARTPAGE=NO style=test1;
title "Test Title";
footnote "Test Footnote";
proc print data=sashelp.class (obs=5); run;
proc print data=sashelp.class (obs=5); run;
ods tagsets.rtf style=test2;
proc print data=sashelp.class (obs=5); run;
ods _all_ close;
ods listing;
The OPTIONS statement can be used for manipulating the RTF table row instructions. The following code snippet rotates the column header.
options orientation=landscape nodate nonumber;
ods listing close;
ods tagsets.rtf file="Mrotate.rtf"
OPTIONS(TRHDR="\trrh750"
TROWHDRCELL="\cltxbtlr"
TROWD="\rtlrow" );
proc print data=sashelp.class(obs=5); run;
ods _all_ close;
Panels are created when a table is wider than a page. The measured RTF behavior differs from the traditional ODS RTF behavior. By default in measured RTF, an attempt is made to group panels together so that all of an observation is close together.
The first panel holds as many columns as can fit on one line, for several rows. The second panel holds the next group of columns for those same rows, and so forth. Panels continue until all of the columns are produced for the set of rows, and then a page break is forced.
The number of rows in each panel is determined by what will fit on a logical page. If all panels cannot fit on one page, additional pages are filled.
The TABLEROWS option enables you to specify the number of rows for a panel.
The PAGEPANELS option determines the maximum number of panels per page. Here are two uses for this option:
Here is some example code that demonstrates the different choices for paneling. View RTF output.
option nodate nonumber;
ods listing close;
ods tagsets.rtf file="panel.rtf";
data temp;
array values val1-val100;
do j = 1 to 10;
do i = 1 to dim(values);
values(i) = i;
end;
output;
end;
run;
ods tagsets.rtf;
title "Default Paneling";
proc print data=temp; run;
ods tagsets.rtf tablerows=5 pagepanels=4;
title "Paneling with tablerows=5 pagepanels=4";
proc print data=temp; run;
ods tagsets.rtf pagepanels=none;
title "Paneling with pagepanels=none";
proc print data=temp; run;
ods _all_ close;
ods listing;
With the RTF measured tagset and the TABULATE procedure, it's possible to repeat row headers on each page of output. TABULATE is the only procedure that inserts row header information into the table as standard data cells. The information can be stored for measured RTF and reproduced at page breaks. This is not possible in traditional ODS RTF.
options orientation=landscape;
ods rtf file="rtftab.rtf" ;
ods tagsets.rtf file="mrtftab.rtf" uniform;
ods listing close;
data one;
do a=1 to 2;
do b=1 to 2;
do c=1 to 3;
do d=1 to 3;
do e=1 to 5;
output;
end;
end;
end;
end;
end;
run;
proc format;
value cars 1='DATSUN 200SX'
2='PONTIAC FIERO';
value colors 1='RED'
2='LIGHT BLUE'
3='YELLOW'
4='GREEN'
5='BROWN';
value luxury 1='ALL THE WAY'
2='STANDARD OPTIONS'
3='STRIPPED DOWN';
value opts 1='POWER STEERING'
2='SUN ROOF'
3='AUTOMATIC'
4='T-TOP'
5='HATCHBACK'
6='FUEL-INJECTION'
7='HUBCAPS'
8='AM/FM STEREO'
9='FLOOR MATS'
10='CASSETTE PLAYER';
value perform 1='VERY SLOW'
2='SLOW'
3='AVERAGE'
4='FAST'
5='VERY FAST';
run;
data two (keep=model color luxury options perform);
length model color luxury options perform $ 20;
set one;
model=put(a,cars.);
color=put(b,colors.);
luxury=put(c,luxury.);
options=put(d,opts.);
perform=put(e,perform.);
run;
title2 'my favorite cars';
title3 'this is a pretty large dataset';
proc tabulate data=two order=data ;
class model color luxury options perform;
table model*color*luxury*options*perform,n / indent=4 condense;
label model='MODEL CAR'
color='COLOR OF CAR'
luxury='CONDITION OF CAR'
perform='SPEED';
keylabel n='NUMBER';
run;
ods _all_ close;