DATA Step, Macro, Functions and more

Convert HTML field to unicode

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 5
Accepted Solution

Convert HTML field to unicode

<html>

<body>

In Excel I can use the Paste Special to read this this and convert it to Unicode and get rid of the HTML.

Any way to do this in SAS?

 

 

<div align="left" style="min-height: 9pt; "><font face="Arial" color="#000080"><span style="font-size:8pt"><b>Stover,Susan&lt;TEST&gt;, 6/21/2018 12:47:47 PM:&nbsp;</b></span></font><font face="Arial"><span style="font-size:8pt"> <br /></span></font></div>

<div align="left" style="min-height: 9pt; "><font face="Arial"><span style="font-size:8pt">Can this be set to retest with recent or new records?&nbsp; This issue

was encountered while Susan was testing code</span></font></div>

<div align="left" style="min-height: 9pt; "><font face="Arial"><span style="font-size:8pt"><br /></span></font><font face="Arial" color="#000080"><span style="font-size:8pt"><b>________________________________________</b></span></font><font face="Arial"><span style="font-size:8pt"><br /></span></font><p></p>

</div>

</body>

</html>


Accepted Solutions
Solution
‎07-07-2017 02:35 PM
Super User
Posts: 9,685

Re: Convert HTML field to unicode

How about this one:

 

data have;
infile cards truncover;
input x $2000.;
new_x=urldecode(prxchange('s/<[^<>]+>//',-1,x));
cards4;
<html>
<body>
In Excel I can use the Paste Special to read this this and convert it to Unicode and get rid of the HTML.
Any way to do this in SAS?
<div align="left" style="min-height: 9pt; "><font face="Arial" color="#000080"><span style="font-size:8pt"><b>Stover,Susan&lt;TEST&gt;, 6/21/2018 12:47:47 PM:&nbsp;</b></span></font><font face="Arial"><span style="font-size:8pt"> <br /></span></font></div>
<div align="left" style="min-height: 9pt; "><font face="Arial"><span style="font-size:8pt">Can this be set to retest with recent or new records?&nbsp; This issue
was encountered while Susan was testing code</span></font></div>
<div align="left" style="min-height: 9pt; "><font face="Arial"><span style="font-size:8pt"><br /></span></font><font face="Arial" color="#000080"><span style="font-size:8pt"><b>________________________________________</b></span></font><font face="Arial"><span style="font-size:8pt"><br /></span></font><p></p>
</div>
</body>
</html>
;;;;
run;

proc print noobs;run;

View solution in original post


All Replies
Solution
‎07-07-2017 02:35 PM
Super User
Posts: 9,685

Re: Convert HTML field to unicode

How about this one:

 

data have;
infile cards truncover;
input x $2000.;
new_x=urldecode(prxchange('s/<[^<>]+>//',-1,x));
cards4;
<html>
<body>
In Excel I can use the Paste Special to read this this and convert it to Unicode and get rid of the HTML.
Any way to do this in SAS?
<div align="left" style="min-height: 9pt; "><font face="Arial" color="#000080"><span style="font-size:8pt"><b>Stover,Susan&lt;TEST&gt;, 6/21/2018 12:47:47 PM:&nbsp;</b></span></font><font face="Arial"><span style="font-size:8pt"> <br /></span></font></div>
<div align="left" style="min-height: 9pt; "><font face="Arial"><span style="font-size:8pt">Can this be set to retest with recent or new records?&nbsp; This issue
was encountered while Susan was testing code</span></font></div>
<div align="left" style="min-height: 9pt; "><font face="Arial"><span style="font-size:8pt"><br /></span></font><font face="Arial" color="#000080"><span style="font-size:8pt"><b>________________________________________</b></span></font><font face="Arial"><span style="font-size:8pt"><br /></span></font><p></p>
</div>
</body>
</html>
;;;;
run;

proc print noobs;run;

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 1 reply
  • 85 views
  • 0 likes
  • 2 in conversation