<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: find HTML code and remove them in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/find-HTML-code-and-remove-them/m-p/543889#M150368</link>
    <description>&lt;P&gt;Dear draycut,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;for the&amp;nbsp;&lt;/P&gt;&lt;P&gt;'JUICE&amp;lt;BR&amp;gt;apple&amp;lt;footer&amp;gt;'&lt;/P&gt;&lt;P&gt;by using the first code,&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want1;
   set have;
   RegExID = prxparse('/&amp;lt;\w*&amp;gt;/');
   start=1;
   call prxnext(RegExID, start, length(name), name, pos, length);
      do while (pos &amp;gt; 0);
         html = substr(name, pos, length);
         newname=prxchange('s/&amp;lt;\w*&amp;gt;//', -1, name);
         output;
         call prxnext(RegExID, start, length(name), name, pos, length);
      end;
   keep name html newname;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I get&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;name&lt;/TD&gt;&lt;TD&gt;html&lt;/TD&gt;&lt;TD&gt;newname&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;JUICE&amp;lt;BR&amp;gt;apple&amp;lt;footer&amp;gt;&lt;/TD&gt;&lt;TD&gt;&amp;lt;BR&amp;gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;JUICEapple&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;JUICE&amp;lt;BR&amp;gt;apple&amp;lt;footer&amp;gt;&lt;/TD&gt;&lt;TD&gt;&amp;lt;footer&amp;gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;JUICEapple&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;however, I expect to add a blank between 'JUICE' and 'apple'&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;name&lt;/TD&gt;&lt;TD&gt;html&lt;/TD&gt;&lt;TD&gt;newname&amp;nbsp;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;JUICE&amp;lt;BR&amp;gt;apple&amp;lt;footer&amp;gt;&lt;/TD&gt;&lt;TD&gt;&amp;lt;BR&amp;gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;JUICE apple&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;JUICE&amp;lt;BR&amp;gt;apple&amp;lt;footer&amp;gt;&lt;/TD&gt;&lt;TD&gt;&amp;lt;footer&amp;gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;JUICE apple&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;Could you please give me some suggestions about this?&lt;/P&gt;</description>
    <pubDate>Mon, 18 Mar 2019 07:57:27 GMT</pubDate>
    <dc:creator>Alexxxxxxx</dc:creator>
    <dc:date>2019-03-18T07:57:27Z</dc:date>
    <item>
      <title>find HTML code and remove them</title>
      <link>https://communities.sas.com/t5/SAS-Programming/find-HTML-code-and-remove-them/m-p/543261#M150166</link>
      <description>&lt;P&gt;Dear all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I find all HTML code (such as '&amp;lt;BR&amp;gt;', '&amp;lt;FONT&amp;gt;','&amp;lt;BODY&amp;gt;') and remove them in the variable?&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have ;
  infile datalines truncover;
  input name $100.;
  datalines;
JUICE&amp;lt;BR&amp;gt;apple&amp;lt;footer&amp;gt; 
juice &amp;lt;BR&amp;gt; apple 
juice&amp;lt;BODY&amp;gt;apple 
juice&amp;lt;BODY&amp;gt; apple 
&amp;lt;BR&amp;gt;juice apple
&amp;lt;figure&amp;gt; juice 
;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Could you please give me some suggestions about this?&lt;/P&gt;&lt;P&gt;thanks in advance.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Mar 2019 17:29:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/find-HTML-code-and-remove-them/m-p/543261#M150166</guid>
      <dc:creator>Alexxxxxxx</dc:creator>
      <dc:date>2019-03-14T17:29:20Z</dc:date>
    </item>
    <item>
      <title>Re: find HTML code and remove them</title>
      <link>https://communities.sas.com/t5/SAS-Programming/find-HTML-code-and-remove-them/m-p/543268#M150168</link>
      <description>&lt;P&gt;Something like this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have ;
  infile datalines truncover;
  input name $100.;
  datalines;
JUICE&amp;lt;BR&amp;gt;apple&amp;lt;footer&amp;gt; 
juice &amp;lt;BR&amp;gt; apple 
juice&amp;lt;BODY&amp;gt;apple 
juice&amp;lt;BODY&amp;gt; apple 
&amp;lt;BR&amp;gt;juice apple
&amp;lt;figure&amp;gt; juice 
;
run;

