The syntax for the HTML Data Set Formatter is
%DS2HTM(argument=value, argument=value,...);
You must include the Data Set Formatter macro call with your SAS code. You cannot call it from a SAS command line. When including the macro call in your SAS code, you can use a list of arguments that are contained within parentheses and are separated with commas. You must end the invocation with a semicolon.
When naming files, avoid using certain reserved names. Click here to view a list of reserved names.
Note: Table support varies across browsers. Some of the formatting attributes supported by the Data Set Formatter are not recognized by all browsers. In most cases, a browser will ignore HTML tags that it does not recognize; however, this may produce undesirable output.
The Data Set Formatter macro uses the following argument types:
Most of the following arguments are required for the macro invocation. If the argument is required only in some cases, the exceptions are noted.
data=SAS-data-set-name
htmlfile=external-filename
Note: HTMLFILE
and HTMLFREF
are
mutually exclusive arguments.
htmlfref=fileref
Note: HTMLFILE
and HTMLFREF
are
mutually exclusive arguments.
openmode=APPEND | REPLACE
APPEND
to add your new HTML-enhanced output to the end of
an existing file. This argument is required only if you want to override
the default setting. Specify REPLACE
to delete the information
in an existing file and replace it with the new output.
Note: OPENMODE=APPEND
is not valid is you are writing
your resulting HTML to a PDS on z/OS.
pw=password
READ
or PW
password. (You do not need to use this if the data
set has only WRITE
or ALTER
passwords.)
proploc=property-list-name
runmode=I | B
RUNMODE=B
when running in batch
mode to avoid confusion.
You must include the argument when running in interactive mode, which is available
only with Release 6.12 of the SAS software.
If you are using the Data Set Formatter with the Application
Dispatcher, you must use RUNMODE=S
. Using
RUNMODE=S
tells
the formatter to print the HTTP header required by the Application Dispatcher
before creating any output. For more information, refer to the SAS/IntrNet Application Dispatcher
documentation at http://support.sas.com/documentation.
The following arguments supply information to the Data Set Formatter specifying how the data should be processed. These arguments are not required.
by=var1(options) var2(options) ...
When you use the BY argument with Data Set Formatter, the formatter creates a separate table for each BY group. If you want to include more than one variable, list each variable name and separate them with a space. Do not use a comma in the list of variable names.
You can specify any of the following options for a
specified variable. These options are not required and can be
used on some or all of the variables included on the BY
argument. If you specify more than one option for a variable, delimit
the options with a comma. The available options are:
order=ASCENDING | DESCENDING
ORDER
on one variable only.
ASCENDING
is the default, and orders the values in
ascending order (lowest to highest).
DESCENDING
orders the values of the specified variable
in descending order (highest to lowest).
format=SAS_format_name
style_tag=value
style_tag
can be either CLASS
or CLASSFMT
. For more information about using style
sheet support with the BY
argument, see
Applying styles to variables later in this discussion.
caption=value
Note: If using any special characters (for example, % , & ) in the CAPTION
argument, include %NRSTR
in the argument in order to process
these characters correctly. This example will handle A,B,& C
correctly:
caption=%NRSTR(Appending to Examples,B,& C)
formats=Y | N
labels=Y | N
LABELS=N
to use variable names instead of the SAS labels as your column labels.id=var1 var2 ...
For information about applying styles, see Applying styles to variables later in this discussion.
obsnum=Y | N
OBSNUM=Y
to include the
observation numbers.round=number
Note: For better formatted output, apply a format to the appropriate data values prior to invoking the Data Set Formatter.
sum=var1 var2 ...
Note that only the values in single variables are totaled. This argument does not total the sums of multiple variables.
For information about applying styles, see Applying styles to variables later in this discussion.
var=var1 var2 ...
For information about applying styles, see Applying styles to variables later in this discussion.
where=where-expression
WHERE-EXPRESSION
.
Note: If using any special characters (for example, % , & ) in the
WHERE
expression, include %NRSTR
in the argument in order to process
these characters correctly. This example will handle Int%
correctly:
where=%NRSTR(value="Int%")
The remaining arguments provide formatting information and represent the properties that you can change to create customized HTML output.
Note: The Data Set Formatter does not check for errors on fonts, colors, or sizes you specify. It simply allows any value you type. So, you should specify values that are supported on the system where the HTML page will be viewed.
These arguments apply to the entire page for the current invocation of the macro. So, if you append data, the attributes of existing results will not change. You may want to use these arguments only when you replace, rather than append, pages. The rendering of some formatting arguments varies per browser. Some browsers may not support some of these options.
To use the browser's attribute settings for those arguments below
where DEFAULT
is an option, specify DEFAULT
.
(Using DEFAULT
tells the Data Set Formatter to ignore settings in the property list.)
Otherwise, specify the value, for example, the color.
bgtype=NONE | COLOR | IMAGE
COLOR
or IMAGE
as the value, you must also use
the BG
argument. Valid values for BGTYPE
are
NONE
COLOR
BG
argument. If you specify
COLOR
as the value, you must also specify the color
in the BG
argument. IMAGE
IMAGE
as the value, you
must also specify the BG
argument to provide the name
and location of the image. Some browsers may not support the use
of background images.bg=value
BGTYPE=IMAGE
, this identifies the
fully-qualified path and filename of a background image that you want
to use on your Web page. If you specified BGTYPE=COLOR
,
this indicates the specific background color you want to use on your
page. You can specify color values using the color name or the RGB
value.brtitle=value
center=Y | N
N
).
ctext=value | DEFAULT
TCOLOR
argument overrides the
value specified by CTEXT
. You can specify color values
using the color name or the RGB value.
doctype=3.2 | value
DOCTYPE
tag in the HTML file. The default value is 3.2
, which
writes the following line to the top of your HTML file:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
If you want something other than the default text, you can
provide the exact line to be added. If you supply a blank for
value
, nothing is added to the top of the file.
If you supply a value other than 3.2, you must include the exact
text that you want added. For example, if you want to reference
a different DTD, you must provide the entire string, including
!DOCTYPE
and the opening and closing angle brackets.
encode=Y | N
Y
.
This will display the actual brackets in the browser. By default, the brackets will be encoded.
To not encode them and have the Data Set Formatter pass the brackets to the browser (where the browser
will attempt to act on them as an HTML-formatting instruction), select
N
.pagepart=ALL | HEAD | BODY | FOOT
ALL
HEAD
HEAD
when you are going to append
additional output from one of the Formatters to this file.BODY
FOOT
For more information, see Using Page Formats.
saspower=value
Note: To display an image and automatically link to the SAS Web site when
running in interactive mode, you must include the argument along with
the %DS2HTM
macro call. The following example shows how to
include the SASPOWER
argument in interactive mode:
%ds2htm(runmode=i, saspower=saspower.gif);
Use of this image is by permission only. See the Powered by SAS logo guidelines and agreement. |
septype=NONE | RULE | IMAGE
NONE
RULE
<HR>
tag (a horizontal rule) to the HTML
file following the end of the table.IMAGE
IMAGE
, you must also specify the
SEPLOC
argument to provide the name and location of the
image that you want to use. seploc=image-location
SEPTYPE=IMAGE
. The
value for this argument should be a fully-qualified pathname
or valid URL.
Use the following attributes to define the formatting structure
of the table. These attributes contribute information to the
HTML <TABLE>
tag.
border=Y | N
Y
, which turns borders on for the table. The
width of the border is determined by the value of the
BWIDTH
argument.bwidth=value
1
.cpad=value
1
. The value specified for
this argument is represented in the HTML as CELLPADDING
.
cspace=value
1
. The value
specified for this argument is represented in the HTML
as CELLSPACING
.talign=LEFT | CENTER | RIGHT
CENTER
. Some browsers produce unexpected results
with multiple tables and anything other than CENTER
.
tbbgcolr=value | DEFAULT
CLBGCOLR,
OBGCOLR, IBGCOLR, VBGCOLR
, or SBGCOLR
arguments,
which override the setting of TBBGCOLR
. twidth=value
100
. The units for this value are determined by the
TWUNITS
argument.twunits=PERCENT | PIXELS
PERCENT
.The Data Set Formatter lets you change text color, fonts, and font sizes for the following elements on a table:
In addition, the Data Set Formatter allows you to change the background for the following elements:
The table illustrates the locations of some of these elements.
The default for each of these arguments is to use no color.
The remainder of the arguments control the formatting of individual elements in the table output. If you specify formatting information for an element not included in your table, the information is simply ignored.
The elements include the following:
To use the browser's attribute settings for those arguments below
where DEFAULT
is an option, specify DEFAULT
.
(Using DEFAULT
tells the Data Set Formatter to ignore settings in the property list.)
Otherwise, specify the
value, for example, the color.
When you specify any of
these arguments, an HTML tag such as <FONT COLOR=value>
is
added to all the appropriate lines in your HTML-formatted output.
tcolor=value | DEFAULT
tface=value | DEFAULT
tsize=value | DEFAULT
N
, +N
, and -N
,
where N
is an integer. Valid values for N
are browser specific.ttag=value
PREFORMATTED + HEADER 3
.
For a list of all of the valid HTML tag names that you can use with this argument, see the list of available tags provided with the Data Set Formatter.
The following discusses the syntax necessary to utilize BY-group processing. For an overview of this feature, see BY-Group Processing with the Data Set Formatter.
bcolor=value | DEFAULT
bface=value | DEFAULT
bsize=value | DEFAULT
N
, +N
, and -N
, where
N
is an integer. Valid values for N
are
browser specific.btag=value
NO FORMATTING
.bwrap=Y | N
Y
) causes each BY group heading for a table to be printed
on a separate line. If you want all BY group headings for each table
printed on the same line, specify N
.
prtfoot=ALL | LAST
LAST
ALL
prtpower=ALL | LAST
LAST
ALL
prttitle=ALL | FIRST
FIRST
ALL
sqlview=Y | N
N
, indicates that
this is not an SQL view. If this is an SQL view and you are using
BY processing, you must specify SQLVIEW=Y
.
The table caption
ccolor=value | DEFAULT
cface=value | DEFAULT
chalign=LEFT | CENTER | RIGHT
CENTER
, locates the text in the center above the table. Specify
LEFT
(or RIGHT
) if you want the caption text to appear to the left (or right)
the table.csize=value | DEFAULT
N
, +N
, and -N
,
where N
is an integer. Valid values for N
are browser specific.ctag=value
NO FORMATTING
.
For a list of all of the valid HTML tag names that you can use with this argument, see the list of available tags provided with the Data Set Formatter.
cvalign=TOP | BOTTOM
TOP
, locates the text above the table. Specify
BOTTOM
if you want the caption text to appear below
the table.The table column label cells
clbgcolr=value | DEFAULT
clcolor=value | DEFAULT
clface=value | DEFAULT
clhalign=LEFT | RIGHT | CENTER
clsize=value | DEFAULT
N
, +N
, and -N
,
where N
is an integer. Valid values for N
are browser specific. cltag=value
NO FORMATTING
.
For a list of all of the valid HTML tag names that you can use with this argument, see the list of available tags provided with the Data Set Formatter.
clvalign=TOP | BOTTOM | MIDDLE | BASELINE
clwrap=Y | N
Y
) is to allow word wrapping.obgcolr=value | DEFAULT
ocolor=value | DEFAULT
oface=value | DEFAULT
ohalign=LEFT | RIGHT | CENTER
osize=value | DEFAULT
N
, +N
, and -N
,
where N
is an integer. Valid values for N
are browser specific.otag=value
NO FORMATTING
.
For a list of all of the valid HTML tag names that you can use with this argument, see the list of available tags provided with the Data Set Formatter.
ovalign=TOP | BOTTOM | MIDDLE | BASELINE
The ID variable
ibgcolr=value | DEFAULT
icolor=value | DEFAULT
iface=value | DEFAULT
ihalign=LEFT | RIGHT | CENTER
isize=value | DEFAULT
N
, +N
, and -N
,
where N
is an integer. Valid values for N
are browser specific.itag=value
NO FORMATTING
.
For a list of all of the valid HTML tag names that you can use with this argument, see the list of available tags provided with the Data Set Formatter.
ivalign=TOP | BOTTOM | MIDDLE | BASELINE
iwrap=Y | N
Y
) is to allow word wrapping.
The variable
vbgcolr=value | DEFAULT
vcolor=value | DEFAULT
vface=value | DEFAULT
vhalign=LEFT | RIGHT | CENTER
vsize=value | DEFAULT
N
, +N
, and -N
,
where N
is an integer. Valid values for N
are browser specific.vtag=value
NO FORMATTING
.
For a list of all of the valid HTML tag names that you can use with this argument, see the list of available tags provided with the Data Set Formatter.
vvalign=TOP | BOTTOM | MIDDLE | BASELINE
vwrap=Y | N
Y
) is to allow word wrapping.
The variable sums
sbgcolr=value | DEFAULT
scolor=value | DEFAULT
sface=value | DEFAULT
shalign=LEFT | RIGHT | CENTER
ssize=value | DEFAULT
N
, +N
, and -N
,
where N
is an integer. Valid values for N
are browser specific.stag=value
NO FORMATTING
.
For a list of all of the valid HTML tag names that you can use with this argument, see the list of available tags provided with the Data Set Formatter.
svalign=TOP | BOTTOM | MIDDLE | BASELINE
fcolor=value | DEFAULT
fface=value | DEFAULT
fsize=value | DEFAULT
N
, +N
, and -N
,
where N
is an integer. Valid values for
N
are browser specific.ftag=value
PREFORMATTED + HEADER 3
.
For a list of all of the valid HTML tag names that you can use with this argument, see the list of available tags provided with the Data Set Formatter.
tranlist=transcoding-list-name
charset=character-set-name
For a description of these arguments and an explanation about how to use them, see Implementing Character Transcoding in "Character Transcoding and National Language Support."
Use the following arguments to specify the location of your style sheets. These arguments are valid for all formatters and are described in Syntax for Including Style Sheets:
sshref1-sshref5=value
sstype1-sstype5=value
ssrel1-ssrel5=value
ssrev1-ssrev5=value
sstitle1-sstitle5=value
ssmedia1-ssmedia5=value
ssfile1-ssfile5=value
ssfref1-ssfref5=value
Applying styles to page elements
bclass=value
bdclass=value
fclass=value
sepclass=value
RULE
, the
supplied value is used on the CLASS
attribute of the
HR
tag. For an IMAGE
separator, the supplied
value is used on the CLASS
attribute of the IMG
tag.spclass=value
tclass=value
Applying styles to table elements
cclass=value
clclass=value
oclass=value
rowssvar=value
TR
tag of the row
that contains the variable.
For more information about ROWSSVAR
and
ROWSSFMT
, see Formatting
rows based on the variable.
rowssfmt=value
ROWSSVAR
. You cannot use
this argument unless you are also using ROWSSVAR
.
For more information about ROWSSVAR
and
ROWSSFMT
, see Formatting
rows based on the variable.
tbclass=value
In order to support styles for the variable arguments
BY, ID, SUM,
and VAR
, we have enhanced
these arguments. You can continue to use them as you have in
the past (as they are described earlier in this document). The
usage described in this section explains how to utilize style
sheets with these variables.
Each of the variable arguments now accepts style tags. If you are applying styles to any of these variables, they appear as follows:
by=var1(style-tags) var2(style-tags) ...
id=var1(style-tags) var2(style-tags) ...
sum=var1(style-tags) var2(style-tags) ...
var=var1(style-tags) var2(style-tags) ...
Each of the variable arguments now accepts the following
style tags: (CLASS=value)
or
CLASSFMT=value)
.
value must be a valid CLASS defined in your style sheet.
See Formatting table cells based on the
variable for examples that use CLASSFMT
.
class=value
CLASS
argument, the
same HTML formatting instruction is applied to every cell in the
column that contains the variable.
You cannot use CLASS
and CLASSFMT
together with an argument.
classfmt=value
CLASSFMT
argument enables you to apply a specific HTML formatting instruction
to each cell that contains the variable.
You cannot use CLASS
and CLASSFMT
together on an argument.
Note: z/OS is the successor to the OS/390 and MVS operating systems. SAS/IntrNet 9.1 for z/OS is supported on the MVS, OS/390, and z/OS operating systems and, throughout this document, any reference to z/OS also applies to OS/390 and MVS, unless otherwise stated.