<?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: %sysfunc(open) causes table to be locked if error occurs in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/sysfunc-open-causes-table-to-be-locked-if-error-occurs/m-p/57602#M12443</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Have you tried looking at &amp;amp;SYSRC or the SYSMSG function?&amp;nbsp; something like the following untested code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro tryit;&lt;/P&gt;&lt;P&gt;%let dsid = %sysfunc(open(work.a));&lt;/P&gt;&lt;P&gt;%if not &amp;amp;dsid %then %do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; %put %sysfunc(sysmsg());&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; %put &amp;amp;sysrc;&amp;nbsp; &lt;/P&gt;&lt;P&gt;%end;&lt;/P&gt;&lt;P&gt;%if &amp;amp;dsid %then %let rc = %sysfunc(close(&amp;amp;dsid));&lt;/P&gt;&lt;P&gt;%mend tryit;&lt;/P&gt;&lt;P&gt;%tryit&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 06 Apr 2012 19:34:25 GMT</pubDate>
    <dc:creator>ArtC</dc:creator>
    <dc:date>2012-04-06T19:34:25Z</dc:date>
    <item>
      <title>%sysfunc(open) causes table to be locked if error occurs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sysfunc-open-causes-table-to-be-locked-if-error-occurs/m-p/57601#M12442</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have an issue when I open a table using %sysfunc(open(table). I run some code using do loops and if statements, if there is an error before the %sysfunc(close(table) statement, its locks the table and I have to re-start in order to get the table unlocked.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a way to check if the table is locked / unlocked before th open statement, and if it locked, can I unlock it?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Chris&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Apr 2012 18:07:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sysfunc-open-causes-table-to-be-locked-if-error-occurs/m-p/57601#M12442</guid>
      <dc:creator>CPAZ</dc:creator>
      <dc:date>2012-04-06T18:07:25Z</dc:date>
    </item>
    <item>
      <title>Re: %sysfunc(open) causes table to be locked if error occurs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sysfunc-open-causes-table-to-be-locked-if-error-occurs/m-p/57602#M12443</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Have you tried looking at &amp;amp;SYSRC or the SYSMSG function?&amp;nbsp; something like the following untested code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro tryit;&lt;/P&gt;&lt;P&gt;%let dsid = %sysfunc(open(work.a));&lt;/P&gt;&lt;P&gt;%if not &amp;amp;dsid %then %do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; %put %sysfunc(sysmsg());&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; %put &amp;amp;sysrc;&amp;nbsp; &lt;/P&gt;&lt;P&gt;%end;&lt;/P&gt;&lt;P&gt;%if &amp;amp;dsid %then %let rc = %sysfunc(close(&amp;amp;dsid));&lt;/P&gt;&lt;P&gt;%mend tryit;&lt;/P&gt;&lt;P&gt;%tryit&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Apr 2012 19:34:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sysfunc-open-causes-table-to-be-locked-if-error-occurs/m-p/57602#M12443</guid>
      <dc:creator>ArtC</dc:creator>
      <dc:date>2012-04-06T19:34:25Z</dc:date>
    </item>
    <item>
      <title>Re: %sysfunc(open) causes table to be locked if error occurs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sysfunc-open-causes-table-to-be-locked-if-error-occurs/m-p/57603#M12444</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi ArtC,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This did not work and maybe I should give you a little bit more info on this. Here is a snippet of my code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro loop;&lt;/P&gt;&lt;P&gt;%let dsid = %sysfunc(open(work.graph));&lt;/P&gt;&lt;P&gt; %do %while (%sysfunc(fetch(%dsid)) = 0;&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; %end;&lt;/P&gt;&lt;P&gt; %let rc = %sysfunc(close(&amp;amp;dsid));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Proc sql;&lt;/P&gt;&lt;P&gt;create table work.graph as select&lt;/P&gt;&lt;P&gt;......;run;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%loop&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I first outside of the loop create the table graph. I then invoke the loop, it opens the table and performs some processing. If an error occurs inside the loop while the table is open, the next time I run the code I get the following error:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #ff0000; font-size: 12pt; font-family: Courier New;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;ERROR: You cannot open WORK.GRAPH.DATA for output access with member-level control because &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WORK.GRAPH.DATA is in use by you in resource environment IOM ROOT COMP ENV.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have tried the %sysfunc(close) function before generation of the initial Proc sql but not luck.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hopefully this may give you a picture of what I am trying to do.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am running SAS 9.2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks, Chris&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Apr 2012 20:29:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sysfunc-open-causes-table-to-be-locked-if-error-occurs/m-p/57603#M12444</guid>
      <dc:creator>CPAZ</dc:creator>
      <dc:date>2012-04-06T20:29:23Z</dc:date>
    </item>
    <item>
      <title>Re: %sysfunc(open) causes table to be locked if error occurs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sysfunc-open-causes-table-to-be-locked-if-error-occurs/m-p/57604#M12445</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Check LOCK statement and &amp;amp;syslckrc macro variable to see whether some table have been locked.&lt;/P&gt;&lt;P&gt;And use CLEAR to release this lock of table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOCK work.graph CLEAR ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ksharp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Apr 2012 04:05:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sysfunc-open-causes-table-to-be-locked-if-error-occurs/m-p/57604#M12445</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2012-04-09T04:05:34Z</dc:date>
    </item>
    <item>
      <title>Re: %sysfunc(open) causes table to be locked if error occurs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sysfunc-open-causes-table-to-be-locked-if-error-occurs/m-p/57605#M12446</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the idea; I placed this code right before I generate the work.graph table and here is the result log:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: Courier New;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #ff0000; font-size: 12pt; font-family: Courier New;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-size: 12pt; font-family: Courier New;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #ff0000; font-size: 12pt; font-family: Courier New;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;361&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LOCK work.graph CLEAR;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: red;"&gt;ERROR: WORK.GRAPH.DATA is not locked by you.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;362&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; proc sql;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;362&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; !&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* setting up graph table by parameter */&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;363&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; create table graph as select&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;364&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; parameter,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;365&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; product,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;366&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; item,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;367&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;amp;cond_line&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;SYMBOLGEN:&amp;nbsp; Macro variable COND_LINE resolves to W29 as W29,&amp;nbsp; W30 as W30,&amp;nbsp; W31 as W31,&amp;nbsp; W32 as W32,&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; W33 as W33,&amp;nbsp; W34 as W34,&amp;nbsp; W35 as W35,&amp;nbsp; W36 as W36,&amp;nbsp; W37 as W37,&amp;nbsp; W38 as W38,&amp;nbsp; W39 as W39, &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; W40 as W40&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;368&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from work.test9&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: black;"&gt;369&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; order by item, parameter, product;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; background: white; color: red;"&gt;ERROR: You cannot open WORK.GRAPH.DATA for output access with member-level control because WORK.GRAPH.DATA is in use by you in resource environment IOM ROOT COMP ENV.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 12pt; font-family: Courier New;"&gt;Any other thoughts? Thanks for your help, Chris &lt;/SPAN&gt;&lt;SPAN style="color: #ff0000; font-size: 12pt; font-family: Courier New;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-size: 12pt; font-family: Courier New;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #ff0000; font-size: 12pt; font-family: Courier New;"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 Apr 2012 22:01:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sysfunc-open-causes-table-to-be-locked-if-error-occurs/m-p/57605#M12446</guid>
      <dc:creator>CPAZ</dc:creator>
      <dc:date>2012-04-09T22:01:50Z</dc:date>
    </item>
    <item>
      <title>Re: %sysfunc(open) causes table to be locked if error occurs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sysfunc-open-causes-table-to-be-locked-if-error-occurs/m-p/57606#M12447</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi.&lt;/P&gt;&lt;P&gt;Firstly use&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;lock work.graph list;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check whether work.graph is locked .&lt;/P&gt;&lt;P&gt;And if you can change the access level of work.graph from member-level to record-level .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;create table work.graph(cntllev=rec)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And if you are using EG ? if it were, plz close the current EG and start a new EG -&amp;gt; new code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;run the code again,check it out.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/kb/17/175.html" title="http://support.sas.com/kb/17/175.html"&gt;http://support.sas.com/kb/17/175.html&lt;/A&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;Ksharp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 10 Apr 2012 03:29:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sysfunc-open-causes-table-to-be-locked-if-error-occurs/m-p/57606#M12447</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2012-04-10T03:29:28Z</dc:date>
    </item>
    <item>
      <title>Re: %sysfunc(open) causes table to be locked if error occurs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sysfunc-open-causes-table-to-be-locked-if-error-occurs/m-p/57607#M12448</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you are using the SAS EG , then this issue can be rectified by using below option.&lt;/P&gt;&lt;P&gt;This will most likely appear when project contains a task that uses as its input table as output table from a prior task.The most likely situation is when there are two or more tasks linked together.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To overcome this issue , Just make sure the dataset is not open or not in edit mode and then&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Click on Tools -&amp;gt; Options -&amp;gt;Data -&amp;gt; Data General&lt;/P&gt;&lt;P&gt;Unselect the option 'Automatically Open Data When Added in the project"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This issue is generally fixed in SAS EG 4.2 (base 9.2) but&amp;nbsp; if your server is still based on 9.1 then it can consist the error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Aug 2014 10:30:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sysfunc-open-causes-table-to-be-locked-if-error-occurs/m-p/57607#M12448</guid>
      <dc:creator>Anind_Sharma</dc:creator>
      <dc:date>2014-08-18T10:30:56Z</dc:date>
    </item>
    <item>
      <title>Re: %sysfunc(open) causes table to be locked if error occurs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sysfunc-open-causes-table-to-be-locked-if-error-occurs/m-p/57608#M12449</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The %sysfunc(open ..... Will open a SAS dataset and lock that. It happens by this open function.&lt;/P&gt;&lt;P&gt;The basic logic is rather simple and generic common to multi-users systems. See: &lt;A href="http://support.sas.com/documentation/cdl/en/lefunctionsref/63354/HTML/default/viewer.htm#n0q72zlfmfjplon1p3nprf85sdin.htm" title="http://support.sas.com/documentation/cdl/en/lefunctionsref/63354/HTML/default/viewer.htm#n0q72zlfmfjplon1p3nprf85sdin.htm"&gt;SAS(R) 9.3 Functions and CALL Routines: Reference&lt;/A&gt; The default locking mode is record-level.&amp;nbsp; This is the same locking level as with viewing/editing a dataset. (Eguide or Base)&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;The dataset-id you get returned as non-zero value is defined as a unique identifier. Failing to close that one for whatever reason will cause the lock lasting fore all the time. You can expect the locking even to work at OS-level. (not all SAS versions OS-types)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What you could do is: Define that dsid as global and reuse check that as needed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%global dsid_loop_graph ;&lt;/P&gt;&lt;P&gt;%let dsid_loop_graph = %sysfunc(open(work.graph));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then check &amp;amp;dsid_loop_graph for zero/nonzero and after successful close reset it to zero.&lt;/P&gt;&lt;P&gt;Design an other macro for the cleanup processing/close.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Running a macro after a datastep has stopped processing by an error is working.&lt;/P&gt;&lt;P&gt;Datasteps/procs are stopped but macro-s are still being processed.&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Aug 2014 11:08:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sysfunc-open-causes-table-to-be-locked-if-error-occurs/m-p/57608#M12449</guid>
      <dc:creator>jakarman</dc:creator>
      <dc:date>2014-08-18T11:08:57Z</dc:date>
    </item>
    <item>
      <title>Re: %sysfunc(open) causes table to be locked if error occurs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/sysfunc-open-causes-table-to-be-locked-if-error-occurs/m-p/57609#M12450</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Perhaps you need to redesign your program.&amp;nbsp; Why are you using macro language to open the dataset anyway? Can you convert that logic to normal SAS code instead.&amp;nbsp; In practice SAS will normally just assign integers 1,2,3,etc to the file handles.&amp;nbsp;&amp;nbsp; If your SAS sessions is still open then you might just try brute force to close it.&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp; do dsid=1 to 256;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; rc=close(dsid);&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>Mon, 18 Aug 2014 12:17:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/sysfunc-open-causes-table-to-be-locked-if-error-occurs/m-p/57609#M12450</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2014-08-18T12:17:32Z</dc:date>
    </item>
  </channel>
</rss>

