<?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: SUBSTRING check in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SUBSTRING-check/m-p/263378#M51543</link>
    <description>&lt;P&gt;You'll have to separate the strings.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The INDEX() function looks for an exact match, not for each of the words.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can try PRX functions or put the words into a temporary array and use that.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It depends on how generalized your problem is, is the B changing per row, or fixed across the data set?&lt;/P&gt;</description>
    <pubDate>Wed, 13 Apr 2016 02:20:47 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2016-04-13T02:20:47Z</dc:date>
    <item>
      <title>SUBSTRING check</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SUBSTRING-check/m-p/263377#M51542</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have two variable a &amp;nbsp;&amp;amp; b, I would like to check whether b string is in a string . &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;index(a, b ) &amp;nbsp;could not pick up some values, for examples:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data _null_ ;&amp;nbsp;&lt;/P&gt;&lt;P&gt;a = "Bevacizumab,Cisplatin,Pemetrexed Disodium" ;&lt;/P&gt;&lt;P&gt;b = "Bevacizumab,Pemetrexed Disodium" ;&lt;/P&gt;&lt;P&gt;c = index( a, b ) ;&lt;/P&gt;&lt;P&gt;put c &amp;nbsp;;&lt;/P&gt;&lt;P&gt;run ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Should I need to seperate the B string and then use index function or whether there is another function to check this ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you !&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 13 Apr 2016 02:10:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SUBSTRING-check/m-p/263377#M51542</guid>
      <dc:creator>Ivy</dc:creator>
      <dc:date>2016-04-13T02:10:03Z</dc:date>
    </item>
    <item>
      <title>Re: SUBSTRING check</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SUBSTRING-check/m-p/263378#M51543</link>
      <description>&lt;P&gt;You'll have to separate the strings.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The INDEX() function looks for an exact match, not for each of the words.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can try PRX functions or put the words into a temporary array and use that.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It depends on how generalized your problem is, is the B changing per row, or fixed across the data set?&lt;/P&gt;</description>
      <pubDate>Wed, 13 Apr 2016 02:20:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SUBSTRING-check/m-p/263378#M51543</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-04-13T02:20:47Z</dc:date>
    </item>
    <item>
      <title>Re: SUBSTRING check</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SUBSTRING-check/m-p/263379#M51544</link>
      <description>Thank you, Reeza .&lt;BR /&gt;&lt;BR /&gt;B is changing per row, some B string has one part, some has two or three parts. Maybe I need to separate them. Thank you again !</description>
      <pubDate>Wed, 13 Apr 2016 02:23:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SUBSTRING-check/m-p/263379#M51544</guid>
      <dc:creator>Ivy</dc:creator>
      <dc:date>2016-04-13T02:23:41Z</dc:date>
    </item>
    <item>
      <title>Re: SUBSTRING check</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SUBSTRING-check/m-p/263381#M51545</link>
      <description>&lt;P&gt;Yes, you need to separate them. Use the scan function.&lt;/P&gt;
&lt;P&gt;If you make the data long, you can change it to a SQL query which should be easier to code as well.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Apr 2016 02:33:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SUBSTRING-check/m-p/263381#M51545</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-04-13T02:33:17Z</dc:date>
    </item>
    <item>
      <title>Re: SUBSTRING check</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SUBSTRING-check/m-p/263383#M51546</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want(drop=search_string i flag);
set have;
flag=0;
length search_string $30;

do i=1 to countw(b,',');
    do search_string = scan(b,i,','); 
       if index(trim(a), trim(search_string)) then flag+1;
    end;
end;

if flag=countw(b,',') then found='b in a';
else found='b not in a';

run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 13 Apr 2016 03:47:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SUBSTRING-check/m-p/263383#M51546</guid>
      <dc:creator>stat_sas</dc:creator>
      <dc:date>2016-04-13T03:47:06Z</dc:date>
    </item>
    <item>
      <title>Re: SUBSTRING check</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SUBSTRING-check/m-p/263388#M51547</link>
      <description>&lt;P&gt;You couild always use regular expressions&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_; 
length pat $60;
a = "Bevacizumab,Cisplatin,Pemetrexed Disodium" ;
x = "Bevacizumab,Cisplatin,Pemetrexed Dissodium" ;
b = "Bevacizumab,Pemetrexed Disodium";
pat = prxchange("s/,/.*/", -1, b);
pat = cats("/", pat, "/i");
c = prxmatch(pat, a) &amp;gt; 0;
put c=;
d = prxmatch(pat, x) &amp;gt; 0;
put d=;
run ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Will match if the substrings are in the same order.&lt;/P&gt;</description>
      <pubDate>Wed, 13 Apr 2016 03:31:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SUBSTRING-check/m-p/263388#M51547</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2016-04-13T03:31:17Z</dc:date>
    </item>
  </channel>
</rss>

