<?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 Using loc function to determine if a variable contains a string in SAS/IML Software and Matrix Computations</title>
    <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Using-loc-function-to-determine-if-a-variable-contains-a-string/m-p/140792#M1150</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to use the loc function to subset a matrix but it is not working how I would like it to. I have a column of data that can contain up to 10 characters and I want to subset based on whether or not a set of 2 characters is within that string. Example: Entire variable contents could be "YAPTGR" and I want to keep that observation if that variable contains "PT." I have tried just doing loc(Variable = 'PT') but that only keeps the observation if 'PT' is the only contents of the variable. Is this possible using the loc function or do I need to use something else within IML? Thanks for the help!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 27 Jan 2015 21:28:56 GMT</pubDate>
    <dc:creator>kelchenk</dc:creator>
    <dc:date>2015-01-27T21:28:56Z</dc:date>
    <item>
      <title>Using loc function to determine if a variable contains a string</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Using-loc-function-to-determine-if-a-variable-contains-a-string/m-p/140792#M1150</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to use the loc function to subset a matrix but it is not working how I would like it to. I have a column of data that can contain up to 10 characters and I want to subset based on whether or not a set of 2 characters is within that string. Example: Entire variable contents could be "YAPTGR" and I want to keep that observation if that variable contains "PT." I have tried just doing loc(Variable = 'PT') but that only keeps the observation if 'PT' is the only contents of the variable. Is this possible using the loc function or do I need to use something else within IML? Thanks for the help!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Jan 2015 21:28:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Using-loc-function-to-determine-if-a-variable-contains-a-string/m-p/140792#M1150</guid>
      <dc:creator>kelchenk</dc:creator>
      <dc:date>2015-01-27T21:28:56Z</dc:date>
    </item>
    <item>
      <title>Re: Using loc function to determine if a variable contains a string</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Using-loc-function-to-determine-if-a-variable-contains-a-string/m-p/140793#M1151</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try combining the INDEX and LOC functions like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; a = {'AAA','BPT','PTC','PDT'};&lt;/P&gt;&lt;P&gt;&amp;nbsp; b = a[ loc(index(a, 'PT')) ];&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Jan 2015 10:52:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Using-loc-function-to-determine-if-a-variable-contains-a-string/m-p/140793#M1151</guid>
      <dc:creator>IanWakeling</dc:creator>
      <dc:date>2015-01-28T10:52:25Z</dc:date>
    </item>
  </channel>
</rss>

