<?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 in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/prxmatch/m-p/26389#M6029</link>
    <description>hi my data looks like this&lt;BR /&gt;
&lt;BR /&gt;
/column 1/extracted string/&lt;BR /&gt;
/hhfgjsjbshbsbgsbk  ab1  hhdjdjdn/ab1/&lt;BR /&gt;
&lt;BR /&gt;
so i need to scan column 1 so it extracts ab1 and puts it in to extracted string column.</description>
    <pubDate>Sun, 06 Dec 2009 15:31:55 GMT</pubDate>
    <dc:creator>sasbegginer</dc:creator>
    <dc:date>2009-12-06T15:31:55Z</dc:date>
    <item>
      <title>prxmatch</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/prxmatch/m-p/26387#M6027</link>
      <description>HI All&lt;BR /&gt;
I need some help writing a prxmatch code. i need to extract some data from a string and insert it in to a new column. the string has two spaces in front and back and is two letters and one number in the middle. For example "space/space/letter/letter/number/space/space". currently i am using prxparse and prxnext having looked at sas help files. However i cnt get it to work. any advise would be much thanked. Thank you</description>
      <pubDate>Sun, 06 Dec 2009 12:41:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/prxmatch/m-p/26387#M6027</guid>
      <dc:creator>sasbegginer</dc:creator>
      <dc:date>2009-12-06T12:41:36Z</dc:date>
    </item>
    <item>
      <title>Re: prxmatch</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/prxmatch/m-p/26388#M6028</link>
      <description>Hi:&lt;BR /&gt;
  Does your data look like this:&lt;BR /&gt;
[pre]&lt;BR /&gt;
  AB123  &lt;BR /&gt;
  CD456  &lt;BR /&gt;
  EF789  &lt;BR /&gt;
[/pre]&lt;BR /&gt;
                           &lt;BR /&gt;
or like this:&lt;BR /&gt;
[pre]&lt;BR /&gt;
  AB123  WOMBAT&lt;BR /&gt;
  CD456  KOALA&lt;BR /&gt;
  EF789  EUCALYPTUS&lt;BR /&gt;
[/pre]&lt;BR /&gt;
 &lt;BR /&gt;
What piece of the string do you want in the new variable???? For example, if your data looks like the first example, would you want:&lt;BR /&gt;
[pre]&lt;BR /&gt;
 var1   var2&lt;BR /&gt;
  AB   123  &lt;BR /&gt;
  CD   456  &lt;BR /&gt;
  EF   789  &lt;BR /&gt;
[/pre]&lt;BR /&gt;
                                                     &lt;BR /&gt;
or if your data looked like the second example, would you want:&lt;BR /&gt;
[pre]&lt;BR /&gt;
  var1       var2&lt;BR /&gt;
  AB123  WOMBAT&lt;BR /&gt;
  CD456  KOALA&lt;BR /&gt;
  EF789  EUCALYPTUS&lt;BR /&gt;
[/pre]&lt;BR /&gt;
                                 &lt;BR /&gt;
You may not need PRXMATCH at all. You might be able to use the ANYDIGIT, SUBSTR and/or SCAN functions. If you do need help with PRXMATCH, a concrete idea of what your data looks like and the code you've already tried would be useful.&lt;BR /&gt;
 &lt;BR /&gt;
In the meantime, here are some papers about using PRX functions:&lt;BR /&gt;
&lt;A href="http://viergever.net/SVSUG/BasicsPDF_Cassell.pdf" target="_blank"&gt;http://viergever.net/SVSUG/BasicsPDF_Cassell.pdf&lt;/A&gt;&lt;BR /&gt;
&lt;A href="http://www2.sas.com/proceedings/sugi29/129-29.pdf" target="_blank"&gt;http://www2.sas.com/proceedings/sugi29/129-29.pdf&lt;/A&gt;&lt;BR /&gt;
&lt;A href="http://www2.sas.com/proceedings/sugi30/138-30.pdf" target="_blank"&gt;http://www2.sas.com/proceedings/sugi30/138-30.pdf&lt;/A&gt;&lt;BR /&gt;
&lt;A href="http://analytics.ncsu.edu/sesug/2006/AP09_06.PDF" target="_blank"&gt;http://analytics.ncsu.edu/sesug/2006/AP09_06.PDF&lt;/A&gt;&lt;BR /&gt;
 &lt;BR /&gt;
cynthia</description>
      <pubDate>Sun, 06 Dec 2009 14:31:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/prxmatch/m-p/26388#M6028</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2009-12-06T14:31:39Z</dc:date>
    </item>
    <item>
      <title>Re: prxmatch</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/prxmatch/m-p/26389#M6029</link>
      <description>hi my data looks like this&lt;BR /&gt;
