<?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 find a string within anther string for different scenarios in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-a-string-within-anther-string-for-different/m-p/983337#M379478</link>
    <description>&lt;P&gt;Do a full self join and filter:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input address $40.;
datalines;
Lot B Plan 1234
PID 004-411-439 Lot B Plan 1234
;

proc sql;
create table want as
  select
    a.address as address_a,
    b.address as address_b
  from
    have a, have b
  where
    index(a.address,strip(b.address)) &amp;gt; 0 and a.address ne address_b
;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 11 Feb 2026 16:11:34 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2026-02-11T16:11:34Z</dc:date>
    <item>
      <title>How to find a string within anther string for different scenarios</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-a-string-within-anther-string-for-different/m-p/983333#M379474</link>
      <description>&lt;P&gt;I have many fields that are like in this example here address = 'Lot B Plan 1234' however, I need to check if this matches the same field where it would be incased in&amp;nbsp; address = 'PID 004-411-439 Lot B Plan 1234'.. but the problem is there are many scenarios like this so could be 1000s.&amp;nbsp; &amp;nbsp;So same field name but if 1 entry is encased in another entry then it would trigger a match, else no match.. could be 10000's rows and 1000s different scenarios.&amp;nbsp; Is this dooable ?&lt;/P&gt;</description>
      <pubDate>Wed, 11 Feb 2026 15:01:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-a-string-within-anther-string-for-different/m-p/983333#M379474</guid>
      <dc:creator>podarum</dc:creator>
      <dc:date>2026-02-11T15:01:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to find a string within anther string for different scenarios</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-a-string-within-anther-string-for-different/m-p/983335#M379476</link>
      <description>&lt;P&gt;If this is just a simple case where a given string is potentially an exact substring of another string contained in the same column, then I would just do a full join of the data to itself using the LIKE operator in SQL.&amp;nbsp; Something like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table matches as
select a.address as address_sub, b.address
from
    indata A
    left join
    indata B
    on b.address^=a.address and b.address like compress("%" || a.address || "%")
order by a.address
quit;
    &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;...but LIKE can be very slow.&amp;nbsp; If you have something more complex, you will need regex or something else.&amp;nbsp; Are the data in a SAS dataset, on a SQL RDBMS or somewhere else?&amp;nbsp; SAS would not necessarily be my first choice for this.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Feb 2026 15:58:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-a-string-within-anther-string-for-different/m-p/983335#M379476</guid>
      <dc:creator>quickbluefish</dc:creator>
      <dc:date>2026-02-11T15:58:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to find a string within anther string for different scenarios</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-a-string-within-anther-string-for-different/m-p/983336#M379477</link>
      <description>^^updated</description>
      <pubDate>Wed, 11 Feb 2026 15:59:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-a-string-within-anther-string-for-different/m-p/983336#M379477</guid>
      <dc:creator>quickbluefish</dc:creator>
      <dc:date>2026-02-11T15:59:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to find a string within anther string for different scenarios</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-a-string-within-anther-string-for-different/m-p/983337#M379478</link>
      <description>&lt;P&gt;Do a full self join and filter:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
input address $40.;
datalines;
Lot B Plan 1234
PID 004-411-439 Lot B Plan 1234
;

proc sql;
create table want as
  select
    a.address as address_a,
    b.address as address_b
  from
    have a, have b
  where
    index(a.address,strip(b.address)) &amp;gt; 0 and a.address ne address_b
;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 11 Feb 2026 16:11:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-a-string-within-anther-string-for-different/m-p/983337#M379478</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2026-02-11T16:11:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to find a string within anther string for different scenarios</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-find-a-string-within-anther-string-for-different/m-p/983368#M379486</link>
      <description>&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Wed, 11 Feb 2026 19:53:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-find-a-string-within-anther-string-for-different/m-p/983368#M379486</guid>
      <dc:creator>podarum</dc:creator>
      <dc:date>2026-02-11T19:53:02Z</dc:date>
    </item>
  </channel>
</rss>

