<?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 list of specific strings amid a character variable? in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/How-to-find-a-list-of-specific-strings-amid-a-character-variable/m-p/131730#M35807</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yep- worked like magic! Thanks PGStats&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 08 Sep 2013 04:13:55 GMT</pubDate>
    <dc:creator>Altal</dc:creator>
    <dc:date>2013-09-08T04:13:55Z</dc:date>
    <item>
      <title>How to find a list of specific strings amid a character variable?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-find-a-list-of-specific-strings-amid-a-character-variable/m-p/131725#M35802</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I want to search a variable in a very big data set for a list of specific substring.&lt;/P&gt;&lt;P&gt;I though index function would do the job, but index function can fit only one string to search for.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I var&amp;nbsp; on variable, and I want to search this variable for big number of small strings for example "DEX", HEX", "RED", "BET" and so on. &lt;/P&gt;&lt;P&gt;so I want any word in the search variable to be flagged if int has for example dexamethsone, hexagonal...etc&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was thinking this would work but it's not&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if index(VAR, 'DEX', 'HEX', 'BET') &amp;gt;0 then flag=1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't&amp;nbsp; want to specify many if statements, because my st of search is big&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any ideas.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 07 Sep 2013 17:44:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-find-a-list-of-specific-strings-amid-a-character-variable/m-p/131725#M35802</guid>
      <dc:creator>Altal</dc:creator>
      <dc:date>2013-09-07T17:44:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to find a list of specific strings amid a character variable?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-find-a-list-of-specific-strings-amid-a-character-variable/m-p/131726#M35803</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There's no way I know of to search for all three at the same time.&amp;nbsp; To cut down the costs a bit, you can use:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if index(VAR, 'DEX') then flag=1;&lt;/P&gt;&lt;P&gt;else if index(VAR, 'HEX') then flag=1;&lt;/P&gt;&lt;P&gt;else if index(VAR, 'BET') then flag=1;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good luck.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 07 Sep 2013 18:20:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-find-a-list-of-specific-strings-amid-a-character-variable/m-p/131726#M35803</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2013-09-07T18:20:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to find a list of specific strings amid a character variable?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-find-a-list-of-specific-strings-amid-a-character-variable/m-p/131727#M35804</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Maybe some PRX?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; FLAG=(prxmatch('/[DEX|HEX|RED|BET]/',VAR)&amp;gt;0);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Haikuo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 08 Sep 2013 00:54:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-find-a-list-of-specific-strings-amid-a-character-variable/m-p/131727#M35804</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2013-09-08T00:54:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to find a list of specific strings amid a character variable?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-find-a-list-of-specific-strings-amid-a-character-variable/m-p/131728#M35805</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you guys. That was really helpful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Haikuo- thank you, I didn't think about the prxmatch function before. It worked; I minimally modified your code to work. Here is what worked for me...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;&lt;/TD&gt;&lt;TD&gt;FLAG=(prxmatch('/DEX|HEX|RED|BET/',VAR)&amp;gt;0);&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can add any substring and divide them by "|". This will save from putting multiple IF statements if looking for various substrings. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 08 Sep 2013 03:41:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-find-a-list-of-specific-strings-amid-a-character-variable/m-p/131728#M35805</guid>
      <dc:creator>Altal</dc:creator>
      <dc:date>2013-09-08T03:41:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to find a list of specific strings amid a character variable?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-find-a-list-of-specific-strings-amid-a-character-variable/m-p/131729#M35806</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You might want to add a suffix to the pattern to improve efficiency and behaviour:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FLAG=(prxmatch('/DEX|HEX|RED|BET/&lt;SPAN style="color: #ff0000;"&gt;io&lt;/SPAN&gt;',VAR)&amp;gt;0);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The 'i' makes the match case insensitive and the 'o' instructs the function that the pattern should be compiled only once, otherwise, it is recompiled on every call.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;PG&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 08 Sep 2013 03:52:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-find-a-list-of-specific-strings-amid-a-character-variable/m-p/131729#M35806</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2013-09-08T03:52:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to find a list of specific strings amid a character variable?</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-find-a-list-of-specific-strings-amid-a-character-variable/m-p/131730#M35807</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yep- worked like magic! Thanks PGStats&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 08 Sep 2013 04:13:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-find-a-list-of-specific-strings-amid-a-character-variable/m-p/131730#M35807</guid>
      <dc:creator>Altal</dc:creator>
      <dc:date>2013-09-08T04:13:55Z</dc:date>
    </item>
  </channel>
</rss>

