<?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: Parse with fewest lines of code? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Parse-with-fewest-lines-of-code/m-p/77746#M16856</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A __default_attr="645292" __jive_macro_name="user" class="jive_macro jive_macro_user" data-objecttype="3" href="https://communities.sas.com/"&gt;&lt;/A&gt;: Actually, my proposed code has the same problem.&amp;nbsp; Is there a way to get regular expression to only recognize words?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 23 Nov 2012 04:32:28 GMT</pubDate>
    <dc:creator>art297</dc:creator>
    <dc:date>2012-11-23T04:32:28Z</dc:date>
    <item>
      <title>Parse with fewest lines of code?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Parse-with-fewest-lines-of-code/m-p/77741#M16851</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;iI'm looking for one of a number of substrings in a string. if any of them are found, I want to set a variable to true and remove the substring. for example, if 'this is a test' or one or twenty or 'hello world' are in the field named Description, then set the value of FoundIt to true and remove the substring from description field. I'm assuminthe solution involves regular expressions.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Nov 2012 16:51:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Parse-with-fewest-lines-of-code/m-p/77741#M16851</guid>
      <dc:creator>ScifiGuy</dc:creator>
      <dc:date>2012-11-22T16:51:42Z</dc:date>
    </item>
    <item>
      <title>Re: Parse with fewest lines of code?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Parse-with-fewest-lines-of-code/m-p/77742#M16852</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think it depends on your preference.&amp;nbsp; One possibility could be something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; informat description $80.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; infile cards truncover;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input description &amp;amp;;&lt;/P&gt;&lt;P&gt;&amp;nbsp; cards;&lt;/P&gt;&lt;P&gt;Now is the time for this is a test I think&lt;/P&gt;&lt;P&gt;hello world hello world hello everyone&lt;/P&gt;&lt;P&gt;this is one nine twenty thirty and more&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want (drop=_:);&lt;/P&gt;&lt;P&gt;&amp;nbsp; array _toremove(4) $30 ("this is a test", "one", "twenty", "hello world");&lt;/P&gt;&lt;P&gt;&amp;nbsp; set have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; do _i=1 to dim(_toremove);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; description=strip(transtrn(description,strip(_toremove(_i)),""));&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Nov 2012 17:13:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Parse-with-fewest-lines-of-code/m-p/77742#M16852</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-11-22T17:13:44Z</dc:date>
    </item>
    <item>
      <title>Re: Parse with fewest lines of code?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Parse-with-fewest-lines-of-code/m-p/77743#M16853</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thanks.&amp;nbsp; That looks like it would work.&amp;nbsp; I was wondering though how one might do it using the regular expression functions...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Nov 2012 23:37:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Parse-with-fewest-lines-of-code/m-p/77743#M16853</guid>
      <dc:creator>ScifiGuy</dc:creator>
      <dc:date>2012-11-22T23:37:28Z</dc:date>
    </item>
    <item>
      <title>Re: Parse with fewest lines of code?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Parse-with-fewest-lines-of-code/m-p/77744#M16854</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It is easy for PRX.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;data have;
