<?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: If else using find function in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/If-else-using-find-function/m-p/587196#M167690</link>
    <description>&lt;P&gt;ok, may I know how can I tweak the condition to get the desired results?&lt;/P&gt;</description>
    <pubDate>Mon, 09 Sep 2019 10:57:42 GMT</pubDate>
    <dc:creator>Babloo</dc:creator>
    <dc:date>2019-09-09T10:57:42Z</dc:date>
    <item>
      <title>If else using find function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-else-using-find-function/m-p/587187#M167687</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If I execute the below code, I'm not getting the right value for the variable &lt;CODE class=" language-sas"&gt;SOLN_CMPNT_NM&lt;/CODE&gt;. I'm getting the value as "DATA EXPORT" instead of "DATA TRANSFER" when my &lt;CODE class=" language-sas"&gt;&amp;amp;etls_jobName&amp;nbsp;resolves&amp;nbsp;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;I'm not certin what I'm doing wrong here.&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Sep 2019 08:52:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-else-using-find-function/m-p/587187#M167687</guid>
      <dc:creator>Babloo</dc:creator>
      <dc:date>2019-09-12T08:52:28Z</dc:date>
    </item>
    <item>
      <title>Re: If else using find function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-else-using-find-function/m-p/587190#M167689</link>
      <description>&lt;P&gt;Find returns 0 if the string was not found, so results matches exactly your code.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Sep 2019 10:41:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-else-using-find-function/m-p/587190#M167689</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2019-09-09T10:41:06Z</dc:date>
    </item>
    <item>
      <title>Re: If else using find function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-else-using-find-function/m-p/587196#M167690</link>
      <description>&lt;P&gt;ok, may I know how can I tweak the condition to get the desired results?&lt;/P&gt;</description>
      <pubDate>Mon, 09 Sep 2019 10:57:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-else-using-find-function/m-p/587196#M167690</guid>
      <dc:creator>Babloo</dc:creator>
      <dc:date>2019-09-09T10:57:42Z</dc:date>
    </item>
    <item>
      <title>Re: If else using find function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-else-using-find-function/m-p/587197#M167691</link>
      <description>&lt;P&gt;Please try to use findw instead of find&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let etls_jobName=J_PAC_TRA_INSURANCE_CONTRACT_GROUP;
data metadata;
FNCTL_CMPNT_NM=ifc(indexw("&amp;amp;etls_jobName","_ADP_"),'ADP','LDIS');
if findw("&amp;amp;etls_jobName","_TRA_") = 0 
then SOLN_CMPNT_NM= "DATA TRANSFER" ;           
else if findw("&amp;amp;etls_jobName","_EXPORT") = 0 
then SOLN_CMPNT_NM = "DATA EXPORT" ; 
else if findw("&amp;amp;etls_jobName","_LOA_") = 0 
then SOLN_CMPNT_NM = "DATA LOADER" ; 
else if SOLN_CMPNT_NM = "DATA IMPORT" ; 
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 09 Sep 2019 10:58:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-else-using-find-function/m-p/587197#M167691</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2019-09-09T10:58:42Z</dc:date>
    </item>
    <item>
      <title>Re: If else using find function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-else-using-find-function/m-p/588125#M168043</link>
      <description>&lt;P&gt;I ran the code below and got the Output as "DATA TRANSFER" instead of "DATA LOADER" for the variable SOLN_CMPNT_NM&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Sep 2019 08:53:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-else-using-find-function/m-p/588125#M168043</guid>
      <dc:creator>Babloo</dc:creator>
      <dc:date>2019-09-12T08:53:03Z</dc:date>
    </item>
    <item>
      <title>Re: If else using find function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-else-using-find-function/m-p/588132#M168047</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/8409"&gt;@Babloo&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Using FIND() and not FINDW() appears to be the correct function for what you're doing.&lt;/P&gt;
&lt;P&gt;As&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15475"&gt;@andreas_lds&lt;/a&gt;&amp;nbsp;already wrote: The FIND() function returns 0 if a sub-string is not found in a string. If a sub-string is found then it returns the position where the substring starts in the string. Soo.... Your conditions need to be:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;if find(....) &lt;FONT size="4" color="#FF0000"&gt;&lt;STRONG&gt;&amp;gt;&lt;/STRONG&gt;&lt;/FONT&gt; 0 then...&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to use FINDW() then don't use the underscore as part of your sub-string you search for but add it as 3rd parameter which defines the characters that are word delimiters.&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;if findw("&amp;amp;etls_jobName",&lt;FONT color="#FF0000"&gt;"TRA",'_'&lt;/FONT&gt;) &amp;gt; 0 then ....&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Sep 2019 08:00:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-else-using-find-function/m-p/588132#M168047</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2019-09-12T08:00:48Z</dc:date>
    </item>
    <item>
      <title>Re: If else using find function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-else-using-find-function/m-p/588137#M168049</link>
      <description>&lt;P&gt;Thanks, now I could get the desired output but also I could see the warning message in the log as below. Could you please tell me how to get rid of this warning?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;878       /*Solution Component Name derivation*/
2879       if find("&amp;amp;etls_jobName","INPUT",'_') &amp;gt; 0
2880       then SOLN_CMPNT_NM= "DATA IMPORT";
2881       else if find("&amp;amp;etls_jobName","EXPORT",'_') &amp;gt; 0
2882       then SOLN_CMPNT_NM = "DATA EXPORT" ;
2883       else if find("&amp;amp;etls_jobName","LOA",'_') &amp;gt; 0
2884       then SOLN_CMPNT_NM = "DATA LOADER" ;
2885       else if find("&amp;amp;etls_jobName","TRA",'_') &amp;gt; 0
2886       then SOLN_CMPNT_NM = "DATA TRANSER" ;
2887       else SOLN_CMPNT_NM = "OTHER" ;
2888       /*Job return code*/
2889       %PUT &amp;amp;SYSRC.;
0
2890       run;

WARNING: In a call to the FIND function or routine, the modifier "_" not valid.
WARNING: In a call to the FIND function or routine, the modifier "_" not valid.
WARNING: In a call to the FIND function or routine, the modifier "_" not valid.
WARNING: In a call to the FIND function or routine, the modifier "_" not valid.&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 12 Sep 2019 08:41:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-else-using-find-function/m-p/588137#M168049</guid>
      <dc:creator>Babloo</dc:creator>
      <dc:date>2019-09-12T08:41:10Z</dc:date>
    </item>
    <item>
      <title>Re: If else using find function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-else-using-find-function/m-p/588138#M168050</link>
      <description>&lt;P&gt;It's working If I remove the underscore.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Sep 2019 08:49:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-else-using-find-function/m-p/588138#M168050</guid>
      <dc:creator>Babloo</dc:creator>
      <dc:date>2019-09-12T08:49:21Z</dc:date>
    </item>
    <item>
      <title>Re: If else using find function</title>
      <link>https://communities.sas.com/t5/SAS-Programming/If-else-using-find-function/m-p/588402#M168150</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/8409"&gt;@Babloo&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;It's working If I remove the underscore.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Yes, because the underscore as 3rd parameter is for the find&lt;STRONG&gt;W&lt;/STRONG&gt;() function and not the find() function.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Sep 2019 23:17:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/If-else-using-find-function/m-p/588402#M168150</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2019-09-12T23:17:42Z</dc:date>
    </item>
  </channel>
</rss>

