SAS OnlineTutor HomeFAQ PageSuggested Learning PathsContents+Searchback||next

Producing HTML Output
Lesson Summary

This page contains


I. Text Summary

To go to the page where a task, programming feature, or concept was presented, select a link.

The Output Delivery System
The Output Delivery System (ODS) makes new formatting options available to you. ODS currently supports three destinations: Output, Listing, and HTML.

The ODS HTML Statement
You use the ODS HTML statement to open the HTML destination. Use the BODY= specification to create an HTML body file containing procedure results. You can also use the ODS HTML statement to direct the HTML output from multiple procedures to the same HTML file.

Closing the Listing Destination
By default, SAS procedures display output in the Output window using list output. However, an open destination uses system resources. It's a good idea to close the Listing destination before creating HTML output.

Creating a Linked Table of Contents
In order to manage multiple pieces of procedure output, you can use the CONTENTS= and FRAME = options with the ODS HTML statement to create a table of contents that links to your HTML output. The table of contents contains a heading for each procedure that creates output. By specifying the URL= suboption in the file specification, you can provides a URL that ODS uses in all the links that it creates to the file.

Changing the Appearance of HTML Output
You can change the appearance of your output using the STYLE= option in the ODS HTML statement. Preset style definitions are shipped with the SAS System. To view a full list of the available style definitions,

  1. click the Results tab on the Explorer window.
  2. right-click the Results icon and select Templates from the pop-up menu.
  3. in the Templates window, open Sashelp.tmplmst.
  4. open the Styles folder. A list of the available style definitions appears in the right panel of the Templates window.

Specifying a Path for Output
You can also use the PATH= option to specify the directory where you want to store your HTML output. When you use the PATH= option, you don't need to specify the full path name for the body, contents, or frame files.

Additional Features
ODS provides ways for you to customize HTML output using style definitions. Definitions are created using PROC TEMPLATE and describe how to render the HTML output or part of the HTML output.


II. Syntax

To go to the page where a statement or option was presented, select a link.

LIBNAME libref  'SAS-data-library';
ODS LISTING CLOSE; 
ODS HTML PATH=file-specification
          <(URL='Uniform-Resource-Locator' | NONE)>
          BODY=file-specification
          CONTENTS=file-specification
          PAGE=file-specification
          FRAME=file-specification
          STYLE=style-name;
PROC PRINT DATA=SAS-data-set;
RUN;
ODS HTML CLOSE; 
ODS LISTING; 


III. Sample Program
      libname clinic 'c:\data98\patients';
      ods listing close;
      ods html path='c:\records'(url=none)
               body='data.html'
               contents='toc.html'
               frame='frame.html'
               style=brick;
      proc print data=clinic.admit label;
         var id sex age height weight actlevel;
         label actlevel='Activity Level';
      run;
      proc print data=clinic.stress2;
         var id resthr maxhr rechr;
      run;
      ods html close;
      ods listing;


IV. Points to Remember
  • An open destination uses system resources. Therefore, it's a good idea to close the Listing destination before creating HTML output.

  • The ODS HTML CLOSE statement closes the HTML destination and is added after the RUN statement for the procedure.

  • If you use the CONTENTS= and FRAME= options, open the frame file from within your Web browser to view the procedure output and the table of contents.

back||next

 

Copyright © 2002 SAS Institute Inc., Cary, NC, USA. All rights reserved.
Terms of Use & Legal Information | Privacy Statement