<?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: How to use Prxparse to find two different words in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/How-to-use-Prxparse-to-find-two-different-words/m-p/284160#M59305</link>
    <description>I thought I was providing you with all the pertaint information. .. since the atmbarcode works I fig it be easier to do it in steps since I have a code that brings 6 of the characters I thought you could show me how to tweak the code to bring the rest here is what I'm looking at right after I run the first part&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;X. Bacode. N. Newvar ZT2487&lt;BR /&gt;Blah,blah,blah, Atmbarcode :"TY272822. 2&lt;BR /&gt;Blah, blah,blah,blah,&lt;BR /&gt;1ZT2487A1221111111,blah,blah,&lt;BR /&gt;&lt;BR /&gt;Sorry for the misunderstanding I thought I was helping by providing code an not example hopes that helps my thought process</description>
    <pubDate>Wed, 13 Jul 2016 18:33:09 GMT</pubDate>
    <dc:creator>Beto16</dc:creator>
    <dc:date>2016-07-13T18:33:09Z</dc:date>
    <item>
      <title>How to use Prxparse to find two different words</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-use-Prxparse-to-find-two-different-words/m-p/283012#M59221</link>
      <description>&lt;LI-SPOILER&gt;&amp;nbsp;&lt;/LI-SPOILER&gt;&lt;P&gt;Hi I have this snippet of code&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;Data have;
    Infile;
    Length bacode $25;
    N+1;
    Pid=prxparse ('/atmbarcode :\W*\w+/i');
    S=1;
    E=length (x);
    Call prxnext (pid,s,e,x,p,l);
    Do while (p&amp;gt;0);
        Bacode=substr (x.p.l);
        Output;
        Call prxnext (pid,s,e,x,p,l);
    End;
    Keep n x bacode;
Run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;What I need is to add a tracking number the tracking number starts with 1zt2. How can I add a 2nd search to the code to look for atmbarcode and 1zt2 as well? Thanks&lt;/P&gt;</description>
      <pubDate>Sun, 10 Jul 2016 21:32:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-use-Prxparse-to-find-two-different-words/m-p/283012#M59221</guid>
      <dc:creator>Beto16</dc:creator>
      <dc:date>2016-07-10T21:32:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to add an additional column</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-use-Prxparse-to-find-two-different-words/m-p/283080#M59223</link>
      <description>&lt;P&gt;Can you give a few examples of variable x to work with?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Do you actually need "atmbarcode : " as part of the bacode string?&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jul 2016 22:02:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-use-Prxparse-to-find-two-different-words/m-p/283080#M59223</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2016-07-08T22:02:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to add an additional column</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-use-Prxparse-to-find-two-different-words/m-p/283085#M59224</link>
      <description>&lt;P&gt;Hi I will examples &amp;nbsp;bacode is the name of column I create .. I'm looking for everything that starts with atmbarcode: &amp;nbsp;I now need to add the tracking number that is in another column and if starts with 1zt2. &amp;nbsp; &amp;nbsp;...so the first part of code works it brings in everything I need I need to add and statement to bring 1zt2 tracking number ..the location of the tracking numBer can vary from col 5 thru coL 300 .....I was hoping peral could assist&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Jul 2016 23:04:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-use-Prxparse-to-find-two-different-words/m-p/283085#M59224</guid>
      <dc:creator>Beto16</dc:creator>
      <dc:date>2016-07-08T23:04:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to add an additional column</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-use-Prxparse-to-find-two-different-words/m-p/283684#M59261</link>
      <description>&lt;P&gt;Like this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
data have;
  Length bacode $25;
  X='lkdjf lsdjkl skljl atmbarcode :_SS jhjh  1zt2 : _5r kkj';
  Pid=prxparse ('/(atmbarcode|1zt2) :\W*\w+/i');
  S=1;
  E=length (x);
  Call prxnext (pid,s,e,x,p,l);
  Do while (p&amp;gt;0);
    Bacode=substr (x,p,l);
    putlog Bacode=;
    Call prxnext (pid,s,e,x,p,l);
  End;
