<?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: Setting variable indicator based on matching character in another variable in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Setting-variable-indicator-based-on-matching-character-in/m-p/217199#M53449</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I cannot use substr function, as the character can occur at any position.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 20 May 2015 08:20:07 GMT</pubDate>
    <dc:creator>munitech4u</dc:creator>
    <dc:date>2015-05-20T08:20:07Z</dc:date>
    <item>
      <title>Setting variable indicator based on matching character in another variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Setting-variable-indicator-based-on-matching-character-in/m-p/217195#M53445</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a variable which is collection of strings.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to created another variable say x based on some condition like "if characters ('ABC,abc,aBc,)' found in variable y then set x="ABC_found" else "ABC_not found"&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 May 2015 14:36:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Setting-variable-indicator-based-on-matching-character-in/m-p/217195#M53445</guid>
      <dc:creator>munitech4u</dc:creator>
      <dc:date>2015-05-19T14:36:03Z</dc:date>
    </item>
    <item>
      <title>Re: Setting variable indicator based on matching character in another variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Setting-variable-indicator-based-on-matching-character-in/m-p/217196#M53446</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You haven't stated a question?&amp;nbsp; Perhaps you want something like:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; x=findw(upcase(YOUR_VARIABLE),"ABC");&lt;/P&gt;&lt;P&gt;X will then contain the first starting postion of ABC in the text.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 May 2015 14:48:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Setting-variable-indicator-based-on-matching-character-in/m-p/217196#M53446</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-05-19T14:48:37Z</dc:date>
    </item>
    <item>
      <title>Re: Setting variable indicator based on matching character in another variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Setting-variable-indicator-based-on-matching-character-in/m-p/217197#M53447</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What if i wanted to check, like if 2 chars match ("ABC" or "CDE")&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 May 2015 17:57:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Setting-variable-indicator-based-on-matching-character-in/m-p/217197#M53447</guid>
      <dc:creator>munitech4u</dc:creator>
      <dc:date>2015-05-19T17:57:10Z</dc:date>
    </item>
    <item>
      <title>Re: Setting variable indicator based on matching character in another variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Setting-variable-indicator-based-on-matching-character-in/m-p/217198#M53448</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well, that's a very different requirement than your previous request.&amp;nbsp; There is the soundex function.&amp;nbsp; Maybe able to do it with reg expressions also.&amp;nbsp; The way I would do it though is to first decide on how many need to match.&amp;nbsp; Then treat the string as an array and loop over it (I assume 2 chars need to match):&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set have; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; result=0;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; do i=1 to length(strip(the_string));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if substr(the_string,i,1) in ("C","D","E") then result=result+1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then if result&amp;gt;=2 you know that at least 2 characters match irrespective of position.&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 May 2015 08:15:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Setting-variable-indicator-based-on-matching-character-in/m-p/217198#M53448</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-05-20T08:15:19Z</dc:date>
    </item>
    <item>
      <title>Re: Setting variable indicator based on matching character in another variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Setting-variable-indicator-based-on-matching-character-in/m-p/217199#M53449</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I cannot use substr function, as the character can occur at any position.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 May 2015 08:20:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Setting-variable-indicator-based-on-matching-character-in/m-p/217199#M53449</guid>
      <dc:creator>munitech4u</dc:creator>
      <dc:date>2015-05-20T08:20:07Z</dc:date>
    </item>
    <item>
      <title>Re: Setting variable indicator based on matching character in another variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Setting-variable-indicator-based-on-matching-character-in/m-p/217200#M53450</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That is what the loop is for.&amp;nbsp; &lt;/P&gt;&lt;P&gt;Iteration 1 = Is character at position 1 in the list of required characters, if so add 1 to total&lt;/P&gt;&lt;P&gt;Iteration 2 = is character at position 2 in the list of required characters, if so add 1 to total&lt;/P&gt;&lt;P&gt;Continue until end of string.&lt;/P&gt;&lt;P&gt;If total &amp;gt;= 2 - i.e if more than two required characters are found in the string any position, then there is a match.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 May 2015 08:47:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Setting-variable-indicator-based-on-matching-character-in/m-p/217200#M53450</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-05-20T08:47:23Z</dc:date>
    </item>
    <item>
      <title>Re: Setting variable indicator based on matching character in another variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Setting-variable-indicator-based-on-matching-character-in/m-p/217201#M53451</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;For some reason, result is always 0 coming for me. Is there anything we need to add for repeating over the number of rows?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 May 2015 08:58:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Setting-variable-indicator-based-on-matching-character-in/m-p/217201#M53451</guid>
      <dc:creator>munitech4u</dc:creator>
      <dc:date>2015-05-20T08:58:40Z</dc:date>
    </item>
    <item>
      <title>Re: Setting variable indicator based on matching character in another variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Setting-variable-indicator-based-on-matching-character-in/m-p/217202#M53452</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Start a new topic.&amp;nbsp; Post some test data, and what you want the output to look like.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 May 2015 10:24:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Setting-variable-indicator-based-on-matching-character-in/m-p/217202#M53452</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-05-20T10:24:34Z</dc:date>
    </item>
    <item>
      <title>Re: Setting variable indicator based on matching character in another variable</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Setting-variable-indicator-based-on-matching-character-in/m-p/217203#M53453</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Nevermind here is what worked for me: I used the FIND with if condition and set the new variable to 1 if its found and repeated same in else for next keyword and so on.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 May 2015 10:38:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Setting-variable-indicator-based-on-matching-character-in/m-p/217203#M53453</guid>
      <dc:creator>munitech4u</dc:creator>
      <dc:date>2015-05-20T10:38:24Z</dc:date>
    </item>
  </channel>
</rss>

