LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (June 2011, week 5)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Wed, 29 Jun 2011 11:59:22 -0500
Reply-To:   matt.pettis@THOMSONREUTERS.COM
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Matthew Pettis <matt.pettis@THOMSONREUTERS.COM>
Subject:   Re: Embedding/Passing throuh HTML to PROC PRINT table results in ODS HTML
Content-Type:   text/plain; charset="us-ascii"

SOLVED.

Hi All,

Ya Huang provided me the solution to this problem. The solution is to provide a option PROTECTSPECIALCHARACTERS=off to the PROC PRINT VAR statement. Below is the same code as the previous example I provided, with the solution implemented and some changed text to reflect the success of the change.

Thanks to Ya and Randy for their generous time and help, Matt

* -------------------------------------------------------------------- SAS-L Post: http://www.listserv.uga.edu/cgi-bin/wa?A2=ind1106d&L=sas-l&F=&S=&P=25727 -------------------------------------------------------------------- ;

* Way 1 -- nothing works.; data have; link1 = 'Embedded link in text <a href="http://target-link.com/index.htm">now works</a>.'; link2 = '<a href="http://target-link.com/index.htm">Tagging the whole text here works.</a>.'; link3 = '<a href="http://target-link.com/index.htm">Leading with tagged text"</a> works.'; run;

ods html file='c:\temp\test1.html'; proc print data=have; var link1 link2 link3 / style=[PROTECTSPECIALCHARACTERS=off]; run; ods html close;

* Way 2; data class; set sashelp.class; link1='<a href="http://target-link.com/index.htm">This one works!</a>'; link2 = 'Embedded link in text <a href="http://target-link.com/index.htm">now works</a>.'; link3 = '<a href="http://target-link.com/index.htm">Leading with tagged text"</a> works.'; run;

ods html file='c:\temp\test2.html'; proc print data=class; var link1 link2 link3 / style=[PROTECTSPECIALCHARACTERS=off]; run; ods html close;

-----Original Message----- From: Pettis, Matthew (Professional) Sent: Wednesday, June 29, 2011 11:35 AM To: SAS-L@LISTSERV.UGA.EDU Subject: RE: Embedding/Passing throuh HTML to PROC PRINT table results in ODS HTML

Hi All,

I received some help off-list from Randy Herbison and Ya Huang. Randy and Ya came up with an example that worked, but I am still not able to make my original work. Below I am including code that both works and doesn't work, and I am not sure why the stuff that doesn't work still doesn't work, or, for that matter, why what's working is actually working. Along with the code, I am including example HTML output from each type of line.

If anybody knows the rule(s) that are applying as to why HTML characters are sometimes escaped, and sometimes not, I'd love to hear. The only difference between the purely non-working and the partial working one is that I am set-ting an existing dataset in the working one, and am not doing so in the non-working one.

Thanks, Matt

* -------------------------------------------------------------------- SAS-L Post: http://www.listserv.uga.edu/cgi-bin/wa?A2=ind1106d&L=sas-l&F=&S=&P=25727 -------------------------------------------------------------------- ;

* Way 1 -- nothing works.; data have; link1 = 'Embedded link in text <a href="http://target-link.com/index.htm">has markup escaped - not expected</a>.'; link2 = '<a href="http://target-link.com/index.htm">Tagging the whole text here does not work.</a>.'; link3 = '<a href="http://target-link.com/index.htm">Leading with tagged text"</a> not working either.'; run;

ods html file='c:\temp\test1.html'; proc print data=have; run; ods html close;

/*HTML output:*/ /*<td class="l Data">Embedded link in text &lt;a href=&quot;http://target-link.com/index.htm&quot;&gt;has markup escaped - not expected&lt;/a&gt;.</td>*/ /*<td class="l Data">&lt;a href=&quot;http://target-link.com/index.htm&quot;&gt;Tagging the whole text here does not work.&lt;/a&gt;.</td>*/ /*<td class="l Data">&lt;a href=&quot;http://target-link.com/index.htm&quot;&gt;Leading with tagged text&quot;&lt;/a&gt; not working either.</td>*/

* Way 2 -- one thing working.; * Only difference I can see is that I am setting an existing dataset; data class; set sashelp.class; link1='<a href="http://target-link.com/index.htm">This one works!</a>'; link2='This does not <a href="http://target-link.com/index.htm">Work</a>'; link3 = '<a href="http://target-link.com/index.htm">Leading with tagged text"</a> not working either.'; run;

ods html file='c:\temp\test2.html'; proc print data=class; run; ods html close;

/*HTML output:*/ /*<td class="l Data">William</td>*/ /*<td class="l Data">M</td>*/ /*<td class="r Data">15</td>*/ /*<td class="r Data">66.5</td>*/ /*<td class="r Data">112.0</td>*/ /*<td class="l Data"><a href="http://target-link.com/index.htm">This one works!</a></td>*/ /*<td class="l Data">This does not &lt;a href=&quot;http://target-link.com/index.htm&quot;&gt;Work&lt;/a&gt;</td> */ /*<td class="l Data">&lt;a href=&quot;http://target-link.com/index.htm&quot;&gt;Leading with tagged text&quot;&lt;/a&gt; not working either.</td>*/

-----Original Message----- From: Pettis, Matthew (Professional) Sent: Tuesday, June 28, 2011 3:33 PM To: SAS-L@LISTSERV.UGA.EDU Subject: Embedding/Passing throuh HTML to PROC PRINT table results in ODS HTML

Hi,

I'd like to PROC PRINT a table in ODS HTML output that just has a message telling people to look at data at another URL. I'd like make that URL clickable in the ODS HTML output, which would mean being able to pass through to the ODS HTML output a construct like:

<a href="http://target-link.com/index.htm">Click This Link</a>

Into the PROC PRINT cell verbatim so that the HTML browser can parse it into a clickable link. When the content of the printed table has HTML markup in it, it is escaped and so is not parsed by the browser.

Does anybody know how to circumvent this?

Tia, Matt


Back to: Top of message | Previous page | Main SAS-L page