Formatting Your Results

Using Style Sheets

Style sheet support is new to version 1.2 of the Formatting Tools. This support provides increased flexibility for formatting your output by enabling you to take advantage of Cascading Style Sheets (CSS) and JavaScript Style Sheets (JSS). Using style sheets is optional and is recommended only for those users who are familiar with creating and implementing style sheets.

Note: Currently, the HTML Formatting Tools do not support the ID element of style sheets.

Style sheet support allows you to reference up to five style sheets. Your style sheets can contain any information that is valid in an HTML file between the begin and end HEAD tag. You can include the style sheets by linking to them, using a LINK tag, or by embedding the text of the style sheet in the header of your HTML file.

This topic includes

Guidelines for Including Style Sheets

Syntax for Including Style Sheets

The style sheet syntax includes arguments that specify

The only arguments defined here are those used to include style sheets in the HTML file. All other arguments are discussed in the syntax sections of each formatter.

Arguments used with the link method

When you use the link method, the style sheet is referenced using a LINK tag. The line added to your HTML file might look like the following (assuming that you specified all of the necessary information):

   <LINK HREF="1qtr98.css" TYPE="text/css" REL="stylesheet" MEDIA="screen">

The following define the arguments that you can use with the link method. Each one of these arguments specify a value on the LINK tag. For more information about linking files using the LINK tag, refer to your favorite HTML guide.

Note: Do not include the quotes when you specify a value for the following arguments. The Formatting Tools supply the proper quoting.

sshref1-sshref5=value
specifies the URL for the style sheet. The URL that you supply must be relative to the location of the resulting HTML file. If the file and the style sheet reside on different Web servers, you should supply the absolute URL. The value you supply is used with the LINK HREF attribute.

You cannot specify SSHREFn and the corresponding SSFILEn or SSFREFn. For example, if you use SSHREF1, you cannot use SSFILE1.

sstype1-sstype5=value
indicates the type of file to which you are linking. If you are using a Cascading Style Sheet, this value is usually text/css. If you are using JavaScript Style Sheets, this value is text/javascript. The supplied value is used on the TYPE attribute.

ssrel1-ssrel5=value
specifies the relationship of the linked to file to the file that contains the link. This value will usually be stylesheet. The supplied value is used on the REL attribute.

ssrev1-ssrev5=value
specifies the value used on the REV attribute.

sstitle1-sstitle5=value
specifies the value used on the TITLE attribute.

ssmedia1-ssmedia5=value
specifies the value used on the MEDIA attribute.

Arguments used with the embed method

When you use the embed method, the contents of the file you reference is actually copied into the header of the HTML file. You can use the embed method to include style or scripting information from multiple files into the HTML file created by the Formatter.

ssfile1-ssfile5=value
specifies the name of the file that represents the style sheet to be included. The file must contain all necessary tags and elements, and the contents of the file must work with other files you are embedding.

For example, the first file you embed may contain the STYLE tag but it does not end the <STYLE> tag. The next file you embed may not contain a <STYLE> tag, but it does contain the end tag, </STYLE>.

Note: You cannot specify SSFILEn and the corresponding SSHREFn or SSFREFn. For example, if you use SSFILE1, you cannot use SSHREF1.

ssfref1-ssfref5=value
specifies the fileref that represents the style sheet to be included. The file must contain all necessary tags and elements, and the contents of the file must work with other files you are embedding.

For example, the first file you embed may contain the STYLE tag but it does not end the <STYLE> tag. The next file you embed may not contain a <STYLE> tag, but it does contain the end tag, </STYLE>.

Note: You cannot specify SSFILEn and the corresponding SSHREFn or SSFREFn. For example, if you use SSFILE1, you cannot use SSHREF1.

How to Use Style Sheets

If you plan to use style sheets for your output, do the following:

  1. Decide if you are using one or multiple files and if you are linking to them or embedding them.

    If you are including the style sheet files, make sure that you provide the path to files and that the formatter can access the files in the specified location.

    If you are linking to the style sheet files, make sure the files can be accessed by the Web server that will serve your final HTML file.

  2. Create the file or files that contain your style information.

  3. Decide if you are going to define custom tags or use the syntax arguments that enable style sheets. (You can use a combination of these two methods.)

    1. Create the custom tags that include your style information if you need them.
    2. Add the necessary syntax for including style sheets to your macro call.

  4. Add the necessary CLASS information for each element of your output that you want to format using style sheets. You do this by adding the necessary syntax to your macro call.

    If you created custom tag descriptions, you may not need to perform this step.

  5. Run your SAS program or submit the formatter in batch mode.

  6. Move your resulting HTML file to its final location and verify that the formatting is correct. This is especially important if you chose to link to your style sheet files.