| Return to SAS 9
|
This topic demonstrates some of the new features in the ODS RTF destination for SAS 9.2. See also the new measured RTF tagset.
Inline formatting is production in RTF for SAS 9.2 and includes nesting of inline functions.
options nodate nonumber;
ods listing close;
ods escapechar="^";
ods rtf file="rtffuncs.rtf";
title "Examples of Functions";
title2 'Example of ^{nbspace 3} Non-Breaking Spaces Function';
title3 'Example of ^{newline 2} Newline Function';
title4 'Example of ^{raw \cf12 RAW} RAW function';
title5 'Example of ^{unicode 03B1} UNICODE function';
title6 "Example ^{style [foreground=red] of ^{super ^{unicode ALPHA}
^{style [foreground=green] Nested}} Formatting} and Scoping";
title7 "Example of ^{super
^{style [foreground=red] red
^{style [foreground=green] green } and
^{style [foreground=blue] blue}}} formatting";
proc print data=sashelp.class(obs=4); run;
ods _all_ close;
ods listing;
In SAS 9.2, you can change border styles individually (e.g., bordertopcolor, bordertopstyle, bordertopwidth, borderbottomcolor) with inline formatting.
ods listing close;
ods escapechar="^";
ods rtf file="rtfborders.rtf";
title "^{style [borderwidth=5pt bordertopcolor=red borderbottomwidth=20pt
borderrightstyle=double] Border Control Example}";
data sample;
informat desc $50.;
col1 = "000.12"; col2 = 123.41; desc = "Various0"; output;
col1 = "00.123"; col2 = 1.444; desc = "^{style [borderwidth=5 bordercolor=red]Various1}"; output;
col1 = "0.1999"; col2 = 23.0; desc = "Various2"; output;
run;
proc report data=sample nowindows;
columns (desc col1-col2);
define desc / "Desc";
define col1 / "Dose 1 "
style(column)=[borderwidth=30];
define col2 / "Placebo";
run;
ods _all_ close;
ods listing;
You can use the TableHeaderContainer and TableFooterContainer style elements in the TEMPLATE procedure to change the borders of the regions that surround the table header and footer.
options validvarname=any nodate nonumber;
ods listing close;
title 'TableHeaderContainer and TableFooterContainer for 9.2 SAS';
title2 'Allows Control of Borders Between Header/Body/Footer of a Table';
proc template;
define style test;
parent=styles.rtf;
style TableHeaderContainer from TableHeaderContainer /
borderbottomwidth=12
borderbottomcolor=blue
borderbottomstyle=dotted
;
style TableFooterContainer from TableFooterContainer /
bordertopwidth=6
bordertopcolor=red
bordertopstyle=double
;
style table from table /
cellspacing=0 rules=groups frame=void
;
end;
run;
ods rtf file="rtfthc.rtf" style=test;
/* The mixed_case lets you use an nlit in the data set name. */
%libcat(nlits, pathname=nlits, opt=mixed_case=yes);
data nlits.' myth'n;
input Root Square Animal $;
datalines;
1 1 unicorn
2 4 penguin
3 9 scylla
;
data nlits.' myth2'n;
input Root Square Animal $;
datalines;
4 16 harpy
5 25 sphinx
6 36 mermaid
;
proc template;
edit Base.Datasets.Members;
header hd1;
footer ft1;
define hd1;
preformatted=on;
just=l;
text' Table Header with Leading and Trailing Blanks ';
end;
define ft1;
preformatted=on;
just=l;
text' Table Footer with Leading and Trailing Blanks ';
end;
edit name;
define header myheader;
just=l;
preformatted=on;
text ' My new header';
end;
header=myheader;
width=memname_width width_max=memname_width_max;
preformatted=on;
end;
end;
run;
ods select members;
proc datasets lib=nlits;
run;
quit;
ods _all_ close ;
ods listing;