Run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="SAS Monospace" size="1"&gt;bacode=atmbarcode :_SS&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="SAS Monospace" size="1"&gt;bacode=1zt2 : _5r&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If not, please supply a couple of line of data and desired&amp;nbsp;output variable&amp;nbsp;values.&lt;/P&gt;</description>
      <pubDate>Tue, 12 Jul 2016 05:43:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-use-Prxparse-to-find-two-different-words/m-p/283684#M59261</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2016-07-12T05:43:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Prxparse to find two different words</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-use-Prxparse-to-find-two-different-words/m-p/283967#M59278</link>
      <description>It didn't work I can do it in steps first pulling atmbarcode which works than pulling for tracking number which is in column X example 1ZT28 an one more letter an 10 more digits all together 17 characters long .hi have this code&lt;BR /&gt;&lt;BR /&gt;Data have;&lt;BR /&gt;Set have;&lt;BR /&gt;Newvar=('s/.+([A-Z](2)) *(\d+).*/$1$2/o',-1,'x'n);&lt;BR /&gt;Run;&lt;BR /&gt;My output&lt;BR /&gt;Is only 6 characters ZT2487 how can I tweak it to bring in all 18 characters? Thank you&lt;BR /&gt;</description>
      <pubDate>Wed, 13 Jul 2016 05:52:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-use-Prxparse-to-find-two-different-words/m-p/283967#M59278</guid>
      <dc:creator>Beto16</dc:creator>
      <dc:date>2016-07-13T05:52:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Prxparse to find two different words</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-use-Prxparse-to-find-two-different-words/m-p/283968#M59279</link>
      <description>&lt;P&gt;Please feel free to ignore requests from &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/462"&gt;@PGStats&lt;/a&gt; and myself to supply expected data and output, and still expect meaningful answers. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jul 2016 05:55:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-use-Prxparse-to-find-two-different-words/m-p/283968#M59279</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2016-07-13T05:55:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Prxparse to find two different words</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-use-Prxparse-to-find-two-different-words/m-p/284160#M59305</link>
      <description>I thought I was providing you with all the pertaint information. .. since the atmbarcode works I fig it be easier to do it in steps since I have a code that brings 6 of the characters I thought you could show me how to tweak the code to bring the rest here is what I'm looking at right after I run the first part&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;X. Bacode. N. Newvar ZT2487&lt;BR /&gt;Blah,blah,blah, Atmbarcode :"TY272822. 2&lt;BR /&gt;Blah, blah,blah,blah,&lt;BR /&gt;1ZT2487A1221111111,blah,blah,&lt;BR /&gt;&lt;BR /&gt;Sorry for the misunderstanding I thought I was helping by providing code an not example hopes that helps my thought process</description>
      <pubDate>Wed, 13 Jul 2016 18:33:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-use-Prxparse-to-find-two-different-words/m-p/284160#M59305</guid>
      <dc:creator>Beto16</dc:creator>
      <dc:date>2016-07-13T18:33:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Prxparse to find two different words</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-use-Prxparse-to-find-two-different-words/m-p/284219#M59315</link>
      <description>&lt;P&gt;Like this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data HAVE;
  X='X. Bacode. N. Newvar ZT2487             '; output;
  X='Blah,blah,blah, Atmbarcode :"TY272822. 2'; output;
  X='Blah, blah,blah,blah,                   '; output;
  X='1ZT2487A122111112,blah,blah,            '; output;
run;
data WANT;
  set HAVE;
  PRX=prxparse('/(1ZT[A-Z\d]{14})|(?&amp;lt;=Atmbarcode\W{3})(TY\d*)/');
  call prxsubstr(PRX,X,POS,LEN);
  if POS then STR=substr(X,POS,LEN);
  putlog STR=;
run;

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;STR=&lt;/P&gt;
&lt;P&gt;STR=TY272822&lt;/P&gt;
&lt;P&gt;STR=&lt;/P&gt;
&lt;P&gt;STR=1ZT2487A122111112&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jul 2016 23:28:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-use-Prxparse-to-find-two-different-words/m-p/284219#M59315</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2016-07-13T23:28:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Prxparse to find two different words</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-use-Prxparse-to-find-two-different-words/m-p/284667#M59341</link>
      <description>Hi Chris if I'm getting an Infile how do I make refer to all X's. For it to work ?</description>
      <pubDate>Thu, 14 Jul 2016 20:19:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-use-Prxparse-to-find-two-different-words/m-p/284667#M59341</guid>
      <dc:creator>Beto16</dc:creator>
      <dc:date>2016-07-14T20:19:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to use Prxparse to find two different words</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-use-Prxparse-to-find-two-different-words/m-p/284709#M59348</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;&lt;BR /&gt;data _null_;
  file "%sysfunc(pathname(WORK))\t.txt";
  X='X. Bacode. N. Newvar ZT2487             '; put X;
  X='Blah,blah,blah, Atmbarcode :"TY272822. 2'; put X;
  X='Blah, blah,blah,blah,                   '; put X;
  X='1ZT2487A122111112,blah,blah,            '; put X;
run;
data WANT;
  infile "%sysfunc(pathname(WORK))\t.txt" pad;
  input X $80.;
  PRX=prxparse('/(1ZT[A-Z\d]{14})       (?# capture 1ZT and 14 letters or digits)
                 |                      (?# or)
                 (?&amp;lt;=Atmbarcode\W{3})   (?# capture preceeded by Atmbarcode\W{3} )
                 (TY\d*)                (?# capture TY and digits)
                /x'); 
  call prxsubstr(PRX,X,POS,LEN);
  if POS then STR=substr(X,POS,LEN);
  putlog STR=;
run;

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;STR=&lt;/P&gt;
&lt;P&gt;STR=TY272822&lt;/P&gt;
&lt;P&gt;STR=&lt;/P&gt;
&lt;P&gt;STR=1ZT2487A122111112&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;All supported SAS regular expressions documented in:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.amazon.com/High-Performance-SAS-Coding-Christian-Graffeuille/dp/1512397490" target="_self"&gt;High-Performance SAS Coding&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.amazon.com/High-Performance-SAS-Coding-Christian-Graffeuille/dp/1512397490" target="_blank"&gt;https://www.amazon.com/High-Performance-SAS-Coding-Christian-Graffeuille/dp/1512397490&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jul 2016 00:26:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-use-Prxparse-to-find-two-different-words/m-p/284709#M59348</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2016-07-15T00:26:55Z</dc:date>
    </item>
  </channel>
</rss>

