<?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: SAS MACRO WITH SLEEP FUNCTION in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/SAS-MACRO-WITH-SLEEP-FUNCTION/m-p/314388#M68461</link>
    <description>Thank you for the answer. The program is working perfectly!</description>
    <pubDate>Sat, 26 Nov 2016 00:40:33 GMT</pubDate>
    <dc:creator>Bottoni</dc:creator>
    <dc:date>2016-11-26T00:40:33Z</dc:date>
    <item>
      <title>SAS MACRO WITH SLEEP FUNCTION</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-MACRO-WITH-SLEEP-FUNCTION/m-p/314327#M68438</link>
      <description>&lt;P&gt;I need to start to process my program only if a file was uploaded in a directory.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I developed a code to verify if the file exist and it works well when the file are in the directory!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When the file doesn't exist I tryed&amp;nbsp;to make the program wait a period of time then process the code again with the sleep function. However it isn't working. The program doesn't wait the specified time.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry for my bad english. Can anyone help me?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;SAS code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%LET TESTFILE = "/usuario/teste/TB_SAIDA_GPC.TXT";            

%MACRO FINDIT;   
	%DO %UNTIL(%SYSFUNC(FILEEXIST(&amp;amp;TESTFILE)));

			PROC SQL;
			CREATE TABLE WORK.TESTE AS 
			SELECT *
			FROM WORK.TB_SAIDA_GPC;
			QUIT;	

			SLEEP(60);
		
	 %END;
%MEND;                                         
    
%FINDIT;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 25 Nov 2016 16:20:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-MACRO-WITH-SLEEP-FUNCTION/m-p/314327#M68438</guid>
      <dc:creator>Bottoni</dc:creator>
      <dc:date>2016-11-25T16:20:07Z</dc:date>
    </item>
    <item>
      <title>Re: SAS MACRO WITH SLEEP FUNCTION</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-MACRO-WITH-SLEEP-FUNCTION/m-p/314336#M68441</link>
      <description>&lt;P&gt;Put the PROC SQL statement &lt;EM&gt;&lt;STRONG&gt;after&lt;/STRONG&gt;&lt;/EM&gt; the %end.&lt;/P&gt;</description>
      <pubDate>Fri, 25 Nov 2016 16:54:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-MACRO-WITH-SLEEP-FUNCTION/m-p/314336#M68441</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2016-11-25T16:54:46Z</dc:date>
    </item>
    <item>
      <title>Re: SAS MACRO WITH SLEEP FUNCTION</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-MACRO-WITH-SLEEP-FUNCTION/m-p/314337#M68442</link>
      <description>&lt;P&gt;From SAS manual, it reads "&lt;FONT face="Courier New" size="3" color="#ff0000"&gt;The&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; SLEEP function suspends the execution of a program that invokes this function for a period of time that you &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;specify.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; The program can be a DATA step, macro, IML, SCL, or anything that can invoke a &lt;/FONT&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;function.&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; The maximum sleep period for the SLEEP function is &lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT face="Courier New" size="3" color="#008080"&gt;46&lt;/FONT&gt;&lt;/STRONG&gt; &lt;FONT face="Courier New" size="3" color="#008080"&gt;days.&lt;/FONT&gt;"&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So Sleep() can't be used by itself. Try below:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%LET TESTFILE = "/usuario/teste/TB_SAIDA_GPC.TXT";            

%MACRO FINDIT;   
	%DO %UNTIL(%SYSFUNC(FILEEXIST(&amp;amp;TESTFILE)));

		data _null_;
		rc=SLEEP(60);
		run;
		
	 %END;

	PROC SQL;
 	CREATE TABLE WORK.TESTE AS 
	SELECT *
	FROM WORK.TB_SAIDA_GPC;
	QUIT;	

%MEND;                                         
    
%FINDIT;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Mar 2017 16:12:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-MACRO-WITH-SLEEP-FUNCTION/m-p/314337#M68442</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2017-03-28T16:12:47Z</dc:date>
    </item>
    <item>
      <title>Re: SAS MACRO WITH SLEEP FUNCTION</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-MACRO-WITH-SLEEP-FUNCTION/m-p/314385#M68458</link>
      <description>&lt;P&gt;You've got already all you need from others to make your current code work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If available then I personally would go an approach using a scheduler where you trigger your process "on file arrival".&lt;/P&gt;</description>
      <pubDate>Sat, 26 Nov 2016 00:26:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-MACRO-WITH-SLEEP-FUNCTION/m-p/314385#M68458</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2016-11-26T00:26:04Z</dc:date>
    </item>
    <item>
      <title>Re: SAS MACRO WITH SLEEP FUNCTION</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-MACRO-WITH-SLEEP-FUNCTION/m-p/314388#M68461</link>
      <description>Thank you for the answer. The program is working perfectly!</description>
      <pubDate>Sat, 26 Nov 2016 00:40:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-MACRO-WITH-SLEEP-FUNCTION/m-p/314388#M68461</guid>
      <dc:creator>Bottoni</dc:creator>
      <dc:date>2016-11-26T00:40:33Z</dc:date>
    </item>
    <item>
      <title>Re: SAS MACRO WITH SLEEP FUNCTION</title>
      <link>https://communities.sas.com/t5/SAS-Programming/SAS-MACRO-WITH-SLEEP-FUNCTION/m-p/314389#M68462</link>
      <description>I've tryed it. Doesn't work in the company where I work. SAS Administrators say it doesn't work because there the app is virtualized.</description>
      <pubDate>Sat, 26 Nov 2016 00:44:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/SAS-MACRO-WITH-SLEEP-FUNCTION/m-p/314389#M68462</guid>
      <dc:creator>Bottoni</dc:creator>
      <dc:date>2016-11-26T00:44:57Z</dc:date>
    </item>
  </channel>
</rss>

