<?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: SAS Function in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-Function/m-p/630382#M186621</link>
    <description>&lt;P&gt;Is it possible you have an old version of SAS.&amp;nbsp; Find was introduced with version 9.&amp;nbsp; Try Index&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="index.png" style="width: 345px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/36674iADAFE20333A2E3C1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="index.png" alt="index.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data x;
input Ptid  Education $char10.;
edu_f = FIND(Education,"MD")&amp;gt;0; 
edu_i = INDEX(Education,"MD")&amp;gt;0; 
Datalines ;
1.     MD,DO
2.     MD
3.     PHD
;
proc print;run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sat, 07 Mar 2020 16:26:52 GMT</pubDate>
    <dc:creator>ghosh</dc:creator>
    <dc:date>2020-03-07T16:26:52Z</dc:date>
    <item>
      <title>SAS Function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Function/m-p/630359#M186609</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;edu = FINDC(Education,"MD"); &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Datalines&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ptid&amp;nbsp; EDucation&lt;/P&gt;&lt;P&gt;1. &amp;nbsp; &amp;nbsp; MD,DO&lt;/P&gt;&lt;P&gt;2. &amp;nbsp; &amp;nbsp; MD&lt;/P&gt;&lt;P&gt;3. &amp;nbsp; &amp;nbsp; PHD&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How I want to code&lt;/P&gt;&lt;P&gt;Ptid&amp;nbsp; EDucation&amp;nbsp; edu&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. &amp;nbsp; &amp;nbsp; MD,DO &amp;nbsp; &amp;nbsp;&amp;nbsp; 1&lt;/P&gt;&lt;P&gt;2. &amp;nbsp; &amp;nbsp; MD &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; 1&lt;/P&gt;&lt;P&gt;3. &amp;nbsp; &amp;nbsp; PHD &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; 0&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;edu = Find(Education, "MD")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 07 Mar 2020 14:35:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Function/m-p/630359#M186609</guid>
      <dc:creator>knargis160</dc:creator>
      <dc:date>2020-03-07T14:35:24Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Function/m-p/630361#M186610</link>
      <description>&lt;P&gt;What is your question?&lt;/P&gt;</description>
      <pubDate>Sat, 07 Mar 2020 14:37:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Function/m-p/630361#M186610</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-03-07T14:37:40Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Function/m-p/630365#M186613</link>
      <description>&lt;P&gt;The code is not working. Can you help come up with a code that give me the output as displayed above.&lt;/P&gt;</description>
      <pubDate>Sat, 07 Mar 2020 14:55:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Function/m-p/630365#M186613</guid>
      <dc:creator>knargis160</dc:creator>
      <dc:date>2020-03-07T14:55:07Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Function/m-p/630366#M186614</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;edu = find(EDucation,'MD')&amp;gt;0;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 07 Mar 2020 15:04:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Function/m-p/630366#M186614</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-03-07T15:04:09Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Function/m-p/630368#M186615</link>
      <description>&lt;P&gt;Why are you using the find&lt;STRONG&gt;C&lt;/STRONG&gt; function, which searches for single characters?&lt;/P&gt;
&lt;P&gt;Rather use find, which searches for strings, or findw, which searches for words.&lt;/P&gt;</description>
      <pubDate>Sat, 07 Mar 2020 15:38:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Function/m-p/630368#M186615</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-03-07T15:38:51Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Function/m-p/630376#M186617</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/176514"&gt;@knargis160&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data have;
	input Ptid $  EDucation $;
	edu = FINDC(Education,"MD"); 
	edu1 = FIND(Education,"MD"); 
	edu2 = FINDW(Education,"MD"); 
	datalines;
1.     MD,DO
2.     MD
3.     PHD
;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture d’écran 2020-03-07 à 16.58.17.png" style="width: 199px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/36671iC05DD041496BC9B7/image-size/small?v=v2&amp;amp;px=200" role="button" title="Capture d’écran 2020-03-07 à 16.58.17.png" alt="Capture d’écran 2020-03-07 à 16.58.17.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the above code:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;FINDC is looking for either "M" or "D" (-&amp;gt; it looks for each character in the list you provide)&lt;/LI&gt;
&lt;LI&gt;FIND is looking for the substring "MD" either as a word or in a string (case sensitive)&amp;nbsp;&lt;/LI&gt;
&lt;LI&gt;FINDW is looking for the substring "MD" as a word (case sensitive)&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;In your example, FIND and FINDW are equivalent, but if you had "MD" has part of a word, it would give different results.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;NB: if you want to make a broader search and look at MD / md / MD / Md, you can add the 'i' modifier:&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;In the FIND function, it should be the third argument:&lt;/LI&gt;
&lt;/UL&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;edu = FIND(Education,"MD","i"); &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;or&amp;nbsp;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;In the FINDW function, it should be the 4th argument (the 3rd specifies the separators between words):&lt;/LI&gt;
&lt;/UL&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;edu = FINDW(Education,"MD"," ,","i"); &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Best,&lt;/P&gt;</description>
      <pubDate>Sat, 07 Mar 2020 16:07:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Function/m-p/630376#M186617</guid>
      <dc:creator>ed_sas_member</dc:creator>
      <dc:date>2020-03-07T16:07:36Z</dc:date>
    </item>
    <item>
      <title>Re: SAS Function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-Function/m-p/630382#M186621</link>
      <description>&lt;P&gt;Is it possible you have an old version of SAS.&amp;nbsp; Find was introduced with version 9.&amp;nbsp; Try Index&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-left" image-alt="index.png" style="width: 345px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/36674iADAFE20333A2E3C1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="index.png" alt="index.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data x;
input Ptid  Education $char10.;
edu_f = FIND(Education,"MD")&amp;gt;0; 
edu_i = INDEX(Education,"MD")&amp;gt;0; 
Datalines ;
1.     MD,DO
2.     MD
3.     PHD
;
proc print;run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 07 Mar 2020 16:26:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-Function/m-p/630382#M186621</guid>
      <dc:creator>ghosh</dc:creator>
      <dc:date>2020-03-07T16:26:52Z</dc:date>
    </item>
  </channel>
</rss>

