<?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: PRXMATCH to extract digits in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/PRXMATCH-to-extract-digits/m-p/192100#M48272</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The period (.) is a special character in patterns. It matches any single character except newline. If you want to match a period you must use "\,"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try "/0?\.\d{2,4}/o"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 24 Apr 2014 19:46:35 GMT</pubDate>
    <dc:creator>PGStats</dc:creator>
    <dc:date>2014-04-24T19:46:35Z</dc:date>
    <item>
      <title>PRXMATCH to extract digits</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PRXMATCH-to-extract-digits/m-p/192096#M48268</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, &lt;/P&gt;&lt;P&gt;I want to extract specific digits from text. I am using following code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; " if prxmatch("m/0.21|0.20|0.19/0.18|0.17/oi",fromtext)&amp;gt;0 then ..."&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have also tried other options such as \w, \d+,&amp;nbsp; \d{2,4} but not working. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any suggestions?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Apr 2014 19:20:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PRXMATCH-to-extract-digits/m-p/192096#M48268</guid>
      <dc:creator>buckeyefisher</dc:creator>
      <dc:date>2014-04-24T19:20:53Z</dc:date>
    </item>
    <item>
      <title>Re: PRXMATCH to extract digits</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PRXMATCH-to-extract-digits/m-p/192097#M48269</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It would be helpful if you could show some INs and OUTs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Haikuo &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Apr 2014 19:29:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PRXMATCH-to-extract-digits/m-p/192097#M48269</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2014-04-24T19:29:21Z</dc:date>
    </item>
    <item>
      <title>Re: PRXMATCH to extract digits</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PRXMATCH-to-extract-digits/m-p/192098#M48270</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It is difficult to guess what you are trying to match. Post strings that shouild match, and others that shouldn't.&lt;/P&gt;&lt;P&gt;A thing that looks suspicious in your pattern, are the unescaped periods. Could that be the problem?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Apr 2014 19:29:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PRXMATCH-to-extract-digits/m-p/192098#M48270</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2014-04-24T19:29:24Z</dc:date>
    </item>
    <item>
      <title>Re: PRXMATCH to extract digits</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PRXMATCH-to-extract-digits/m-p/192099#M48271</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;for example 19 should not match but .19 or 0.19 should match. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I didn't understand unescaped periods?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Apr 2014 19:31:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PRXMATCH-to-extract-digits/m-p/192099#M48271</guid>
      <dc:creator>buckeyefisher</dc:creator>
      <dc:date>2014-04-24T19:31:54Z</dc:date>
    </item>
    <item>
      <title>Re: PRXMATCH to extract digits</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PRXMATCH-to-extract-digits/m-p/192100#M48272</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The period (.) is a special character in patterns. It matches any single character except newline. If you want to match a period you must use "\,"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try "/0?\.\d{2,4}/o"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Apr 2014 19:46:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PRXMATCH-to-extract-digits/m-p/192100#M48272</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2014-04-24T19:46:35Z</dc:date>
    </item>
    <item>
      <title>Re: PRXMATCH to extract digits</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PRXMATCH-to-extract-digits/m-p/192101#M48273</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks PG&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So shall it look like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;" if prxmatch("m/0.21|0.20|0.19|0.18|0.17/0?\.\d{2,4}/o",text)&amp;gt;0 then "&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Apr 2014 19:55:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PRXMATCH-to-extract-digits/m-p/192101#M48273</guid>
      <dc:creator>buckeyefisher</dc:creator>
      <dc:date>2014-04-24T19:55:02Z</dc:date>
    </item>
    <item>
      <title>Re: PRXMATCH to extract digits</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PRXMATCH-to-extract-digits/m-p/192102#M48274</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;First I'd need to know if the following should match:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;0.55&lt;/P&gt;&lt;P&gt;3.21&lt;/P&gt;&lt;P&gt;-0.19&lt;/P&gt;&lt;P&gt;0.2112345&lt;/P&gt;&lt;P&gt;10.21&lt;/P&gt;&lt;P&gt;-.21&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Apr 2014 20:23:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PRXMATCH-to-extract-digits/m-p/192102#M48274</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2014-04-24T20:23:42Z</dc:date>
    </item>
    <item>
      <title>Re: PRXMATCH to extract digits</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PRXMATCH-to-extract-digits/m-p/192103#M48275</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;none of the should match. It should only look for exact match for 0.21 or 0.19. The text does not have any sign so I am less worried about -0.19. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Apr 2014 20:29:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PRXMATCH-to-extract-digits/m-p/192103#M48275</guid>
      <dc:creator>buckeyefisher</dc:creator>
      <dc:date>2014-04-24T20:29:33Z</dc:date>
    </item>
    <item>
      <title>Re: PRXMATCH to extract digits</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PRXMATCH-to-extract-digits/m-p/192104#M48276</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;OK. In that case, the best pattern I can come up with is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;prxmatch("/(?&amp;lt;!\d)0?\.(19|21)(?!\d)/o", text)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-CA" style="font-size: 10pt; font-family: Arial, sans-serif;"&gt;It reads: something that isn't a digit, followed optionally &lt;/SPAN&gt;by a zero, followed by a period and 19 or 21, followed by something that isn’t a digit.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The value returned will be the position of the zero or of the period character in the string. Does that correspond with what you're looking for?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Apr 2014 02:21:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PRXMATCH-to-extract-digits/m-p/192104#M48276</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2014-04-25T02:21:50Z</dc:date>
    </item>
    <item>
      <title>Re: PRXMATCH to extract digits</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PRXMATCH-to-extract-digits/m-p/192105#M48277</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;While PG's suggested code will do what you asked for (as long as there are no leading spaces or other unanticipated exceptions), wouldn't using an input function be more understandable and precise?&amp;nbsp; e.g., compare:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data have;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input text $char10.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; cards;&lt;/P&gt;&lt;P&gt;0.55&lt;/P&gt;&lt;P&gt;3.21&lt;/P&gt;&lt;P&gt;-0.19&lt;/P&gt;&lt;P&gt;0.1&lt;/P&gt;&lt;P&gt;.170&lt;/P&gt;&lt;P&gt;.17&lt;/P&gt;&lt;P&gt;0.19&lt;/P&gt;&lt;P&gt;A0.19&lt;/P&gt;&lt;P&gt;.21&lt;/P&gt;&lt;P&gt;0.2112345&lt;/P&gt;&lt;P&gt;10.21&lt;/P&gt;&lt;P&gt;-.21&lt;/P&gt;&lt;P&gt;;&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; if input(text, ?? 12.) in (.21,.20,.19,.18,.17) then itest=1;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if prxmatch("/(?&amp;lt;!\d)0?\.(17|18|19|20|21)(?!\d)/o", text) eq 1 then ptest=1;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Apr 2014 12:33:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PRXMATCH-to-extract-digits/m-p/192105#M48277</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2014-04-25T12:33:36Z</dc:date>
    </item>
    <item>
      <title>Re: PRXMATCH to extract digits</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PRXMATCH-to-extract-digits/m-p/192106#M48278</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A __default_attr="149594" __jive_macro_name="user" class="jive_macro jive_macro_user" href="https://communities.sas.com/" modifiedtitle="true" title="Arthur Tabachneck"&gt;&lt;/A&gt;, PRXMATCH returns the starting position of the match, which can be useful too. So it would be more appropriate to compare the return value with zero: &lt;STRONG&gt;PRXMATCH(...) &amp;gt; 0&lt;/STRONG&gt; .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Apr 2014 14:57:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PRXMATCH-to-extract-digits/m-p/192106#M48278</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2014-04-25T14:57:09Z</dc:date>
    </item>
    <item>
      <title>Re: PRXMATCH to extract digits</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/PRXMATCH-to-extract-digits/m-p/192107#M48279</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;you guys are amazing....!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried code given by PG and its working perfectly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks !!!&lt;/P&gt;&lt;P&gt;Kiran&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Apr 2014 15:59:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/PRXMATCH-to-extract-digits/m-p/192107#M48279</guid>
      <dc:creator>buckeyefisher</dc:creator>
      <dc:date>2014-04-25T15:59:16Z</dc:date>
    </item>
  </channel>
</rss>

