<?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 FILEEXIST vs SLEEP in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/FILEEXIST-vs-SLEEP/m-p/8856#M401</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; indeed it will go into a loop UNTIL the file is present in the folder, I'd hoped !!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 21 Feb 2012 16:51:55 GMT</pubDate>
    <dc:creator>Jaheuk</dc:creator>
    <dc:date>2012-02-21T16:51:55Z</dc:date>
    <item>
      <title>FILEEXIST vs SLEEP</title>
      <link>https://communities.sas.com/t5/SAS-Programming/FILEEXIST-vs-SLEEP/m-p/8854#M399</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #008080; font-size: 10pt; font-family: Courier New;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt; &lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; color: #000080; font-family: Courier New;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; color: #000080; font-family: Courier New;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;DATA&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 10pt; font-family: Courier New;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Courier New;"&gt;_NULL_&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;&lt;SPAN style="color: #000000;"&gt;;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;fex=&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #008080; font-size: 10pt; font-family: Courier New;"&gt;&lt;STRONG&gt;0&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;&lt;STRONG&gt;;&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Courier New;"&gt;DO&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Courier New;"&gt;UNTIL&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;(fex=&lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-size: 10pt; font-family: Courier New;"&gt;1&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;&lt;STRONG&gt;) ;&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Courier New;"&gt;if&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Courier New;"&gt;%sysfunc&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;(fileexist(&lt;/SPAN&gt;&lt;SPAN style="color: #800080; font-size: 10pt; font-family: Courier New;"&gt;"C:\temp\fix.txt"&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;)) &lt;/SPAN&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Courier New;"&gt;then&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt; fex=&lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-size: 10pt; font-family: Courier New;"&gt;1&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;&lt;STRONG&gt;;&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Courier New;"&gt;else&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt; x=sleep(&lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-size: 10pt; font-family: Courier New;"&gt;5&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;&lt;STRONG&gt;);&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN style="color: #0000ff; font-size: 10pt; font-family: Courier New;"&gt;END&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; color: #000080; font-family: Courier New;"&gt;&lt;SPAN style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;RUN&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-size: 10pt; font-family: Courier New;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; color: #000080; font-family: Courier New;"&gt;&lt;SPAN style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;hi guys,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;&lt;STRONG&gt;﻿&lt;/STRONG&gt;&lt;/SPAN&gt;when file exist at start, it works!&lt;/P&gt;&lt;P&gt;why does this NOT work when the file does not exist and is created during the sleep loop?&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000080; font-size: 10pt; font-family: Courier New;"&gt;﻿&lt;/SPAN&gt;it looks to me that fileexist is only executed once??&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Herman &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Feb 2012 15:00:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/FILEEXIST-vs-SLEEP/m-p/8854#M399</guid>
      <dc:creator>Jaheuk</dc:creator>
      <dc:date>2012-02-21T15:00:38Z</dc:date>
    </item>
    <item>
      <title>Re: FILEEXIST vs SLEEP</title>
      <link>https://communities.sas.com/t5/SAS-Programming/FILEEXIST-vs-SLEEP/m-p/8855#M400</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;When the file does not exist, your code will enter infinite loop, cause always fex=0. If file exists, yes, fileexist will exexute once, since there is no set statement, data _null_ will only run it once, no implied loop here.&lt;/P&gt;&lt;P&gt; Also, don't understand why you use %sysfunc, it seems to me unnecessary here, unless you need to deal with macro variables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Haikuo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Feb 2012 15:21:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/FILEEXIST-vs-SLEEP/m-p/8855#M400</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2012-02-21T15:21:43Z</dc:date>
    </item>
    <item>
      <title>FILEEXIST vs SLEEP</title>
      <link>https://communities.sas.com/t5/SAS-Programming/FILEEXIST-vs-SLEEP/m-p/8856#M401</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; indeed it will go into a loop UNTIL the file is present in the folder, I'd hoped !!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Feb 2012 16:51:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/FILEEXIST-vs-SLEEP/m-p/8856#M401</guid>
      <dc:creator>Jaheuk</dc:creator>
      <dc:date>2012-02-21T16:51:55Z</dc:date>
    </item>
    <item>
      <title>FILEEXIST vs SLEEP</title>
      <link>https://communities.sas.com/t5/SAS-Programming/FILEEXIST-vs-SLEEP/m-p/8857#M402</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;SAS might have optimized your test out of the loop.&lt;/P&gt;&lt;P&gt;Try putting the filename in a variable so that SAS compiler doesn't view it as a constant.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Feb 2012 16:54:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/FILEEXIST-vs-SLEEP/m-p/8857#M402</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2012-02-21T16:54:05Z</dc:date>
    </item>
    <item>
      <title>FILEEXIST vs SLEEP</title>
      <link>https://communities.sas.com/t5/SAS-Programming/FILEEXIST-vs-SLEEP/m-p/8858#M403</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Herman,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The comments you've received are on the mark.&amp;nbsp; %SYSFUNC is not part of the DATA step.&amp;nbsp; It merely determines what statements appear in the DATA step.&amp;nbsp; So the DATA step sees:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if 0 then fex=1;&lt;/P&gt;&lt;P&gt;else x=sleep(5);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Creating the file will not change these statements, so SAS ought to cut short on the looping.&amp;nbsp; But removing %SYSFUNC might do the trick.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good luck.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Feb 2012 17:56:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/FILEEXIST-vs-SLEEP/m-p/8858#M403</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2012-02-21T17:56:14Z</dc:date>
    </item>
    <item>
      <title>FILEEXIST vs SLEEP</title>
      <link>https://communities.sas.com/t5/SAS-Programming/FILEEXIST-vs-SLEEP/m-p/8859#M404</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As others have said, you need to get the %SYSFUNC out of this code - it is not necessary.&amp;nbsp; You also do not need the variables FEX or X.&amp;nbsp; On my Windows system, this sample code worked just fine:&lt;/P&gt;&lt;PRE lang="SAS"&gt;DATA _NULL_;
&amp;nbsp;&amp;nbsp; DO UNTIL(fileexist("C:\temp\fix.txt"));
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; call sleep(5);
&amp;nbsp;&amp;nbsp; END;
RUN;
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Feb 2012 22:31:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/FILEEXIST-vs-SLEEP/m-p/8859#M404</guid>
      <dc:creator>SASJedi</dc:creator>
      <dc:date>2012-02-21T22:31:36Z</dc:date>
    </item>
    <item>
      <title>FILEEXIST vs SLEEP</title>
      <link>https://communities.sas.com/t5/SAS-Programming/FILEEXIST-vs-SLEEP/m-p/8860#M405</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;On unix you would want to alter this just slightly since the default time setting for the sleep function is different than under windows (millisecond on unix vs. second in windows).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp; do until(fileexist("/temp/fix.txt"));&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; call sleep(5,1);&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Feb 2012 16:33:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/FILEEXIST-vs-SLEEP/m-p/8860#M405</guid>
      <dc:creator>FriedEgg</dc:creator>
      <dc:date>2012-02-22T16:33:48Z</dc:date>
    </item>
  </channel>
</rss>

