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
SAS Super FREQ
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

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

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