New ODS PRINTER features for SAS 9.1
Escape Sequence
The new
(*ESC*) sequence will act as an escape character even
when ODS ESCAPECHAR is not set. Thus, it acts like '03'x in being
always available. The advantage over '03'x is that it works in any
context, not just in string-
expression contexts,
so it is supported in style attributes.
See
example code
under
Generate Contents List.
You can now move page numbers and dates by
setting the JUST= and VJUST= attributes in the style elements that
control them; for example:
style PageNo from TitleAndFooters /
Font = fonts("strongfont")
pretext = "--" posttext = "--"
cellpadding=0 cellspacing=0
just=c vjust=b
;
style BodyDate from Date /
just=l vjust=t
;
Page i of n
All in-line formatting continues to be preproduction in SAS 9.1.
The development team is adding new functions
while they work toward a production-level product.
New for SAS 9.1 is the preproduction in-line formatting function {LASTPAGE},
which provides the page count in PRINTER destinations when output does not contain images.
Here is an example:
ods escapechar='^';
proc template;
define style styles.pageof; parent = styles.printer;
Style PageNo from TitlesAndFooters /
font = fonts("strongFont")
cellpadding = 0 cellspacing = 0
pretext = "Page "
posttext = " of ^{lastpage}"
;
end;
run;
Improved Color/Background Options
The original COLOR/NOCOLOR options were confusing. COLOR controlled
both the default SAS/GRAPH device
and the printing of
background colors in cells and pages and such. For the sake of
compatibility these will still be honored, but we are breaking them up
into more specific options:
- COLOR=FULL
- Full-color graphs (default).
- COLOR=GRAY
- Grayscale graphs.
Alias: COLOR=GREY.
- COLOR=MONO
- Monocolor graphs.
Alias: COLOR=BW.
- NOBACKGROUND
- Suppress the printing of background colors
in text.
The old NOCOLOR option is equivalent to COLOR=GRAY NOBACKGROUND and now
COLOR is COLOR=FULL BACKGROUND.
Improved Table of Contents Options
- CONTENTS
- Generate a printable table of contents, like one
you'd get in a book. This is a new feature.
Alias: CONTENTS=YES/ON.
- NOCONTENTS
- Do not generate a printable table of contents.
Default.
Alias: CONTENTS=NO/OFF.
- BOOKMARKLIST=
- Control whether or not to generate and/or
display the list of bookmarks for the PDF file. This option can only be
set when initializing the destination; it cannot be reset later.
It has three possible values:
- BOOKMARKLIST=SHOW/YES/ON
- Generate a list of bookmarks for PDF.
Automatically displays the bookmarks when bringing up the PDF file.
Default.
Alias: BOOKMARKLIST
- BOOKMARKLIST=NONE/NO/OFF
- Do not generate the list of
bookmarks for PDF. The generation of the bookmarks themselves
(the "anchors") is not affected by the setting of this option, but is
rather controlled by BOOKMARKGEN.
Alias: NOBOOKMARKLIST
- BOOKMARKLIST=HIDE
- Go ahead and generate the bookmark
list but do not display it by default. Normally, when ODS PRINTER
generates the bookmark list it also sets a flag to tell Adobe Acrobat
Reader to display the bookmarks when it initially displays the file.
Whether you use BOOKMARKLIST=HIDE or BOOKMARKLIST=SHOW, the list is
still generated and can be displayed or hidden using icons in Adobe
Acrobat reader; the difference between HIDE and SHOW is just whether it
is initially displayed.
- BOOKMARKGEN
- Generate the bookmarks themselves. This is the
default state, and since there is no registry entry to alter that
default, only the negative form of this option serves any useful purpose.
We had once hoped to be able to turn the generation on and off during
the lifetime of the document, but that feature was dropped when it
turned out to be harder to implement than we thought, since the
perceived benefit of such a feature seems marginal in the first place.
Alias: BOOKMARKGEN=YES/ON
- NOBOOKMARKGEN
- Do not generate the default bookmark entries,
thus omitting them from the bookmark list, among other places. This
option automatically turns off BOOKMARKLIST since the list would
otherwise be empty when this option was used.
Alias: BOOKMARKGEN=NO/OFF
Caution: Bookmarks are
used not only for the bookmark list, but also for the CONTENTS list and
for external entries (such as URL=), so be careful with the use of this
option.
The existing NOTOC command means NOCONTENTS NOBOOKMARKS.
Also note that I am adding the BOOKMARK= alias for the ANCHOR= option.
This should make more sense to everybody since Acrobat calls these
things "bookmarks." The previous alias (which we are not discarding)
was NAMED_DEST, which is the internal PDF name but is not
known to most users.
Generate Contents List
The table of contents is produced with the new CONTENTS= option (see
above). To control the appearance of the table of contents, use the following
style elements:
- ContentTitle
- PreText is used for the title; other attributes control
the appearance of the title.
- PrintedContentsLabel
- PreText and PostText supply the indention and
leaders for the table of contents. Effectively wrapped "around" the
following:
-
ContentItem, ContentFolder, ContentProcName, ContentProcLabel
-
formatting of the contents strings themselves.
And these in-line functions can be used only in content lists:
- ^{tocentryindent <len>}
- Tells the amount to indent per level.
- ^{tocentrypage}
- Page number of the current TOC entry.
Typical usage:
Replace PrintedContentsLabel "Wrapper for the CONTENTS" /
PreText = "(*ESC*){tocentryindent 2em}"
PostText = " (*ESC*){leaders . }(*ESC*){tocentrypage}"
;
Leader Function
- ^{leaders <string>}
- Produces leaders; that is, it
repeats the string so as to fill up the remainder of the line between
the leader and the text following it. Typically used in tables of
contents.
Compression
ODS PDF output is now compressed by default, addressing one of our biggest
complaints about PDF in SAS 8.2. You can also use the
COMPRESS= option on the ODS PDF statement to change the compression
level. COMPRESS=0 gives the uncompressed output as in SAS 8.2.
COMPRESS=9 is the maximum, and COMPRESS=6 is the default.
(If the system option GENERIC is set, then COMPRESS=0 is the
default.)
This feature is production in SAS 9.1 and later, and preproduction in SAS 9.0.
ODS PRINTER now supports the NEWFILE= option just like the other ODS destinations.
This feature is production in SAS 9.2, and preproduction in SAS 9.1.
Suppress Borders on PDF Links
You can now suppress borders on PDF links.
For example code, see
SAS Note 24182.
This feature was added in SAS 9.0.
COLUMNS= and TEXT= Go Production
The existing TEXT= and COLUMNS= options are production in SAS 9.0 and later.
Here is some example code:
title;
/* close the OUTPUT window */
ods listing close;
ods pdf file="file.pdf" COLUMNS=2 NOTOC;
ods pdf TEXT="This will appear as a paragraph in my output";
proc print data=sashelp.shoes(obs=100) noobs;
var region product sales;
run;
/* close PDF and re-open the OUTPUT window */
ods pdf close;
ods listing;
Decimal Alignment
This feature is production in SAS 9.0 and later. For more information, see the
ODS DECIMAL_ALIGN statement
in the SAS online documentation.
More Support for PRE/POST/BACKGROUND IMAGE/TEXT
In SAS 8.2, PRETEXT, POSTTEXT, PREIMAGE, POSTIMAGE, and BACKGROUNDIMAGE are supported
only on table cells and paragraphs, and the PRE/POST IMAGE style attributes are supported
only on tables.
In SAS 9.0 and later, they are supported more broadly. All of the PRE/POST attributes are now supported
on tables, cells, paragraphs, and the body (the whole document).
BACKGROUNDIMAGE is supported in SAS 9.1.3. For example code, see
SAS Note 24319.