The SAS Output Delivery System and reporting techniques

ods markup xhtml and id for element th and td

Posts: 58

ods markup xhtml and id for element th and td

Hi to all,
I've started to use the XHTML template described and provided here:
and with a bit of customization I've already rendered the pages I generate XHTML strict compliant.
However, I'm looking forward something more difficult, which I need: I've to generate tables (so from proc tabulate to the xhtml through ods) that must be readable also through a screen reader.
What is suggested is that the elements of a complex table should have an id and a the td he correspondent header it's always possible to associate which element to which column.
Is that feasible? Any idea at all?

Posts: 9,371

Re: ods markup xhtml and id for element th and td

Posted in reply to DanieleTiles
Hi, Daniele:
So does that mean you want to have this:<th id="xxx">Hdr1</th>
generated by your XHTML tagset instead of a simple: <th>Hdr1</th> ???

One way to insert an ID= string into your Markup Language output tags is to use the HTMLID= style attribute. However, the tagset that you're modifying or creating must have a DEFINE EVENT block for putting the HTMLID= value in the output file.

For example, the HTML3 destination automatically puts the HTMLID value into the HTML output file as an ID= option in order to link the ID= value to a style attribute or a Javascript action. (see the output from the code below. Note that you must view the HTML source in Notepad to see the ID= value.)

So if you were going to generate a custom tagset to get ID= into your output, you might look at the way PROC TABULATE syntax and PROC PRINT syntax inserts the HTMLID= value into this form of HTML output. Perhaps this will give you a way to decide how you're going to further change the event in your custom tagset template to get the ID= option that you want into your output file.

If you are planning to use JavaScript with your eventual XHTML output file, you might find this topic of interest: (please note that this topic is discussing the insertion of JavaScript via the use of a STYLE template and not a TAGSET template.)

For more help and some examples of modifying a TAGSET template, refer to this site:

If you are dealing with Regulation 508 accessibility requirements, then this site might be helpful:


*** the code to test;
*** although this doesn't show ID= with XHTML, it does;
*** show how you specify HTMLID= and where each syntax change affects;
*** the HTML file. By examining this default HTML output you will get;
*** some idea of how/where you need to make changes in your XHTML;
*** tagset template to surface HTMLID= in your XHTML output file.;

ods html3 file='testid_ht3.html' style=sasweb;
proc tabulate data=sashelp.class
title 'tabulate title';
class age / style={htmlid="xxx"};
classlev age /style={htmlid="ricky"};
var height / style={htmlid="yyy"};
table age all,
height*(mean n*f=3.)
/ style={htmlid="lucy"};

proc print data=sashelp.class
title 'print title';
var name ;
var age height/
ods _all_ close;

SAS Employee
Posts: 6

Re: ods markup xhtml and id for element th and td

Posted in reply to DanieleTiles
Did this answer what you were seeking? With Jen Harper, I did a paper and presentation at WUSS 2006 that may interest you:Information for All: Why and How to Make Accessible SAS Output -

I'd like to compare notes, if possible.

Ask a Question
Discussion stats
  • 2 replies
  • 3 in conversation