<?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: Move XML Files to an Archive Folder After Read In in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Move-XML-Files-to-an-Archive-Folder-After-Read-In/m-p/522337#M141787</link>
    <description>&lt;P&gt;You could clear librefs and filerefs before moving the files.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname  FX clear;
filename FF clear;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 18 Dec 2018 20:46:08 GMT</pubDate>
    <dc:creator>ChrisNZ</dc:creator>
    <dc:date>2018-12-18T20:46:08Z</dc:date>
    <item>
      <title>Move XML Files to an Archive Folder After Read In</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Move-XML-Files-to-an-Archive-Folder-After-Read-In/m-p/522324#M141780</link>
      <description>&lt;P&gt;I am reading in all of the XML files within a folder using the XMLV2 engine, and updating a dataset with the data contents of the files. After the update I run a macro which moves the XML files from the folder they are read in from to an archive folder. See code below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Filename ReadIn Temp;&lt;BR /&gt;Libname ReadIn XMLV2 "&amp;amp;Exports.\&amp;amp;FileName." automap=replace xmlmap=ReadIn;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Proc Copy&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;In=ReadIn&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;Out=Work;&lt;BR /&gt;Run ;&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;/* Update Dataset */&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;%Macro Archive;&lt;BR /&gt;Options NoXWait;&lt;BR /&gt;Data _Null_;&lt;BR /&gt;Set File_List Nobs=Nobs;&lt;BR /&gt;Call Symput('Nobs',compress(Nobs));&lt;BR /&gt;Run ;&lt;BR /&gt;&lt;BR /&gt;%Do i=1 %To &amp;amp;Nobs.;&lt;BR /&gt;Data _Null_ ;&lt;BR /&gt;Set File_List;&lt;BR /&gt;If _N_=&amp;amp;i. ;&lt;BR /&gt;Call Symput('Name',compress(Name));&lt;BR /&gt;Run ;&lt;/P&gt;&lt;P&gt;%Put Moving File &amp;amp;i. of &amp;amp;Nobs. - "&amp;amp;Name." to "&amp;amp;Exports.\Archive\&amp;amp;Name.";&lt;BR /&gt;&lt;BR /&gt;X Move "&amp;amp;Exports.\&amp;amp;Name." "&amp;amp;Exports.\Archive\&amp;amp;Name." ;&lt;/P&gt;&lt;P&gt;%End ;&lt;BR /&gt;%Mend ;&lt;BR /&gt;%Archive ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This process works without errors, but when archiving the files a few of them are not moved. If I close and reopen SAS and run the same code it works fine, so I am thinking the files are not being released after they are imported. Any ideas on how to release the files so they are free to be moved?&lt;/P&gt;</description>
      <pubDate>Tue, 18 Dec 2018 19:51:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Move-XML-Files-to-an-Archive-Folder-After-Read-In/m-p/522324#M141780</guid>
      <dc:creator>Macro_Man</dc:creator>
      <dc:date>2018-12-18T19:51:31Z</dc:date>
    </item>
    <item>
      <title>Re: Move XML Files to an Archive Folder After Read In</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Move-XML-Files-to-an-Archive-Folder-After-Read-In/m-p/522337#M141787</link>
      <description>&lt;P&gt;You could clear librefs and filerefs before moving the files.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname  FX clear;
filename FF clear;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 18 Dec 2018 20:46:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Move-XML-Files-to-an-Archive-Folder-After-Read-In/m-p/522337#M141787</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2018-12-18T20:46:08Z</dc:date>
    </item>
    <item>
      <title>Re: Move XML Files to an Archive Folder After Read In</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Move-XML-Files-to-an-Archive-Folder-After-Read-In/m-p/523770#M142348</link>
      <description>&lt;P&gt;Thanks for your reply. I had already tried the Libname &amp;lt;libref&amp;gt; Clear;&amp;nbsp; but did not think to try clearing the filename. When I added that statement the x command archived one of the files but not the other. I also tried Filename _ALL_ Clear; but that did not work either.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It seems like SAS is not disassociating with the most recently imported file. When I try to manually move the file in the Windows File Explorer I get the following File In Use message: "The action can't be completed because the file is open in SAS 9.4 for Windows" / "Close the file and try again."&lt;/P&gt;</description>
      <pubDate>Fri, 28 Dec 2018 16:08:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Move-XML-Files-to-an-Archive-Folder-After-Read-In/m-p/523770#M142348</guid>
      <dc:creator>Macro_Man</dc:creator>
      <dc:date>2018-12-28T16:08:04Z</dc:date>
    </item>
    <item>
      <title>Re: Move XML Files to an Archive Folder After Read In</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Move-XML-Files-to-an-Archive-Folder-After-Read-In/m-p/523809#M142364</link>
      <description>&lt;P&gt;Mmm that's odd.&lt;/P&gt;
&lt;P&gt;You don't use the &lt;FONT face="courier new,courier"&gt;open&lt;/FONT&gt; function anywhere? Your steps are all closed with the proper &lt;FONT face="courier new,courier"&gt;run&lt;/FONT&gt;; or &lt;FONT face="courier new,courier"&gt;quit&lt;/FONT&gt;; statements?&lt;/P&gt;
&lt;P&gt;You could also try to &lt;FONT face="courier new,courier"&gt;sleep&lt;/FONT&gt; just to ensure files are given enough time to be released, but if you come back later and can still see the problem in Windows, that's unlikely to help.&lt;/P&gt;</description>
      <pubDate>Sat, 29 Dec 2018 00:53:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Move-XML-Files-to-an-Archive-Folder-After-Read-In/m-p/523809#M142364</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2018-12-29T00:53:30Z</dc:date>
    </item>
  </channel>
</rss>

