<?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: string match (whole or partial) in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/string-match-whole-or-partial/m-p/436469#M108534</link>
    <description>&lt;P&gt;Artc, I'm getting the value&amp;nbsp; 0 for all records&lt;/P&gt;</description>
    <pubDate>Mon, 12 Feb 2018 21:45:53 GMT</pubDate>
    <dc:creator>SASPhile</dc:creator>
    <dc:date>2018-02-12T21:45:53Z</dc:date>
    <item>
      <title>string match (whole or partial)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/string-match-whole-or-partial/m-p/436458#M108526</link>
      <description>&lt;P&gt;Need to compare two columns either complete or partial. This can be achived using regex,but do not want to hardcode the values as I need to compare 100's of records.&lt;/P&gt;&lt;P&gt;for instance:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ColA&amp;nbsp;&amp;nbsp;&amp;nbsp; ColB&lt;/P&gt;&lt;P&gt;AE&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AE_NCI&lt;/P&gt;&lt;P&gt;AE&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CM_AE&lt;/P&gt;&lt;P&gt;AE&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SAE_SUPP&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the colA has the string "AE" , if Colb has complete or partial that assign value as 1 . There are 100's of rows with different values that need to compared.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;usual way is if prxmatch("/ae/oi",colb)&amp;gt;0 then value=1. but here ae is hardcoded. anyway to dymaically pass colA into prxmatch function?&lt;/P&gt;</description>
      <pubDate>Mon, 12 Feb 2018 21:22:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/string-match-whole-or-partial/m-p/436458#M108526</guid>
      <dc:creator>SASPhile</dc:creator>
      <dc:date>2018-02-12T21:22:24Z</dc:date>
    </item>
    <item>
      <title>Re: string match (whole or partial)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/string-match-whole-or-partial/m-p/436460#M108528</link>
      <description>&lt;P&gt;FINDW or INDEXW?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Feb 2018 21:29:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/string-match-whole-or-partial/m-p/436460#M108528</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-02-12T21:29:21Z</dc:date>
    </item>
    <item>
      <title>Re: string match (whole or partial)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/string-match-whole-or-partial/m-p/436462#M108530</link>
      <description>&lt;P&gt;SAE_SUPP is not resulted out&lt;/P&gt;</description>
      <pubDate>Mon, 12 Feb 2018 21:31:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/string-match-whole-or-partial/m-p/436462#M108530</guid>
      <dc:creator>SASPhile</dc:creator>
      <dc:date>2018-02-12T21:31:27Z</dc:date>
    </item>
    <item>
      <title>Re: string match (whole or partial)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/string-match-whole-or-partial/m-p/436464#M108531</link>
      <description>&lt;P&gt;How about:&lt;/P&gt;
&lt;PRE&gt;data have;
  input (ColA    ColB) ($);
  cards;
AE       AE_NCI
AE       CM_AE
AE       SAE_SUPP
AE       AB_NCI
AB       AB_NCI
AB       CM_AE
AB       SAB_SUPP
;

data want;
  set have;
  if find(ColB,ColA,'it') then value=1;
  else value=0;
run;
&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Feb 2018 21:34:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/string-match-whole-or-partial/m-p/436464#M108531</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2018-02-12T21:34:33Z</dc:date>
    </item>
    <item>
      <title>Re: string match (whole or partial)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/string-match-whole-or-partial/m-p/436469#M108534</link>
      <description>&lt;P&gt;Artc, I'm getting the value&amp;nbsp; 0 for all records&lt;/P&gt;</description>
      <pubDate>Mon, 12 Feb 2018 21:45:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/string-match-whole-or-partial/m-p/436469#M108534</guid>
      <dc:creator>SASPhile</dc:creator>
      <dc:date>2018-02-12T21:45:53Z</dc:date>
    </item>
    <item>
      <title>Re: string match (whole or partial)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/string-match-whole-or-partial/m-p/436470#M108535</link>
      <description>I ran &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13711"&gt;@art297&lt;/a&gt; code and it worked fine with the demo data. Does it work with the demo data he shows? Does it not work with your actual data instead. Also, Art is correct, if you want partial searchs,use FIND, if searching for a specific character it's FINDC, and for a word it's FINDW.</description>
      <pubDate>Mon, 12 Feb 2018 21:49:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/string-match-whole-or-partial/m-p/436470#M108535</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-02-12T21:49:56Z</dc:date>
    </item>
    <item>
      <title>Re: string match (whole or partial)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/string-match-whole-or-partial/m-p/436473#M108537</link>
      <description>&lt;PRE&gt;find(ColB,STRIP(ColA),'it')&lt;/PRE&gt;&lt;P&gt;Remove leading and trailing blanks.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Feb 2018 21:53:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/string-match-whole-or-partial/m-p/436473#M108537</guid>
      <dc:creator>SuryaKiran</dc:creator>
      <dc:date>2018-02-12T21:53:11Z</dc:date>
    </item>
    <item>
      <title>Re: string match (whole or partial)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/string-match-whole-or-partial/m-p/436487#M108546</link>
      <description>&lt;P&gt;I agree with&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/83078"&gt;@SuryaKiran&lt;/a&gt;. If your colA includes leading and trailing blanks, then use the strip function. However, then remove the t option as it will only cause the process to slow down.&amp;nbsp; i.e.:&lt;/P&gt;
&lt;PRE&gt;data want;
  set have;
  if find(ColB,strip(ColA),'i') then value=1;
  else value=0;
run;
&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;p.s.,&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16600"&gt;@SASPhile&lt;/a&gt;: This is ArtT not ArtC&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Feb 2018 22:22:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/string-match-whole-or-partial/m-p/436487#M108546</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2018-02-12T22:22:19Z</dc:date>
    </item>
    <item>
      <title>Re: string match (whole or partial)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/string-match-whole-or-partial/m-p/436534#M108563</link>
      <description>&lt;P&gt;Like this?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data HAVE;
  input COLA $ COLB $;
  A= prxmatch(catt('/(',COLA,')/i'),COLB);
  putlog A=;
cards;
AE AE_NCI
AE CM_AE
AE SAE_SUPP
AX SAE_SUPP
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;A=1&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;A=4&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;A=2&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;A=0&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;RegEx are more expensive than functions like FIND though.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Feb 2018 02:29:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/string-match-whole-or-partial/m-p/436534#M108563</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2018-02-13T02:29:17Z</dc:date>
    </item>
  </channel>
</rss>

