<?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: ERROR HANDLING WITH FILE EXISTANCE in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/ERROR-HANDLING-WITH-FILE-EXISTANCE/m-p/845630#M334325</link>
    <description>&lt;P&gt;This&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename ip_file '&amp;amp;ip_folder.\&amp;amp;file.';&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;will fail because macro triggers do not resolve within single quotes.&lt;/P&gt;
&lt;P&gt;You can use the&amp;nbsp;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/lefunctionsref/n06xm8hwk0t0axn10gj16lfiri43.htm" target="_blank" rel="noopener"&gt;FILEEXIST Function&lt;/A&gt;&amp;nbsp;with the physical filename, so you can omit the FILENAME anyway. And you can test for existence, run the include, and put the message otherwise:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%if %sysfunc(fileexist(&amp;amp;ip_folder.\&amp;amp;file.)) %then %do;
  %include "someother program/abcd.sas";
%end;
%else %do;
  %put ERROR: Physical file does not exist ==&amp;gt; &amp;amp;ip_folder.\&amp;amp;file. ;
%end;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 22 Nov 2022 08:41:21 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2022-11-22T08:41:21Z</dc:date>
    <item>
      <title>ERROR HANDLING WITH FILE EXISTANCE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-HANDLING-WITH-FILE-EXISTANCE/m-p/845615#M334317</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Can anyone suggest how to exit from program in case file does not exit. I have some other include statement, based on file existance, I need to proceed to next program call.&amp;nbsp;&lt;/P&gt;&lt;P&gt;filename ip_file '&amp;amp;ip_folder.\&amp;amp;file.';&lt;BR /&gt;%if (%sysfunc(fexist(ip_file)) eq 0) %then %do;&lt;BR /&gt;%put ERROR: Physical file does not exist ==&amp;gt; &amp;amp;ip_folder.\&amp;amp;file. ;&lt;BR /&gt;%end;&lt;/P&gt;&lt;P&gt;%include "someother program/abcd.sas";&lt;/P&gt;</description>
      <pubDate>Tue, 22 Nov 2022 07:19:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-HANDLING-WITH-FILE-EXISTANCE/m-p/845615#M334317</guid>
      <dc:creator>kumarsandip975</dc:creator>
      <dc:date>2022-11-22T07:19:04Z</dc:date>
    </item>
    <item>
      <title>Re: ERROR HANDLING WITH FILE EXISTANCE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/ERROR-HANDLING-WITH-FILE-EXISTANCE/m-p/845630#M334325</link>
      <description>&lt;P&gt;This&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename ip_file '&amp;amp;ip_folder.\&amp;amp;file.';&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;will fail because macro triggers do not resolve within single quotes.&lt;/P&gt;
&lt;P&gt;You can use the&amp;nbsp;&lt;A href="https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/lefunctionsref/n06xm8hwk0t0axn10gj16lfiri43.htm" target="_blank" rel="noopener"&gt;FILEEXIST Function&lt;/A&gt;&amp;nbsp;with the physical filename, so you can omit the FILENAME anyway. And you can test for existence, run the include, and put the message otherwise:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%if %sysfunc(fileexist(&amp;amp;ip_folder.\&amp;amp;file.)) %then %do;
  %include "someother program/abcd.sas";
%end;
%else %do;
  %put ERROR: Physical file does not exist ==&amp;gt; &amp;amp;ip_folder.\&amp;amp;file. ;
%end;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Nov 2022 08:41:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/ERROR-HANDLING-WITH-FILE-EXISTANCE/m-p/845630#M334325</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-11-22T08:41:21Z</dc:date>
    </item>
  </channel>
</rss>