data want;
   set have;
   new=prxchange('s/&amp;lt;\w*&amp;gt;//', -1, name);
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 14 Mar 2019 17:41:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/find-HTML-code-and-remove-them/m-p/543268#M150168</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-03-14T17:41:58Z</dc:date>
    </item>
    <item>
      <title>Re: find HTML code and remove them</title>
      <link>https://communities.sas.com/t5/SAS-Programming/find-HTML-code-and-remove-them/m-p/543282#M150172</link>
      <description>&lt;P&gt;Dear&amp;nbsp;draycut,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I appreciate your&amp;nbsp;reply and kind advise.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;May I ask one more question, please? How can I find the HTML code ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks for your attention to this matter.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Mar 2019 18:23:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/find-HTML-code-and-remove-them/m-p/543282#M150172</guid>
      <dc:creator>Alexxxxxxx</dc:creator>
      <dc:date>2019-03-14T18:23:24Z</dc:date>
    </item>
    <item>
      <title>Re: find HTML code and remove them</title>
      <link>https://communities.sas.com/t5/SAS-Programming/find-HTML-code-and-remove-them/m-p/543325#M150184</link>
      <description>Have you tried the code posted by &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31304"&gt;@PeterClemmensen&lt;/a&gt;?</description>
      <pubDate>Thu, 14 Mar 2019 21:24:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/find-HTML-code-and-remove-them/m-p/543325#M150184</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2019-03-14T21:24:07Z</dc:date>
    </item>
    <item>
      <title>Re: find HTML code and remove them</title>
      <link>https://communities.sas.com/t5/SAS-Programming/find-HTML-code-and-remove-them/m-p/543331#M150187</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/262815"&gt;@Alexxxxxxx&lt;/a&gt;&amp;nbsp;, when you say HTML Code, do you mean the text inside the &amp;lt;&amp;gt; or including the &amp;lt;&amp;gt;?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, what do you want to do with it? Put them in a separate variable or?&lt;/P&gt;</description>
      <pubDate>Thu, 14 Mar 2019 21:32:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/find-HTML-code-and-remove-them/m-p/543331#M150187</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-03-14T21:32:16Z</dc:date>
    </item>
    <item>
      <title>Re: find HTML code and remove them</title>
      <link>https://communities.sas.com/t5/SAS-Programming/find-HTML-code-and-remove-them/m-p/543385#M150207</link>
      <description>&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/31304"&gt;@PeterClemmensen&lt;/a&gt;, I mean both the text and the &amp;lt;&amp;gt;. I expect to find them and put them in a separate variable. Could you please give me some suggestions about this?</description>
      <pubDate>Fri, 15 Mar 2019 02:03:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/find-HTML-code-and-remove-them/m-p/543385#M150207</guid>
      <dc:creator>Alexxxxxxx</dc:creator>
      <dc:date>2019-03-15T02:03:56Z</dc:date>
    </item>
    <item>
      <title>Re: find HTML code and remove them</title>
      <link>https://communities.sas.com/t5/SAS-Programming/find-HTML-code-and-remove-them/m-p/543422#M150214</link>
      <description>&lt;P&gt;Here is a PRXNEXT example. I have written two different programs. The first outputs an observation for each html found. The second concatenates the found html codes so it has the same number of observations as the input data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/262815"&gt;@Alexxxxxxx&lt;/a&gt;&amp;nbsp;Let me know if it works for you &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have ;
  infile datalines truncover;
  input name $100.;
  datalines;
JUICE&amp;lt;BR&amp;gt;apple&amp;lt;footer&amp;gt; 
juice &amp;lt;BR&amp;gt; apple 
juice&amp;lt;BODY&amp;gt;apple 
juice&amp;lt;BODY&amp;gt; apple 
&amp;lt;BR&amp;gt;juice apple
&amp;lt;figure&amp;gt; juice 
;
run;

data want1;
   set have;
   RegExID = prxparse('/&amp;lt;\w*&amp;gt;/');
   start=1;
   call prxnext(RegExID, start, length(name), name, pos, length);
      do while (pos &amp;gt; 0);
         html = substr(name, pos, length);
         newname=prxchange('s/&amp;lt;\w*&amp;gt;//', -1, name);
         output;
         call prxnext(RegExID, start, length(name), name, pos, length);
      end;
   keep name html newname;
run;

