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

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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
  • 850 views
  • 0 likes
  • 2 in conversation