<?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 Search matching character values in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Search-matching-character-values/m-p/845849#M334396</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am trying to find the values when Name1 contains Name2 values then it should output however I am not able to find out either with FIND or INDEX functions. Please help in getting the output. I want all the records as matching except last record.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test1;
   input Name1 $12. Name2 $25.;
datalines;
ORANGE APPLE APPLE
OATS WHEAT   WHEAT
WHEAT GRAIN  GRAIN
WHEATGRAIN   WHEAT-GRAIN
WHEAT-GRAIN  WHEAT
APPLE ORANGE ORANGE
WEAT ORANGE  GRAIN
;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 23 Nov 2022 05:57:45 GMT</pubDate>
    <dc:creator>1239</dc:creator>
    <dc:date>2022-11-23T05:57:45Z</dc:date>
    <item>
      <title>Search matching character values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Search-matching-character-values/m-p/845849#M334396</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am trying to find the values when Name1 contains Name2 values then it should output however I am not able to find out either with FIND or INDEX functions. Please help in getting the output. I want all the records as matching except last record.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test1;
   input Name1 $12. Name2 $25.;
datalines;
ORANGE APPLE APPLE
OATS WHEAT   WHEAT
WHEAT GRAIN  GRAIN
WHEATGRAIN   WHEAT-GRAIN
WHEAT-GRAIN  WHEAT
APPLE ORANGE ORANGE
WEAT ORANGE  GRAIN
;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 23 Nov 2022 05:57:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Search-matching-character-values/m-p/845849#M334396</guid>
      <dc:creator>1239</dc:creator>
      <dc:date>2022-11-23T05:57:45Z</dc:date>
    </item>
    <item>
      <title>Re: Search matching character values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Search-matching-character-values/m-p/845853#M334399</link>
      <description>&lt;P&gt;Given the lengths of your strings, I'm guessing your problem is caused by trailing blanks. Try this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test1;
   input Name1 $12. Name2 $25.;
datalines;
ORANGE APPLE APPLE
OATS WHEAT   WHEAT
WHEAT GRAIN  GRAIN
WHEATGRAIN   WHEAT-GRAIN
WHEAT-GRAIN  WHEAT
APPLE ORANGE ORANGE
WEAT ORANGE  GRAIN
;
run;

data want;
   set test1;
   if index(Name1, trim(Name2));
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 23 Nov 2022 06:18:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Search-matching-character-values/m-p/845853#M334399</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2022-11-23T06:18:31Z</dc:date>
    </item>
    <item>
      <title>Re: Search matching character values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Search-matching-character-values/m-p/845879#M334413</link>
      <description>&lt;P&gt;Thanks for the code however&amp;nbsp;Row # 4 WHEATGRAIN WHEAT-GRAIN didn't pull from your code. Only last row shouldn't be pulled but rest of the rows should be pulled.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Nov 2022 10:05:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Search-matching-character-values/m-p/845879#M334413</guid>
      <dc:creator>1239</dc:creator>
      <dc:date>2022-11-23T10:05:36Z</dc:date>
    </item>
    <item>
      <title>Re: Search matching character values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Search-matching-character-values/m-p/845881#M334415</link>
      <description>&lt;P&gt;What is the logic here? You can remove anything but digits and numbers from the name2 strings and do the match, but I do not know if that is correct in your case? Please be specific.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Nov 2022 10:08:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Search-matching-character-values/m-p/845881#M334415</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2022-11-23T10:08:20Z</dc:date>
    </item>
  </channel>
</rss>