data want2;
   set have;
   length html $200;
   RegExID = prxparse('/&amp;lt;\w*&amp;gt;/');
   start=1;
   html="";
   call prxnext(RegExID, start, length(name), name, pos, length);
      do while (pos &amp;gt; 0);
         html = catx(',', html, substr(name, pos, length));
         newname=prxchange('s/&amp;lt;\w*&amp;gt;//', -1, name);
         call prxnext(RegExID, start, length(name), name, pos, length);
      end;
   keep name html newname;
   retain html;
run;&lt;/CODE&gt;&amp;nbsp;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Mar 2019 14:13:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/find-HTML-code-and-remove-them/m-p/543422#M150214</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-03-15T14:13:07Z</dc:date>
    </item>
    <item>
      <title>Re: find HTML code and remove them</title>
      <link>https://communities.sas.com/t5/SAS-Programming/find-HTML-code-and-remove-them/m-p/543561#M150280</link>
      <description>&lt;PRE&gt;data have ;
  infile datalines truncover;
  input name $100.;
  datalines;
JUICE&amp;lt;BR&amp;gt;apple&amp;lt;footer&amp;gt; 
juice &amp;lt;BR&amp;gt; apple 
juice&amp;lt;BODY&amp;gt;apple 
juice&amp;lt;BODY&amp;gt; apple 
&amp;lt;BR&amp;gt;juice apple
&amp;lt;figure&amp;gt; juice 
;
run;

data want;
   set have;
   new=prxchange('s/&amp;lt;.*?&amp;gt;/ /', -1, name);
run;&lt;/PRE&gt;</description>
      <pubDate>Fri, 15 Mar 2019 14:41:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/find-HTML-code-and-remove-them/m-p/543561#M150280</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2019-03-15T14:41:04Z</dc:date>
    </item>
    <item>
      <title>Re: find HTML code and remove them</title>
      <link>https://communities.sas.com/t5/SAS-Programming/find-HTML-code-and-remove-them/m-p/543889#M150368</link>
      <description>&lt;P&gt;Dear draycut,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;for the&amp;nbsp;&lt;/P&gt;&lt;P&gt;'JUICE&amp;lt;BR&amp;gt;apple&amp;lt;footer&amp;gt;'&lt;/P&gt;&lt;P&gt;by using the first code,&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want1;
   set have;
   RegExID = prxparse('/&amp;lt;\w*&amp;gt;/');
   start=1;
   call prxnext(RegExID, start, length(name), name, pos, length);
      do while (pos &amp;gt; 0);
         html = substr(name, pos, length);
         newname=prxchange('s/&amp;lt;\w*&amp;gt;//', -1, name);
         output;
         call prxnext(RegExID, start, length(name), name, pos, length);
      end;
   keep name html newname;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I get&amp;nbsp;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;name&lt;/TD&gt;&lt;TD&gt;html&lt;/TD&gt;&lt;TD&gt;newname&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;JUICE&amp;lt;BR&amp;gt;apple&amp;lt;footer&amp;gt;&lt;/TD&gt;&lt;TD&gt;&amp;lt;BR&amp;gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;JUICEapple&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;JUICE&amp;lt;BR&amp;gt;apple&amp;lt;footer&amp;gt;&lt;/TD&gt;&lt;TD&gt;&amp;lt;footer&amp;gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;JUICEapple&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;however, I expect to add a blank between 'JUICE' and 'apple'&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;name&lt;/TD&gt;&lt;TD&gt;html&lt;/TD&gt;&lt;TD&gt;newname&amp;nbsp;&amp;nbsp;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;JUICE&amp;lt;BR&amp;gt;apple&amp;lt;footer&amp;gt;&lt;/TD&gt;&lt;TD&gt;&amp;lt;BR&amp;gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;JUICE apple&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;JUICE&amp;lt;BR&amp;gt;apple&amp;lt;footer&amp;gt;&lt;/TD&gt;&lt;TD&gt;&amp;lt;footer&amp;gt;&lt;/TD&gt;&lt;TD&gt;&lt;STRONG&gt;JUICE apple&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;Could you please give me some suggestions about this?&lt;/P&gt;</description>
      <pubDate>Mon, 18 Mar 2019 07:57:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/find-HTML-code-and-remove-them/m-p/543889#M150368</guid>
      <dc:creator>Alexxxxxxx</dc:creator>
      <dc:date>2019-03-18T07:57:27Z</dc:date>
    </item>
  </channel>
</rss>

