<?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: How to suspend a sas program for a period of time in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-suspend-a-sas-program-for-a-period-of-time/m-p/520969#M141315</link>
    <description>&lt;P&gt;Check this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/kb/51/275.html" target="_blank"&gt;http://support.sas.com/kb/51/275.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 12 Dec 2018 19:45:58 GMT</pubDate>
    <dc:creator>r_behata</dc:creator>
    <dc:date>2018-12-12T19:45:58Z</dc:date>
    <item>
      <title>How to suspend a sas program for a period of time</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-suspend-a-sas-program-for-a-period-of-time/m-p/520966#M141313</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to make a program that if a table is locked by another process then the program should wait for 30 second for example, and then run again.&amp;nbsp;I used the sleep function but with no success.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let checklock = &amp;amp;syslckrc;
options symbolgen;

proc sql;
create table resultado (Tablas varchar(55) ,x num, fecha date);

/*MACRO*/
%macro trylock();

	proc sql noprint;
	select "LIBBEM.DIM_CURRENCY" into :table from libbem.dual; 

			data _null_;
			 dsid=0;
                   %do %until (dsid &amp;gt; 0 or &amp;amp;checklock &amp;lt;= 0); 
					dsid = open("&amp;amp;table");

					if (dsid = 0) then do;
					rc = sleep(30,1);
				end;
				%end;
					if (dsid &amp;gt; 0) then do;
					rc = close (dsid);
				end;
				run;
				
			%put trying lock ...;
			lock &amp;amp;table;
			%put syslckrc=&amp;amp;syslckrc;
			
			lock &amp;amp;table clear;
			%put syslckrc=&amp;amp;syslckrc;


process:
proc sql noprint;
insert into resultado
select "&amp;amp;table", &amp;amp;syslckrc as lock_code, today() 
from libbem.dual;
			quit;

%mend trylock;


/*Calling Macro*/
%trylock (1);

/*Resultado*/
proc sql;
create table Open_Table_CBNKPRD as 
select
sum(x) as x
from resultado;
quit;
 

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Any help?&lt;/P&gt;</description>
      <pubDate>Wed, 12 Dec 2018 19:42:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-suspend-a-sas-program-for-a-period-of-time/m-p/520966#M141313</guid>
      <dc:creator>rodrichiez</dc:creator>
      <dc:date>2018-12-12T19:42:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to suspend a sas program for a period of time</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-suspend-a-sas-program-for-a-period-of-time/m-p/520969#M141315</link>
      <description>&lt;P&gt;Check this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/kb/51/275.html" target="_blank"&gt;http://support.sas.com/kb/51/275.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Dec 2018 19:45:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-suspend-a-sas-program-for-a-period-of-time/m-p/520969#M141315</guid>
      <dc:creator>r_behata</dc:creator>
      <dc:date>2018-12-12T19:45:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to suspend a sas program for a period of time</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-suspend-a-sas-program-for-a-period-of-time/m-p/520970#M141316</link>
      <description>&lt;P&gt;You are mixing data step and macro code in a way that won't work.&lt;/P&gt;
&lt;P&gt;Use only data step code instead:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
dsid=0;
do until (dsid &amp;gt; 0 or &amp;amp;checklock &amp;lt;= 0); 
  dsid = open("&amp;amp;table");
  if (dsid = 0) then do;
    rc = sleep(30,1);
  end;
end;
if (dsid &amp;gt; 0) then do;
  rc = close (dsid);
end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 12 Dec 2018 19:52:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-suspend-a-sas-program-for-a-period-of-time/m-p/520970#M141316</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-12-12T19:52:10Z</dc:date>
    </item>
  </channel>
</rss>

