<?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 Reassigning Libnames in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Reassigning-Libnames/m-p/2967#M941</link>
    <description>I am running macro in EG that reassigns the same libname at each iteration. At the end of the previous run I attempt to clear the libname  (libname _project clear;) but get the following error. &lt;BR /&gt;
&lt;BR /&gt;
ERROR: Unable to clear or re-assign the library _PROJECT because it is still in use.&lt;BR /&gt;
ERROR: Error in the LIBNAME statement.&lt;BR /&gt;
&lt;BR /&gt;
Why?  How do I circumvent this error?&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Thanks</description>
    <pubDate>Tue, 01 May 2007 15:19:13 GMT</pubDate>
    <dc:creator>LAP</dc:creator>
    <dc:date>2007-05-01T15:19:13Z</dc:date>
    <item>
      <title>Reassigning Libnames</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Reassigning-Libnames/m-p/2967#M941</link>
      <description>I am running macro in EG that reassigns the same libname at each iteration. At the end of the previous run I attempt to clear the libname  (libname _project clear;) but get the following error. &lt;BR /&gt;
&lt;BR /&gt;
ERROR: Unable to clear or re-assign the library _PROJECT because it is still in use.&lt;BR /&gt;
ERROR: Error in the LIBNAME statement.&lt;BR /&gt;
&lt;BR /&gt;
Why?  How do I circumvent this error?&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
Thanks</description>
      <pubDate>Tue, 01 May 2007 15:19:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Reassigning-Libnames/m-p/2967#M941</guid>
      <dc:creator>LAP</dc:creator>
      <dc:date>2007-05-01T15:19:13Z</dc:date>
    </item>
    <item>
      <title>Re: Reassigning Libnames</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Reassigning-Libnames/m-p/2968#M942</link>
      <description>Hello.&lt;BR /&gt;
&lt;BR /&gt;
My own experience of the problem (far from extensive) is related to having macro-programs stored in that library, in a catalog ; the library cannot be desassigned until the end of the SAS session.&lt;BR /&gt;
&lt;BR /&gt;
As a circumvention : since you are iterating in your macro program, this sounds like you're using a macro loop. You can test the iteration number and only assign the library once (and desassign it once at the very end of your iterations) :&lt;BR /&gt;
&lt;BR /&gt;
%DO loop_index = 1 %TO 1000 ;&lt;BR /&gt;
   %IF &amp;amp;loop_index = 1 %THEN %DO ;&lt;BR /&gt;
     LIBNAME _project "my library path" ;&lt;BR /&gt;
   %END ;&lt;BR /&gt;
   ...&lt;BR /&gt;
   %IF &amp;amp;loop_index = 1000 %THEN %DO ;&lt;BR /&gt;
     LIBNAME _project CLEAR ;&lt;BR /&gt;
   %END ;&lt;BR /&gt;
%END ;&lt;BR /&gt;
&lt;BR /&gt;
Regards.&lt;BR /&gt;
Olivier</description>
      <pubDate>Wed, 02 May 2007 10:42:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Reassigning-Libnames/m-p/2968#M942</guid>
      <dc:creator>Olivier</dc:creator>
      <dc:date>2007-05-02T10:42:43Z</dc:date>
    </item>
    <item>
      <title>Reassigning Libnames</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Reassigning-Libnames/m-p/2969#M943</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I haven't found an elegant solution, but I'm using this code in Enterprise Guide:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*-- start code --;&lt;/P&gt;&lt;P&gt;data _NULL_;&lt;/P&gt;&lt;P&gt;&amp;nbsp; length WORD $8;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; do j = 1 to 8;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WORD = byte(int(65 + ranuni(0)*26)) || WORD;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; call symput("mylibrary", WORD);&lt;/P&gt;&lt;P&gt; run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;libname &amp;amp;mylibrary 'physical_path_to_library';&lt;/P&gt;&lt;P&gt;*-- end code --;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This assign every time a different random LIBREF to you library.&lt;/P&gt;&lt;P&gt;It works.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Paolo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Aug 2011 11:36:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Reassigning-Libnames/m-p/2969#M943</guid>
      <dc:creator>pcavicch</dc:creator>
      <dc:date>2011-08-02T11:36:45Z</dc:date>
    </item>
  </channel>
</rss>

