<?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: Searching a pattern in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Searching-a-pattern/m-p/61325#M17424</link>
    <description>I prefer regular expressions to precisely identify what one needs to match.  Your code will accept any value that contains a letter V, regardless of what (if anything) comes before or after it.&lt;BR /&gt;
&lt;BR /&gt;
&amp;gt; Hi&lt;BR /&gt;
&amp;gt; ignore previous one&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; U can use this logic in either data step or proc&lt;BR /&gt;
&amp;gt; step&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; by using conditional statement&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; WHERE string like '%V%';&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; Message was edited by: sss</description>
    <pubDate>Tue, 03 May 2011 14:54:57 GMT</pubDate>
    <dc:creator>art297</dc:creator>
    <dc:date>2011-05-03T14:54:57Z</dc:date>
    <item>
      <title>Searching a pattern</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Searching-a-pattern/m-p/61321#M17420</link>
      <description>I have a situation where I need to search a character column for a specific pattern.  The pattern is based on type.  I need to search within a string for a number then a capital "V" then another number right next to it.  &lt;BR /&gt;
&lt;BR /&gt;
For example within this list below I want all the rows returned except the last one.&lt;BR /&gt;
Test 1V4&lt;BR /&gt;
Test 1V9&lt;BR /&gt;
Test 1V3&lt;BR /&gt;
Test 222&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
thank you for any help you can  give me.</description>
      <pubDate>Tue, 03 May 2011 14:03:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Searching-a-pattern/m-p/61321#M17420</guid>
      <dc:creator>jerry898969</dc:creator>
      <dc:date>2011-05-03T14:03:36Z</dc:date>
    </item>
    <item>
      <title>Re: Searching a pattern</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Searching-a-pattern/m-p/61322#M17421</link>
      <description>Jerry,&lt;BR /&gt;
&lt;BR /&gt;
You may have to be more specific regarding what you are looking for.  The following will find a pattern of a number, followed by the letter V, followed by a number, anywhere in a string:&lt;BR /&gt;
[pre]&lt;BR /&gt;
data have;&lt;BR /&gt;
  informat string $20.;&lt;BR /&gt;
  input string &amp;amp;;&lt;BR /&gt;
  cards;&lt;BR /&gt;
Test 1V4&lt;BR /&gt;
Test 1V9&lt;BR /&gt;
Test 1V3&lt;BR /&gt;
Test 222&lt;BR /&gt;
Test 22V&lt;BR /&gt;
Test 3V5&lt;BR /&gt;
;&lt;BR /&gt;
&lt;BR /&gt;
data want;&lt;BR /&gt;
  set have;&lt;BR /&gt;
  if _n_ = 1 THEN pattern_loc = PRXPARSE("/\d\V\d/"); &lt;BR /&gt;
   *Exact match for number, followed by the letter V, followed by&lt;BR /&gt;
    a number anywhere in the string; &lt;BR /&gt;
  retain pattern_loc;&lt;BR /&gt;
  position=prxmatch(pattern_loc,string);&lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
Of course, if what you really want deviates from that, in any way, a different prxparse call would have to be written.  You can find a nice introductory article on pattern matching at: &lt;A href="http://www.nesug.org/proceedings/nesug03/bt/bt002.pdf" target="_blank"&gt;http://www.nesug.org/proceedings/nesug03/bt/bt002.pdf&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
HTH,&lt;BR /&gt;
Art</description>
      <pubDate>Tue, 03 May 2011 14:31:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Searching-a-pattern/m-p/61322#M17421</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2011-05-03T14:31:25Z</dc:date>
    </item>
    <item>
      <title>Re: Searching a pattern</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Searching-a-pattern/m-p/61323#M17422</link>
      <description>Hi&lt;BR /&gt;
&lt;BR /&gt;
U can use this logic in either data step or proc step&lt;BR /&gt;
&lt;BR /&gt;
by using conditional statement&lt;BR /&gt;
&lt;BR /&gt;
WHERE COL2='%V%';</description>
      <pubDate>Tue, 03 May 2011 14:37:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Searching-a-pattern/m-p/61323#M17422</guid>
      <dc:creator>sss</dc:creator>
      <dc:date>2011-05-03T14:37:32Z</dc:date>
    </item>
    <item>
      <title>Re: Searching a pattern</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Searching-a-pattern/m-p/61324#M17423</link>
      <description>Hi&lt;BR /&gt;
ignore previous one&lt;BR /&gt;
&lt;BR /&gt;
U can use this logic in either data step or proc step&lt;BR /&gt;
&lt;BR /&gt;
by using conditional statement&lt;BR /&gt;
&lt;BR /&gt;
WHERE string like '%V%';

Message was edited by: sss</description>
      <pubDate>Tue, 03 May 2011 14:44:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Searching-a-pattern/m-p/61324#M17423</guid>
      <dc:creator>sss</dc:creator>
      <dc:date>2011-05-03T14:44:16Z</dc:date>
    </item>
    <item>
      <title>Re: Searching a pattern</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Searching-a-pattern/m-p/61325#M17424</link>
      <description>I prefer regular expressions to precisely identify what one needs to match.  Your code will accept any value that contains a letter V, regardless of what (if anything) comes before or after it.&lt;BR /&gt;
&lt;BR /&gt;
&amp;gt; Hi&lt;BR /&gt;
&amp;gt; ignore previous one&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; U can use this logic in either data step or proc&lt;BR /&gt;
&amp;gt; step&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; by using conditional statement&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; WHERE string like '%V%';&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; Message was edited by: sss</description>
      <pubDate>Tue, 03 May 2011 14:54:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Searching-a-pattern/m-p/61325#M17424</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2011-05-03T14:54:57Z</dc:date>
    </item>
    <item>
      <title>Re: Searching a pattern</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Searching-a-pattern/m-p/61326#M17425</link>
      <description>Art,&lt;BR /&gt;
&lt;BR /&gt;
Thank you so much that was it.  I was looking for a number then the letter "V" then another number. &lt;BR /&gt;
&lt;BR /&gt;
Thank you&lt;BR /&gt;
Jerry</description>
      <pubDate>Tue, 03 May 2011 15:03:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Searching-a-pattern/m-p/61326#M17425</guid>
      <dc:creator>jerry898969</dc:creator>
      <dc:date>2011-05-03T15:03:45Z</dc:date>
    </item>
    <item>
      <title>Re: Searching a pattern</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Searching-a-pattern/m-p/61327#M17426</link>
      <description>sss,&lt;BR /&gt;
&lt;BR /&gt;
Thank you for your reply as well.  That won't work because there can be other "V" in the string.  I need the number "V" number pattern.&lt;BR /&gt;
&lt;BR /&gt;
Thank you for the suggestion&lt;BR /&gt;
&lt;BR /&gt;
Jerry</description>
      <pubDate>Tue, 03 May 2011 15:04:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Searching-a-pattern/m-p/61327#M17426</guid>
      <dc:creator>jerry898969</dc:creator>
      <dc:date>2011-05-03T15:04:58Z</dc:date>
    </item>
  </channel>
</rss>

