1

I am building a report which contains 3 html tables. The tables themselves are output via ODS HTML, then there is a final step which uses PUT statements to append these 3 raw HTML files into a final customised HTML report.

The trouble is I now need to reference each of these tables using Javascript - but there is no 'ID' tag. I'm sure it would be possible to reference the tables via the DOM, but it would be nice to do this explicitly - ie by setting the ID attribute of each table.

Is there an ODS HTML option which allows this? We are using version 9.1.3...

flag

1 Answer

1

SAS will output an anchor tag, with a name of IDX, with a number after the first item. If that is not sufficent you can have each of the steps wrapped it its own ODS HTML block and insert custom HTML using a DATA NULL step.

filename out 'c:\temp\sas.html';

data _null_;
put '<a name="tab1"></a>';
run;

filename out 'c:\temp\sas.html' MOD; /** Appends output to existing file **/

ods html body=out(notop nobot);
  proc print data=a;
  run;
ods html close;

data _null_;
put '<a name="tab2"></a>';
run;

ods html body=out(notop nobot);
  proc print data=b;
  run;
ods html close;

data _null_;
put '<a name="tab3"></a>';
run;

ods html body=out(notop nobot);
  proc print data=c;
  run;
ods html close;

Another alternative, would be to insert HTML into the title and footer statments;

title '<a name="tab1"><a>';
link|flag
thanks SBloom. I saw the IDX tag. It is actually a reference to the table object I need (not a link) so that I can manipulate the table values. I have actually done this now using the getelementbyTagName attribute (the tag being 'td'), but it would still be nice to know if we can insert the ID tag into ODS HTML... – NextLevel-IS Nov 23 at 21:30
You could look into creating a custom ODS template for the table. It has been awhile since I have dug into PROC TEMPLATE. – SBloom Nov 24 at 12:52

Your Answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.