&amp;nbsp; informat description $80.;
&amp;nbsp; infile cards truncover;
&amp;nbsp; input description &amp;amp;;
&amp;nbsp; cards;
Now is the time for this is a test I think
hello world hello world hello everyone
this is one nine twenty thirty and more
;
run;
data want ;
 set have;
 found=prxmatch('/this is a test|one|twenty|hello world/',description);
 description=prxchange('s/this is a test|one|twenty|hello world//o',-1,description);
 run;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ksharp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Nov 2012 02:58:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Parse-with-fewest-lines-of-code/m-p/77744#M16854</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2012-11-23T02:58:18Z</dc:date>
    </item>
    <item>
      <title>Re: Parse with fewest lines of code?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Parse-with-fewest-lines-of-code/m-p/77745#M16855</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A __default_attr="645292" __jive_macro_name="user" class="jive_macro jive_macro_user" data-objecttype="3" href="https://communities.sas.com/"&gt;&lt;/A&gt;: Depending upon what the OP considers a substring, your code may or may not suffice.&amp;nbsp; e.g., it will change everyone to one and remove any other identified text that happens to be part of a substring.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Nov 2012 03:39:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Parse-with-fewest-lines-of-code/m-p/77745#M16855</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-11-23T03:39:16Z</dc:date>
    </item>
    <item>
      <title>Re: Parse with fewest lines of code?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Parse-with-fewest-lines-of-code/m-p/77746#M16856</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A __default_attr="645292" __jive_macro_name="user" class="jive_macro jive_macro_user" data-objecttype="3" href="https://communities.sas.com/"&gt;&lt;/A&gt;: Actually, my proposed code has the same problem.&amp;nbsp; Is there a way to get regular expression to only recognize words?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Nov 2012 04:32:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Parse-with-fewest-lines-of-code/m-p/77746#M16856</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-11-23T04:32:28Z</dc:date>
    </item>
    <item>
      <title>Re: Parse with fewest lines of code?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Parse-with-fewest-lines-of-code/m-p/77747#M16857</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;ArthurT,&lt;/P&gt;&lt;P&gt;I don't understand what you mean totally .&lt;/P&gt;&lt;P&gt;Do you mean taking these substring as a word?&lt;/P&gt;&lt;P&gt;prx function has a basic perl metacharacter&amp;nbsp;&amp;nbsp; /b&amp;nbsp;&amp;nbsp; will take care of it .&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Nov 2012 05:45:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Parse-with-fewest-lines-of-code/m-p/77747#M16857</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2012-11-23T05:45:50Z</dc:date>
    </item>
    <item>
      <title>Re: Parse with fewest lines of code?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Parse-with-fewest-lines-of-code/m-p/77748#M16858</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A __default_attr="645292" __jive_macro_name="user" class="jive_macro jive_macro_user" data-objecttype="3" href="https://communities.sas.com/"&gt;&lt;/A&gt;: Almost. The following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; informat description $80.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; infile cards truncover;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input description &amp;amp;;&lt;/P&gt;&lt;P&gt;&amp;nbsp; cards;&lt;/P&gt;&lt;P&gt;Now is the time for this is a test I think&lt;/P&gt;&lt;P&gt;hello world hello world hello everyone&lt;/P&gt;&lt;P&gt;this is one nine twenty thirty and more&lt;/P&gt;&lt;P&gt;Now is the times for this is a test I think&lt;/P&gt;&lt;P&gt;hello world hello world hello everyone onetime&lt;/P&gt;&lt;P&gt;this is one nine twenty-one thirty and more&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; description=prxchange('s/\bthis is a test|\bone|\btwenty|\bhello world//o',-1,description);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc print;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;produces:&lt;/P&gt;&lt;TABLE cellpadding="5" cellspacing="0" class="table" frame="box" rules="all" summary="Procedure Print: Data Set WORK.WANT"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH class="r rowheader" scope="row"&gt;1&lt;/TH&gt;&lt;TD class="l data"&gt;Now is the time for I think&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TH class="r rowheader" scope="row"&gt;2&lt;/TH&gt;&lt;TD class="l data"&gt;hello everyone&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TH class="r rowheader" scope="row"&gt;3&lt;/TH&gt;&lt;TD class="l data"&gt;this is nine thirty and more&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TH class="r rowheader" scope="row"&gt;4&lt;/TH&gt;&lt;TD class="l data"&gt;Now is the times for I think&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TH class="r rowheader" scope="row"&gt;5&lt;/TH&gt;&lt;TD class="l data"&gt;hello everyone time&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TH class="r rowheader" scope="row"&gt;6&lt;/TH&gt;&lt;TD class="l data"&gt;this is nine - thirty and more&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;what would one have to add to get the last line to result in:&lt;/P&gt;&lt;P&gt; this is nine twenty-one thirty and more&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Nov 2012 15:37:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Parse-with-fewest-lines-of-code/m-p/77748#M16858</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-11-23T15:37:52Z</dc:date>
    </item>
    <item>
      <title>Re: Parse with fewest lines of code?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Parse-with-fewest-lines-of-code/m-p/77749#M16859</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Art, the simplest way I see is to hard code 'blank' into it:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; informat description $80.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; infile cards truncover;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input description &amp;amp;;&lt;/P&gt;&lt;P&gt;&amp;nbsp; cards;&lt;/P&gt;&lt;P&gt;Now is the time for this is a test I think&lt;/P&gt;&lt;P&gt;hello world hello world hello everyone&lt;/P&gt;&lt;P&gt;this is one nine twenty thirty and more&lt;/P&gt;&lt;P&gt;Now is the times for this is a test I think&lt;/P&gt;&lt;P&gt;hello world hello world hello everyone onetime&lt;/P&gt;&lt;P&gt;this is one nine twenty-one thirty and more&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; description=prxchange('s/\ this is a test |\ one |\ twenty |\ hello world / /o',-1,description);&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc print;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Haikuo &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Nov 2012 19:22:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Parse-with-fewest-lines-of-code/m-p/77749#M16859</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2012-11-23T19:22:46Z</dc:date>
    </item>
    <item>
      <title>Re: Parse with fewest lines of code?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Parse-with-fewest-lines-of-code/m-p/77750#M16860</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Or maybe there will be multiple blanks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;prxchange('s/\s+this is a test\s+|\s+one\s+/ /o',-1,description);&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Nov 2012 05:48:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Parse-with-fewest-lines-of-code/m-p/77750#M16860</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2012-11-26T05:48:08Z</dc:date>
    </item>
  </channel>
</rss>

