Date: Mon, 29 Mar 2004 12:16:07 -0500
Reply-To: Quentin McMullen <quentin_mcmullen@BROWN.EDU>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Quentin McMullen <quentin_mcmullen@BROWN.EDU>
Subject: Re: converting .sas file to .html
Looks like the htmlencode function will replace my 3 calls to tranwrd, and
is more readable. I was happy to see from the docs that htmlencode only
deals with & < > , giving me a bit more confidence that those are all I
have to worry about. Nifty.
HTMLENCODE can encode the following three characters:
Character encodes as ...
On Mon, 29 Mar 2004 09:47:15 -0700, Alan Churchill
>Look at HTMLENCODE function.
>"Quentin McMullen" <quentin_mcmullen@BROWN.EDU> wrote in message
>> Thanks much Ed,
>> The job you sent produces an html file that is formatted more correctly
>> (and readably) than what mine spit out, but unfortunately it does not
>> achieve any of the symbol protecting/quoting/hiding that I am hoping
>> For example, if my macro code is:
>> %macro me(sum=
>> %if ¬e %then %put The sum is ∑
>> %if a<b %then %do;
>> %mend me;
>> The browser interprets ¬e as being an html symbol ¬ followed by
>> letter 'e', and "∑" is displayed as sigma. And everyting stops
>> a< because the browser takes the '<' as the start of a bad tag. My hope
>> was to find a way to quote the sas code so that when viewed in a
>> it would look like SAS code.
>> But working from within your example, it hit me that perhaps the only
>> important characters I need to quote are &, <, and >. Is that right?
>> so, than perhaps it is as easy as adding a few calls to tranwrd, e.g.:
>> Data _null_ ;
>> InFile sasCode("junklog.sas") end=eof ;
>> File sasCode("junklog.html") ;
>> If ( _n_ eq 1 ) then put
>> @01 '<!doctype html public "-//w3c//dtd html 4.0 final//en">'
>> / @01 '<html>'
>> / @04 '<head>'
>> / @07 "<title>My Macro </title>"
>> / @04 '</head>'
>> / @04 '<body>'
>> / @07 '<pre>'
>> Input ;
>> Put _infile_ ;
>> If eof then put
>> @07 '</pre>'
>> / @04 '</body>'
>> / @01 '</html>'
>> Run ;
>> Should that suffice as a home-made version of protectspecialchars? Or
>> there other chars I need to worry about?
>> Thanks again,