The SAS Output Delivery System and reporting techniques

adding javascript to tagsets.default / proc template?

Reply
Regular Contributor
Posts: 156

adding javascript to tagsets.default / proc template?

I want to add javascript to the header of my output. I want to use tagsets.default, and I want the javascript I want the javascript to execute when the page has finished loading. (This means I want to add my code to function startup() which tagsets.default makes. ) How do I implment this? For all that I've seen I believe I can do it, but all I have tried has failed. The following is what I thnk the solution might look like. Perhaps I'm going the wrong way with this. Please help. Thanks in advance.
Regular Contributor
Posts: 156

Re: adding javascript to tagsets.default / proc template?

[PRE]
proc template;
define tagset tagsets.FCDF_FacHist /store=sasuser.templat;
parent=tagsets.default ;
end;
define event startup_function;
start:
put 'function startup(){' /;
put ' var hstolist = document.getElementsByTagName(''td'');' /;
put ' for (i=0; i put ' var className=hstolist.className;' /;
put ' if (className && className.search(/Data/) > -1){' /;
put ' value=hstolist.innerHTML.valueOf();' /;
put ' if (value<1)hstolist.innerHTML="";' /;
put ' else ' /;
put ' hstolist.innerHTML=''
put ' '' cellspacing=0 cellpadding=0 vspace=1>
'';' /;
put ' }' /;
put ' }' /;
put ' return;' /;
finish:
put "}" /;
end;
run;

ODS tagsets.FCDF_FacHist;
proc tabulate data=Fachist FORMAT=10.0;
where field=1 and facility<100;
FORMAT field field.;
FORMAT month mmm.;
*FORMAT facility facility.;
class field month year facility;
var score;
table field="", Facility, year=""*month=""*score="";
keylabel sum="";
run;
ODS tagsets.FCDF_FacHist close;
[/PRE]
Regular Contributor
Posts: 156

Re: adding javascript to tagsets.default / proc template?

[PRE] put ' var className=hstolist(i).className;' /;
put ' if (className && className.search(/Data/) > -1){' /;
put ' value=hstolist(i).innerHTML.valueOf();' /;
put ' if (value<1)hstolist(i).innerHTML="";' /;
put ' else ' /;
put ' hstolist(i).innerHTML='' put ' '' cellspacing=0 cellpadding=0 vspace=1>
'';' /;
put ' }' /;
put ' }' /;
put ' return;' /;
finish:
put "}" /;
end;
run;

ODS tagsets.FCDF_FacHist;
proc tabulate data=Fachist FORMAT=10.0;
where field=1 and facility<100;
FORMAT field field.;
FORMAT month mmm.;
*FORMAT facility facility.;
class field month year facility;
var score;
table field="", Facility, year=""*month=""*score="";
keylabel sum="";
run;
ODS tagsets.FCDF_FacHist close;
[/PRE]

Message was edited by: Philip C

Message was edited by: Philip C
Regular Contributor
Posts: 156

Re: adding javascript to tagsets.default / proc template?

[PRE] ... [/PRE]
SAS Super FREQ
Posts: 8,743

Re: adding javascript to tagsets.default / proc template?

Hi:
Look at the example, described here for creating your own 508 compliant tagset:
http://support.sas.com/kb/24/312.html

They show the javascript being added to the doc_body event. Here's another Tech support note that shows adding JavaScript via the HEADTEXT option.
http://support.sas.com/kb/23/645.html

Tagsets can be tricky. For the most thorough help with this question, you might consider contacting Tech Support.

cynthia
Ask a Question
Discussion stats
  • 4 replies
  • 163 views
  • 0 likes
  • 2 in conversation