<?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: Check fileexist then run a code or sent missing file email in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Check-fileexist-then-run-a-code-or-sent-missing-file-email/m-p/561449#M157171</link>
    <description>&lt;P&gt;Sure!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro findfile;
	%if %sysfunc(fileexist("&amp;amp;sharepath./INPUT/&amp;amp;filename..xlsx")) %then %do;
		%include "&amp;amp;path./CODE/LI_main.sas";		
	%end;
	
	%else %do;
	FILENAME TESTMAIL EMAIL TO = (&amp;amp;mailto.) 
							CC = (&amp;amp;mailcc.) 
							FROM=&amp;amp;mailfrom.			
	SUBJECT = "Weekly Report (Automated Message)";			
	DATA _NULL_;			
    	FILE TESTMAIL;			
    	PUT "Hi &amp;amp;username.,";			
    	PUT " ";			
    	PUT "No input file in &amp;amp;sharepath./INPUT/&amp;amp;filename..xlsx ";			
    	PUT "Extraction is aborted.";	
    	PUT " ";			
    	PUT "Thanks and regards,";			
    	PUT "xx";			
	RUN;
	
	%end;
	
%mend;
%findfile;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 24 May 2019 15:49:20 GMT</pubDate>
    <dc:creator>Gpp</dc:creator>
    <dc:date>2019-05-24T15:49:20Z</dc:date>
    <item>
      <title>Check fileexist then run a code or sent missing file email</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Check-fileexist-then-run-a-code-or-sent-missing-file-email/m-p/561379#M157143</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I got a report that need input file from user, I wish to automate it so if user had put the file in the path then run the report_code.sas , else send out an email to remind them.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I plan to do is ,build a new control code, by using Macro to check fileexist , if yes , then run %include “&amp;amp;path./report_code.sas” , if no then send a auto email.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I just notice that %include in a macro will caused an error. Even though the %include was successfully run. Any other method can recommend to me to avoid the error due to %include in a macro ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance !&lt;/P&gt;</description>
      <pubDate>Fri, 24 May 2019 13:25:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Check-fileexist-then-run-a-code-or-sent-missing-file-email/m-p/561379#M157143</guid>
      <dc:creator>Gpp</dc:creator>
      <dc:date>2019-05-24T13:25:06Z</dc:date>
    </item>
    <item>
      <title>Re: Check fileexist then run a code or sent missing file email</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Check-fileexist-then-run-a-code-or-sent-missing-file-email/m-p/561384#M157146</link>
      <description>&lt;P&gt;I hope that when you get your logic to preform as expected that you don't spam the reports generator with the email, please send me the file """ every 5 minutes.&amp;nbsp; People at work are trying to do the same thing not allowing enough sleep time.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 24 May 2019 13:36:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Check-fileexist-then-run-a-code-or-sent-missing-file-email/m-p/561384#M157146</guid>
      <dc:creator>VDD</dc:creator>
      <dc:date>2019-05-24T13:36:46Z</dc:date>
    </item>
    <item>
      <title>Re: Check fileexist then run a code or sent missing file email</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Check-fileexist-then-run-a-code-or-sent-missing-file-email/m-p/561402#M157154</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/264087"&gt;@Gpp&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;"&lt;SPAN&gt;&lt;EM&gt;I just notice that %include in a macro will caused an error.&lt;/EM&gt;"&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;You can do what you want if your syntax is correct. We can't help much though if you don't share your not yet working code with us; plus the error in the log or a description of the undesired behavior and how it should behave.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 24 May 2019 14:07:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Check-fileexist-then-run-a-code-or-sent-missing-file-email/m-p/561402#M157154</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2019-05-24T14:07:49Z</dc:date>
    </item>
    <item>
      <title>Re: Check fileexist then run a code or sent missing file email</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Check-fileexist-then-run-a-code-or-sent-missing-file-email/m-p/561425#M157164</link>
      <description>&lt;P&gt;hi Patrick, yes, I found my error and it' working ! thanks for the comment &lt;span class="lia-unicode-emoji" title=":grinning_face_with_big_eyes:"&gt;😃&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 24 May 2019 15:00:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Check-fileexist-then-run-a-code-or-sent-missing-file-email/m-p/561425#M157164</guid>
      <dc:creator>Gpp</dc:creator>
      <dc:date>2019-05-24T15:00:02Z</dc:date>
    </item>
    <item>
      <title>Re: Check fileexist then run a code or sent missing file email</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Check-fileexist-then-run-a-code-or-sent-missing-file-email/m-p/561435#M157165</link>
      <description>&lt;P&gt;It's good that you found your solution, it would be even better if you shared it with the community so that others may also benefit.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Amir.&lt;/P&gt;</description>
      <pubDate>Fri, 24 May 2019 15:18:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Check-fileexist-then-run-a-code-or-sent-missing-file-email/m-p/561435#M157165</guid>
      <dc:creator>Amir</dc:creator>
      <dc:date>2019-05-24T15:18:26Z</dc:date>
    </item>
    <item>
      <title>Re: Check fileexist then run a code or sent missing file email</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Check-fileexist-then-run-a-code-or-sent-missing-file-email/m-p/561449#M157171</link>
      <description>&lt;P&gt;Sure!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro findfile;
	%if %sysfunc(fileexist("&amp;amp;sharepath./INPUT/&amp;amp;filename..xlsx")) %then %do;
		%include "&amp;amp;path./CODE/LI_main.sas";		
	%end;
	
	%else %do;
	FILENAME TESTMAIL EMAIL TO = (&amp;amp;mailto.) 
							CC = (&amp;amp;mailcc.) 
							FROM=&amp;amp;mailfrom.			
	SUBJECT = "Weekly Report (Automated Message)";			
	DATA _NULL_;			
    	FILE TESTMAIL;			
    	PUT "Hi &amp;amp;username.,";			
    	PUT " ";			
    	PUT "No input file in &amp;amp;sharepath./INPUT/&amp;amp;filename..xlsx ";			
    	PUT "Extraction is aborted.";	
    	PUT " ";			
    	PUT "Thanks and regards,";			
    	PUT "xx";			
	RUN;
	
	%end;
	
%mend;
%findfile;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 24 May 2019 15:49:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Check-fileexist-then-run-a-code-or-sent-missing-file-email/m-p/561449#M157171</guid>
      <dc:creator>Gpp</dc:creator>
      <dc:date>2019-05-24T15:49:20Z</dc:date>
    </item>
  </channel>
</rss>

