BookmarkSubscribeRSS Feed
PhilC
Rhodochrosite | Level 12
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.
4 REPLIES 4
PhilC
Rhodochrosite | Level 12
[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]
PhilC
Rhodochrosite | Level 12
[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
PhilC
Rhodochrosite | Level 12
[PRE] ... [/PRE]
Cynthia_sas
Diamond | Level 26
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

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 4 replies
  • 1446 views
  • 0 likes
  • 2 in conversation