&lt;BR /&gt;
/column 1/extracted string/&lt;BR /&gt;
/hhfgjsjbshbsbgsbk  ab1  hhdjdjdn/ab1/&lt;BR /&gt;
&lt;BR /&gt;
so i need to scan column 1 so it extracts ab1 and puts it in to extracted string column.</description>
      <pubDate>Sun, 06 Dec 2009 15:31:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/prxmatch/m-p/26389#M6029</guid>
      <dc:creator>sasbegginer</dc:creator>
      <dc:date>2009-12-06T15:31:55Z</dc:date>
    </item>
    <item>
      <title>Re: prxmatch</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/prxmatch/m-p/26390#M6030</link>
      <description>Hi:&lt;BR /&gt;
  If you always want the second "chunk" delimited by spaces, as shown in your snapshot of data, then, the SCAN function will allow you to do that. Although you could use PRX functions, the SCAN function will allow you to break a text string into "chunks" or "words" based on a delimiter. If, as you describe, you want the second "chunk" deliimited by spaces, then for data like this:&lt;BR /&gt;
[pre]&lt;BR /&gt;
  column1&lt;BR /&gt;
  hhfgjsjbshbsbgsbk ab1 hhdjdjdn&lt;BR /&gt;
  xyxyxyxyxyxy cd2 xyxyxyxy&lt;BR /&gt;
  abababababababababab ef3 ababab&lt;BR /&gt;
  123456789 hi4 abcdefghijklmnopqrstuvwxyz&lt;BR /&gt;
  abcdefghijklmn     xx5     nopqrstuvwxyz&lt;BR /&gt;
[/pre]&lt;BR /&gt;
                                                      &lt;BR /&gt;
A simple SCAN function will do the job:&lt;BR /&gt;
[pre]&lt;BR /&gt;
  ** parse string;&lt;BR /&gt;
  chunk1 = scan(column1, 1, ' ');&lt;BR /&gt;
  chunk2 = scan(column1, 2, ' ');&lt;BR /&gt;
  chunk3 = scan(column1, 3, ' ');&lt;BR /&gt;
[/pre]&lt;BR /&gt;
 &lt;BR /&gt;
The SCAN function treats multiple delimiters, such as the multiple spaces around "xx5"  as one delimiter. As long as the rest of your string does not have spaces, SCAN might be a simpler approach. (Remember to use the LENGTH statement for the "chunk" variables or extracted variables so that you set the length you need for the maximum possible value.)&lt;BR /&gt;
 &lt;BR /&gt;
cynthia</description>
      <pubDate>Sun, 06 Dec 2009 18:31:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/prxmatch/m-p/26390#M6030</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2009-12-06T18:31:11Z</dc:date>
    </item>
    <item>
      <title>Re: prxmatch</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/prxmatch/m-p/26391#M6031</link>
      <description>hi that was just a selection of my data my data strings has nultiple spaces for example....gahahshsj hshsuhsh shsusjsj ab1 hjdjjjjjffjkk a i would like the the ab1. if it helps it always two characters and one number</description>
      <pubDate>Sun, 06 Dec 2009 18:48:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/prxmatch/m-p/26391#M6031</guid>
      <dc:creator>sasbegginer</dc:creator>
      <dc:date>2009-12-06T18:48:35Z</dc:date>
    </item>
    <item>
      <title>Re: prxmatch</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/prxmatch/m-p/26392#M6032</link>
      <description>Ah, I wondered if that might be the situation. In that case, reading the papers on PRX functions should be most beneficial to you.&lt;BR /&gt;
 &lt;BR /&gt;
cynthia</description>
      <pubDate>Sun, 06 Dec 2009 19:18:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/prxmatch/m-p/26392#M6032</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2009-12-06T19:18:07Z</dc:date>
    </item>
    <item>
      <title>Re: prxmatch</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/prxmatch/m-p/26393#M6033</link>
      <description>anyoe no the regular expression i should be using? iv tried many times and cant get it right. Thanks</description>
      <pubDate>Sun, 06 Dec 2009 19:39:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/prxmatch/m-p/26393#M6033</guid>
      <dc:creator>sasbegginer</dc:creator>
      <dc:date>2009-12-06T19:39:10Z</dc:date>
    </item>
    <item>
      <title>Re: prxmatch</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/prxmatch/m-p/26394#M6034</link>
      <description>In your first post you mentioned &lt;BR /&gt;
&lt;BR /&gt;
space/space/letter/letter/number/space/space&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
data _null_;&lt;BR /&gt;
   input target $32.;&lt;BR /&gt;
   retain rx;&lt;BR /&gt;
   if _n_ eq 1 then rx= prxparse('/(  [A-Za-z]{2}\d  )/');&lt;BR /&gt;
   f = prxmatch(rx,target);&lt;BR /&gt;
   x = prxposn(rx,1,target);&lt;BR /&gt;
   put _all_;&lt;BR /&gt;
   put x $char32.;&lt;BR /&gt;
   cards;&lt;BR /&gt;
a  LL3  b&lt;BR /&gt;
a   LL4  B&lt;BR /&gt;
a LL5  B&lt;BR /&gt;
a LL3   c&lt;BR /&gt;
a  bb3  b&lt;BR /&gt;
a   ca4  B&lt;BR /&gt;
&lt;BR /&gt;
;;;;&lt;BR /&gt;
   run; &lt;BR /&gt;
[/pre]</description>
      <pubDate>Sun, 06 Dec 2009 22:46:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/prxmatch/m-p/26394#M6034</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2009-12-06T22:46:25Z</dc:date>
    </item>
  </channel>
</rss>

