<?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: find function is not working properly into a SAS macro function in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/find-function-is-not-working-properly-into-a-SAS-macro-function/m-p/950847#M45521</link>
    <description>&lt;P&gt;When you add quotes to values to search for in the MACRO language then if the searched string doesn't have the quotes you don't get a match.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Run this:&lt;/P&gt;
&lt;PRE&gt;%let csvfile=*.csv: No such file or directory;

%put %sysfunc(find(&amp;amp;csvfile,'No such file'));

%put %sysfunc(find(&amp;amp;csvfile,No such file));&lt;/PRE&gt;
&lt;P&gt;The 8 from the second %put shows that the text is found.&lt;/P&gt;</description>
    <pubDate>Thu, 14 Nov 2024 20:09:27 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2024-11-14T20:09:27Z</dc:date>
    <item>
      <title>find function is not working properly into a SAS macro function</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/find-function-is-not-working-properly-into-a-SAS-macro-function/m-p/950846#M45520</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;I need to test if &amp;amp;csvfile containt the name of a file or no suc file . Then if there is a csv file then import the data into a sas data set . Otherwise, put there is no csv file to import into a sas dataset.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro test;

%let csvfile=*.csv: No such file or directory;
%let csvfile=Master_list_20241031.csv;
%if %sysfunc(find(&amp;amp;csvfile,'No such file')) = 0 %then
%do;
	%put "there is a none empty csv file to import into a sas dataset";
%end;
%else 
%do;
	%put "There is no csv file to import into a SAS dataset";
%end;
%mend test;
%test;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If I select the first csvfile, I am expecting to get&amp;nbsp;&lt;CODE class=" language-sas"&gt;There is no csv file to import into a SAS dataset and&amp;nbsp;if&amp;nbsp;I&amp;nbsp;use&amp;nbsp;the&amp;nbsp;second&amp;nbsp;value&amp;nbsp;I&amp;nbsp;expect&amp;nbsp;to&amp;nbsp;get&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;there is a none empty csv file to import into a sas dataset&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-sas"&gt;It is not working properly What's wrong&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Nov 2024 19:49:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/find-function-is-not-working-properly-into-a-SAS-macro-function/m-p/950846#M45520</guid>
      <dc:creator>alepage</dc:creator>
      <dc:date>2024-11-14T19:49:36Z</dc:date>
    </item>
    <item>
      <title>Re: find function is not working properly into a SAS macro function</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/find-function-is-not-working-properly-into-a-SAS-macro-function/m-p/950847#M45521</link>
      <description>&lt;P&gt;When you add quotes to values to search for in the MACRO language then if the searched string doesn't have the quotes you don't get a match.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Run this:&lt;/P&gt;
&lt;PRE&gt;%let csvfile=*.csv: No such file or directory;

%put %sysfunc(find(&amp;amp;csvfile,'No such file'));

%put %sysfunc(find(&amp;amp;csvfile,No such file));&lt;/PRE&gt;
&lt;P&gt;The 8 from the second %put shows that the text is found.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Nov 2024 20:09:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/find-function-is-not-working-properly-into-a-SAS-macro-function/m-p/950847#M45521</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2024-11-14T20:09:27Z</dc:date>
    </item>
    <item>
      <title>Re: find function is not working properly into a SAS macro function</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/find-function-is-not-working-properly-into-a-SAS-macro-function/m-p/950849#M45522</link>
      <description>&lt;P&gt;Every value in the macro language is a string.&lt;/P&gt;
&lt;P&gt;So you should not use quotes for the variable values, unless of course the value contains quotes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Nov 2024 20:06:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/find-function-is-not-working-properly-into-a-SAS-macro-function/m-p/950849#M45522</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2024-11-14T20:06:08Z</dc:date>
    </item>
  </channel>
</rss>

