The HTML Formatting Tools create valid HTML page formats without requiring you to know what they are. However, as browsers and scripting continue to evolve, and Web users start demanding more from their Web pages, you may want more flexibility in how the page format is written in each file you create. For this reason, the Formatters include some syntax arguments that offer you the flexibility to control these formats.
Before we go any further in describing the types of customization you can perform. Let's define what we mean by page formats. The page format includes the following:
<DOCTYPE>tag, which is the first line added to the HTML file
<BODY>tags. These tags are collectively referred to as the header. The header also includes all tags that are valid between the open
<HEAD>tag and the end
</HEAD>tag, which can include the style sheet
<BODY>tag and the closing
</BODY>tag. This part of an HTML file is referred to as the body of the file.
</HTML>tags at the end of the file. These tags are collectively referred to as the footer.
You can control the use and contents of the
header element by specifying the
DOCTYPE argument when
you invoke any of the Formatters. By default, the Formatters write
the following line to the top of your HTML file:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
To add text for DOCTYPE other than the default text, you
must provide 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.
If you do not want
<DOCTYPE> added to your file at all,
DOCTYPE= when you invoke a Formatter.
In almost all cases, you want your file to include the HTML header and footer. What you don't want is for these tags to be included in the middle of an HTML file. This can happen when you append the resulting HTML output to an existing file.
To avoid getting the header and footer tags in the middle of your
HTML file, use the
PAGEPART argument. The default
behavior of the
PAGEPART argument is to write the HTML
header information, your SAS data or output, and the HTML footer
information to the file. This is the behavior you want if you are
creating a new file or replacing the contents of an existing file
and you are not appending more information to this file once
it is created.
PAGEPART argument also allows you to include:
For example, the Formatter invocations in your SAS program might look like the following:
%ds2htm(htmlfile=myfile.html, openmode=replace, runmode=b, doctype=3.2, pagepart=head, data=monthly, where=year eq 1996, caption=Information for 1996); <some code omitted> %out2htm(htmlfile=myfile.html, capture=off, window=output, openmode=append, pagepart=body, runmode=b, tcolor=red, hcolor=blue); <more code omitted> %ds2htm(htmlfile=myfile.html, openmode=append, pagepart=foot, data=monthly, obsnum=y, where=year lt 2000, var=year month begpri payment int repay endpri, sum=payment int repay, caption=Information prior to the year 2000);
In addition to controlling the
the HTML Formatters give you the ability to include
style sheet and script information. You can link to or embed style
sheet information using the following tags:
arguments instruct the Formatters to collect the text contained
in the specified file and write that text
tags exactly as it appears in the referenced file. Using these
arguments, you can include any text you want into your HTML file.
For example, you may want to include the following types of information: