Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ODS HTML

Status
Not open for further replies.

shenniko

Programmer
Apr 15, 2005
52
US
Hi Guys need a little help again,

I've noticed that when using ODS HTML it auto inserts some JavaScript:-

Code:
<SCRIPT LANGUAGE="JavaScript">
<!-- 
// This script is to load all object onLoad() functions 
function startup(){ }
function shutdown(){ }
//-->
</SCRIPT>

into the HTML files, which is causing some major problems with our Mail Server (as SAS auto sends the HTML files). The Mail Server will block anything that has JavaScript in it..

Is there a way to remove all JavaScript from the ODS HTML?

Thanks in advance

Shenn
 
You could try re-writing the ODS HTML tagset... (not actually as difficult as it sounds.)
It's possible that this is the same piece of code which causes every SAS HTML page I open up to be given a warning that it contains a Java applet...

I'll see if I can get the code for creating the ODS HTML tagset, once you've got that, it's just a case of finding the section which inserts that bit of javascript, commenting it out, and creating a new tagset with it.
Proc Template can be used to get the source code of a tagset, might be able to use it to get out the source code for ODS HTML as well. If I don't get back to you (I'm pretty snowed under here), that's where you should start looking.
An alternative is some post-processing of the file to strip the section of code out, this is obviously not so ideal.
 
OK, submit the following code...
Code:
proc template;
  *list;
  source tagsets.html4;
  source tagsets.htmlcss;
  source tagsets.phtml;
run;
(the "list;" line was used to find the relevant tagset, it lists every tagset and stylsheet you have defined. I commented it out after running it once as I didn't need it, but left it here so you can see the way I reached this point).
This dumps the source code of the 3 tagsets HTML4, HTMLCSS and PHTML into your log file.
HTML4 (the tagset which is called when you use ODS HTML) has HTMLCSS as a parent, which in turn has PHTML as a parent. PHTML is the tagset which contains the instruction to put that little bit of Java script.
My suggestion would be copy and paste this code together, removing the "parent" statements from the first two and build a new tagset which does not include the javascript components. (if this doesn't work, create 3 new tagsets with different names (I usually use the same name with my companies initials at the start) and change the "Parent" statements at the end of HTML4 and HTMLCSS to point at the new versions).


I would also be very careful to not change the existing tagsets in anyway, create new tagsets and use those instead of the existing ones to avoid breaking anything already using these tagsets.

Take it slow, make one change at a time and see how it affects the output (both in raw text, and through the web-browser) to make sure the effects are what you were after. I know the TAGSETS look horrendous, but basically they just boil down to a bunch of statements that write out text strings depending on certain events occuring during the creation of the output file. These "events" are just tags which SAS passes out with its output file.
Any problems, just post 'em here. And post your solution when you get it working, I'd be interested to see the results.
Be warned, this process may in fact cause the HTML results to not work correctly, I imagine that the JAVSCRIPT component is there for a reason...
 
One more tip. Before embarking on this process, open the html file in a text editor and make the changes there that you plan to enact through SAS, and see how it affects the file.
I just went through and removed the two chunks of JavaScript from the file and refreshed the page. This generated an error (a little yellow 'caution' icon in the bottom left hand corner of my browser) saying an error was encountered on a specific line. This line was trying to use a component which I'm guessing was set up by the javascript. I removed this as well, and it loaded fine after that, except my stylesheet wasn't working correctly anymore, background colour was no longer set to white, but to my computers background colour (a pale cream colour which is easier on the eyes). This isn't ideal when you want to control the look and feel of your reports.
You may need to look at alternative methods for mailling your results...
 
Hi Chris,

Thanks for the quick relpy.

I've got the source code for the x3 tagsets you listed, but only x2 of them have source code:-

source tagsets.htmlcss;
source tagsets.phtml;

Having copied the source code and re-named the tagsets, i tried just running them (no other editing), and get the below errors right away:-

Code:
ERROR: Symbol 'body' must be declared as DYNAMIC/MVAR/NMVAR.
NOTE: SCL source line.
17539        put """" NL / if exist( );
                                     -
                                     22
                                     76
NOTE: SCL source line.
17845     stacked_columns;
                         -
                         73
                         76
WARNING: Object will not be saved.
NOTE: PROCEDURE TEMPLATE used:
      real time           0.01 seconds
      cpu time            0.01 seconds

WARNING: Errors were produced.
NOTE: The SAS System stopped processing this step because of errors.

ERROR 22-322: Syntax error, expecting one of the following: a name, a quoted string, ANCHOR,
              ASIS, AUTHOR, BACKGROUND, BACKGROUNDIMAGE, BASENAME, BODYSCROLLBAR, BODYSIZE,
              BORDERCOLOR, BORDERCOLORDARK, BORDERCOLORLIGHT, BORDERWIDTH, BOTTOMMARGIN,
              BULLET, CELLHEIGHT, CELLPADDING, CELLSPACING, CELLWIDTH, CLABEL, COLCOUNT,
              COLEND, COLSPAN, COLSTART, COL_ID, CONTENTPOSITION, CONTENTSCROLLBAR,
              CONTENTSIZE, CSSSTYLE, CSSTEXT, DATE, DNAME, EMPTY, ENCODING, EVENT_NAME,
              FILLRULEWIDTH, FLYOVER, FONT, FONT_FACE, FONT_SIZE, FONT_STYLE, FONT_WEIGHT,
              FONT_WIDTH, FOREGROUND, FRAME, FRAMEBORDER, FRAMEBORDERWIDTH, FRAMESPACING,
              HREF, HREFTARGET, HTMLCLASS, HTMLCONTENTTYPE, HTMLDOCTYPE, HTMLID, HTMLSTYLE,
              JUST, LABEL, LANGUAGE, LEFTMARGIN, LINKCOLOR, LISTENTRYANCHOR,
              LISTENTRYDBLSPACE, MISSING, NAME, NOBASE, NOBREAKSPACE, OPERATOR, OUTPUTHEIGHT,
              OUTPUTWIDTH, OVERHANGFACTOR, PAGEBREAKHTML, PATH, POSTHTML, POSTIMAGE, POSTTEXT,
              PRECISION, PREHTML, PREIMAGE, PRETEXT, PROTECTSPECIALCHARS, RAWVALUE, REF_ID,
              RIGHTMARGIN, ROW, ROWSPAN, RULES, SASLONGVERSION, SASVERSION, SCALE, SECTION,
              SPACE, SPLIT, STATE, TAGATTR, TARGET, TEXT, TIME, TITLE, TOC_LEVEL, TOPMARGIN,
              TRANTAB, TRIGGER_NAME, TYPE, URL, VALUE, VISITEDLINKCOLOR, VJUST, WATERMARK,
              WIDTH, XMLDATAFORM, XMLSCHEMA.
ERROR 76-322: Syntax error, statement will be ignored.
ERROR 73-322: Expecting an =.

Some of the errors i can figure out,

E.g
The
Code:
put """" NL / if exist( );

Should have a variable name in it, but for what im not 100% sure.

The stacked_columns; error should apparently be stacked_columns = yes or no;

But the main error that i cant understand is the first error :-
Code:
ERROR: Symbol 'body' must be declared as DYNAMIC/MVAR/NMVAR.

Which points to this line of code:-
Code:
   define event bodystyle;
      put "body {" NL;
      trigger stylesheetclass;
      put "}" NL;
      style = body;
   end;
And the error appears with every Define event ####style; tag on there.

Any ideas?

Thanks in advance

Shenn
 
Not really sure what's going on there. Everything I've done with ODS tagsets has been trial and error. Are you on SAS Version 8? If so, that'll be why there's no HTML4 (which is a version 9 tagset), the tagset will probably be called HTML instead, try using just the "LIST" command to look for it..)
Make sure that you run the tagsets in reverse order (ie, run the parent tagset first.. (the new PHTML, then new HTMLCSS then the new HTML...). That might be the case of the problem.
 
Well i've kinda managed to sort it out without creating new Tagset's.

By using the No_Top_Matter and No_Bottom_Matter that removes all the Javascript code, then i just use the infile to re-create the top and bottom HTML tags.. Its not a perfect fix, but it works.

Thanks for the help, and ill still look into making my own tagset for future use.

Shenn
 
No worries. Sounds like an ugly solution to an awkward problem.
Have you tried talking to your IT people and seeing if there is a way around the problem from their side? IE allowing sending of SAS reports which contain Javascript code, or writing the report to a location which the recipients have access to (a web server or network drive) and e-mailling them just a link to the report from within SAS...
 
Well the main problem is our company and another company have merged, and we still havent merged our systems yet, we usually get sas to FTP our reports to an internal Intranet, but the other company cant access it yet. So the only other option is to e-mail it.. which again is causing problems..

The method listed above isnt really that difficult, especially with a few years web design in my background. But it is only a temp fix untill i get some time to play with the Tagset.

Thanks again for your help, and when i get time to look at it (and get a working version) ill upload it to here.

Shenn
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top