<?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 string matching two character vectors in SAS/IML Software and Matrix Computations</title>
    <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/string-matching-two-character-vectors/m-p/762902#M5607</link>
    <description>&lt;P&gt;I have two character vectors. Let's call them Source and Pattern. For each entry in Pattern, I want to know if it is represented in Source. Here is an example:&lt;/P&gt;&lt;P&gt;----------&lt;/P&gt;&lt;P&gt;Pattern = 'trapmf' // 'trimf' // 'pimf' ;&lt;BR /&gt;Source = 'dsigmf' // 'trapmf' // 'pimf' // 'gaussmf' ;&lt;/P&gt;&lt;P&gt;print Pattern Source ;&lt;/P&gt;&lt;P&gt;do i = 1 to nrow( Pattern ) ;&lt;BR /&gt;Match = any( Pattern[i] = Source ) ;&lt;BR /&gt;print Match ;&lt;BR /&gt;end ;&lt;/P&gt;&lt;P&gt;----------&lt;/P&gt;&lt;P&gt;Then the expected results are: Match = 1,0, 1 as expected. But I have to use a loop, which I consider to be inelegant. How can I use SAS/IML matrix manipulation to create an "outer product" character match?&lt;/P&gt;</description>
    <pubDate>Fri, 20 Aug 2021 17:46:15 GMT</pubDate>
    <dc:creator>rbettinger</dc:creator>
    <dc:date>2021-08-20T17:46:15Z</dc:date>
    <item>
      <title>string matching two character vectors</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/string-matching-two-character-vectors/m-p/762902#M5607</link>
      <description>&lt;P&gt;I have two character vectors. Let's call them Source and Pattern. For each entry in Pattern, I want to know if it is represented in Source. Here is an example:&lt;/P&gt;&lt;P&gt;----------&lt;/P&gt;&lt;P&gt;Pattern = 'trapmf' // 'trimf' // 'pimf' ;&lt;BR /&gt;Source = 'dsigmf' // 'trapmf' // 'pimf' // 'gaussmf' ;&lt;/P&gt;&lt;P&gt;print Pattern Source ;&lt;/P&gt;&lt;P&gt;do i = 1 to nrow( Pattern ) ;&lt;BR /&gt;Match = any( Pattern[i] = Source ) ;&lt;BR /&gt;print Match ;&lt;BR /&gt;end ;&lt;/P&gt;&lt;P&gt;----------&lt;/P&gt;&lt;P&gt;Then the expected results are: Match = 1,0, 1 as expected. But I have to use a loop, which I consider to be inelegant. How can I use SAS/IML matrix manipulation to create an "outer product" character match?&lt;/P&gt;</description>
      <pubDate>Fri, 20 Aug 2021 17:46:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/string-matching-two-character-vectors/m-p/762902#M5607</guid>
      <dc:creator>rbettinger</dc:creator>
      <dc:date>2021-08-20T17:46:15Z</dc:date>
    </item>
    <item>
      <title>Re: string matching two character vectors</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/string-matching-two-character-vectors/m-p/762913#M5608</link>
      <description>&lt;P&gt;Use &lt;A href="https://blogs.sas.com/content/iml/2014/03/17/finding-elements-in-one-vector-that-are-not-in-another-vector.html" target="_self"&gt;the ELEMENT function&lt;/A&gt;:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;b = element(Pattern, Source);
print b;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;BTW, that performs a case-sensitive comparison. If you want a case-insensitive comparison, use &lt;A href="https://blogs.sas.com/content/iml/2011/03/07/need-case-insensitive-string-comparisons-upcase.html" target="_self"&gt;the UPCASE function&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Aug 2021 18:31:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/string-matching-two-character-vectors/m-p/762913#M5608</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2021-08-20T18:31:57Z</dc:date>
    </item>
    <item>
      <title>Re: string matching two character vectors</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/string-matching-two-character-vectors/m-p/762942#M5609</link>
      <description>&lt;P&gt;Exactly what I wanted! Thank you very much!&lt;/P&gt;</description>
      <pubDate>Fri, 20 Aug 2021 19:38:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/string-matching-two-character-vectors/m-p/762942#M5609</guid>
      <dc:creator>rbettinger</dc:creator>
      <dc:date>2021-08-20T19:38:06Z</dc:date>
    </item>
  </channel>
</rss>

