<?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 Findw with special character in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Findw-with-special-character/m-p/916765#M361103</link>
    <description>&lt;P&gt;Hi, I have this code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let path=prova/qa/luca;
 
 	data _null_;
	if findw("&amp;amp;path.",'/qa/','/')=1 
	then run_build = 1;
	else if findw("&amp;amp;path.",'/prod/','/')=1 then run_build = 1;
	else run_build = 0;
	call symputx('run_build',run_build);
	run;
 
%put &amp;amp;=run_build;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I have to search exactly '/qa/' or '/prod/' and then I expect 1 as a result of run_build, but&amp;nbsp;&lt;SPAN&gt;I get 0.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;How can I do it?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;Luca&lt;/P&gt;</description>
    <pubDate>Mon, 19 Feb 2024 10:51:43 GMT</pubDate>
    <dc:creator>luca87</dc:creator>
    <dc:date>2024-02-19T10:51:43Z</dc:date>
    <item>
      <title>Findw with special character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Findw-with-special-character/m-p/916765#M361103</link>
      <description>&lt;P&gt;Hi, I have this code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let path=prova/qa/luca;
 
 	data _null_;
	if findw("&amp;amp;path.",'/qa/','/')=1 
	then run_build = 1;
	else if findw("&amp;amp;path.",'/prod/','/')=1 then run_build = 1;
	else run_build = 0;
	call symputx('run_build',run_build);
	run;
 
%put &amp;amp;=run_build;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I have to search exactly '/qa/' or '/prod/' and then I expect 1 as a result of run_build, but&amp;nbsp;&lt;SPAN&gt;I get 0.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;How can I do it?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;
&lt;P&gt;Luca&lt;/P&gt;</description>
      <pubDate>Mon, 19 Feb 2024 10:51:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Findw-with-special-character/m-p/916765#M361103</guid>
      <dc:creator>luca87</dc:creator>
      <dc:date>2024-02-19T10:51:43Z</dc:date>
    </item>
    <item>
      <title>Re: Findw with special character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Findw-with-special-character/m-p/916767#M361104</link>
      <description>&lt;P&gt;with index&amp;nbsp;seems to work&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;	data _null_;
	if index("&amp;amp;path", "/qa/") &amp;gt; 0
	then run_build = 1;
	else if index("&amp;amp;path", "/prod/") &amp;gt; 0 then run_build = 1;
	else run_build = 0;
	call symputx('run_build',run_build);
	run;
 
%put &amp;amp;=run_build;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 19 Feb 2024 10:56:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Findw-with-special-character/m-p/916767#M361104</guid>
      <dc:creator>luca87</dc:creator>
      <dc:date>2024-02-19T10:56:17Z</dc:date>
    </item>
    <item>
      <title>Re: Findw with special character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Findw-with-special-character/m-p/916768#M361105</link>
      <description>&lt;P&gt;I'm not sure why you are using FINDW, I don't think that will work here, but FIND works properly. Also, you want to test to see if the result of FIND is greater than 0, you do not want to test if the result of FIND=1. FIND returns the position in &amp;amp;path where the target characters are found, and if you test to see if it equals 1, that is the same as testing if the target string is at the BEGINNING of &amp;amp;path.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Feb 2024 11:06:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Findw-with-special-character/m-p/916768#M361105</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2024-02-19T11:06:21Z</dc:date>
    </item>
    <item>
      <title>Re: Findw with special character</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Findw-with-special-character/m-p/916769#M361106</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/95093"&gt;@luca87&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In addition to the issue with the return value of FINDW (as pointed out by Paige Miller), you should not include the delimiters in the search string. So the whole DATA step could be simplified to this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
call symputx('run_build', findw("&amp;amp;path.",'qa','/') | findw("&amp;amp;path.",'prod','/'));
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Or this, if you want to switch to FIND (or similarly to INDEX) and then include the delimiters in the search string&lt;FONT face="helvetica"&gt;:&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
call symputx('run_build', find("&amp;amp;path.",'/qa/') | find("&amp;amp;path.",'/prod/'));
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 19 Feb 2024 11:31:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Findw-with-special-character/m-p/916769#M361106</guid>
      <dc:creator>FreelanceReinh</dc:creator>
      <dc:date>2024-02-19T11:31:31Z</dc:date>
    </item>
  </channel>
</rss>

