<?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 SAS function Index  problem in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-function-Index-problem/m-p/640329#M190704</link>
    <description>&lt;P&gt;good day,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;i am using function index for searching the keyword from my data but some error happen and&amp;nbsp;here is the example&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;NAME&lt;/P&gt;
&lt;P&gt;Liverpool&lt;/P&gt;
&lt;P&gt;Liverpoollowolo&lt;/P&gt;
&lt;P&gt;club Liverpool&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;data have;&lt;/P&gt;
&lt;P&gt;if index(NAME,"Liverpool") then output;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The final data will contain these three names but the second (Liverpoollowolo) is not the result i want. how can i fix this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;can i add space to the keyword like below?&lt;/P&gt;
&lt;P&gt;if index(NAME," Liverpool ") then output;&lt;/P&gt;
&lt;P&gt;but i am afraid that the first one will fail cause there is no space before the name Liverpool&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;what i am looking for is a separate "Liverpool" in my new data set&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Harry&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 16 Apr 2020 08:45:37 GMT</pubDate>
    <dc:creator>harrylui</dc:creator>
    <dc:date>2020-04-16T08:45:37Z</dc:date>
    <item>
      <title>SAS function Index  problem</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-function-Index-problem/m-p/640329#M190704</link>
      <description>&lt;P&gt;good day,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;i am using function index for searching the keyword from my data but some error happen and&amp;nbsp;here is the example&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;NAME&lt;/P&gt;
&lt;P&gt;Liverpool&lt;/P&gt;
&lt;P&gt;Liverpoollowolo&lt;/P&gt;
&lt;P&gt;club Liverpool&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;data want;&lt;/P&gt;
&lt;P&gt;data have;&lt;/P&gt;
&lt;P&gt;if index(NAME,"Liverpool") then output;&lt;/P&gt;
&lt;P&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The final data will contain these three names but the second (Liverpoollowolo) is not the result i want. how can i fix this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;can i add space to the keyword like below?&lt;/P&gt;
&lt;P&gt;if index(NAME," Liverpool ") then output;&lt;/P&gt;
&lt;P&gt;but i am afraid that the first one will fail cause there is no space before the name Liverpool&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;what i am looking for is a separate "Liverpool" in my new data set&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Harry&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Apr 2020 08:45:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-function-Index-problem/m-p/640329#M190704</guid>
      <dc:creator>harrylui</dc:creator>
      <dc:date>2020-04-16T08:45:37Z</dc:date>
    </item>
    <item>
      <title>Re: SAS function Index  problem</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-function-Index-problem/m-p/640332#M190707</link>
      <description>&lt;P&gt;Use the INDEXW function if searching for words:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
input name $50.;
if indexw(name,"Liverpool") then output;
datalines;
Liverpool
Liverpoollowolo
club Liverpool
;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 16 Apr 2020 08:50:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-function-Index-problem/m-p/640332#M190707</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-04-16T08:50:01Z</dc:date>
    </item>
    <item>
      <title>Re: SAS function Index  problem</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-function-Index-problem/m-p/640337#M190712</link>
      <description>&lt;P&gt;hi&lt;/P&gt;
&lt;P&gt;you can use indexw(), findw()&lt;/P&gt;
&lt;P&gt;it would be better to use upcase or lowcase for case-insensitive&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;if indexw(upcase(NAME),"LIVERPOOL") then output; 
if findw(lowcase(NAME),"liverpool") then output;
if findw(NAME,"liverpool"," ",'i') then output;&lt;/LI-CODE&gt;
&lt;P&gt;have a good day&lt;/P&gt;
&lt;PRE&gt;&amp;nbsp;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Apr 2020 09:10:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-function-Index-problem/m-p/640337#M190712</guid>
      <dc:creator>kelxxx</dc:creator>
      <dc:date>2020-04-16T09:10:53Z</dc:date>
    </item>
  </channel>
</rss>

