• Print  |
  • Feedback  |

FOCUS AREAS

Hot Topics

Related Links

Return to ODS HTML

Base SAS

Scrollable Tables

A common problem with viewing large data tables in a Web browser is that the column headers only occur at the very top of the table. After you've scrolled down several rows, you can no longer see the column headers. The <thead>, <tbody>, and <tfoot> HTML tags were created to support "static" headers and footers, but no browser supports that feature.

This topic provides a fix that should be supported in all releases of SAS. If you're running SAS 9.1, you can get this functionality from the downloadable htmlscroll tagset in ODS MARKUP. See also FAQ 4035 for alternate methods.

Scrolling tables can be emulated using JavaScript by actually modifying the content of the table on-the-fly. Now that most Web browsers support Document Object Model (DOM), this is possible to do in a browser independent way. To try out our implementation of this, simply download the JavaScript file and include it in your ODS output by adding the following line to the <head> section of your HTML file:

   <script language="JavaScript" src="scrolltable.js"></script>

Then add setupLongTables() to the onload= event of your <body> tag:

   <body onload="setupLongTables()">

Sample Output

As long as your browser supports DOM, the table on this page should be scrollable by clicking the '[top]', '[page up]', '[up]', '[down]', '[page down]', and '[bottom]' buttons. You can also use images for the buttons. See the notes in the JavaScript file on how to do this.

Details

Customizing

You can customize parameters for how long the table must be before it is converted into a scrolling table as well as how many rows to display in each batch. Read the comments at the top of the JavaScript file on how to use these.

Limitations

Due to the hierarchical structure of tabulate-style tables, the table scrolling code will not work on them.