<?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 about  filename and ods ： ERROR: At least one file associated with fileref FBOUT is still in use. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/about-filename-and-ods-ERROR-At-least-one-file-associated-with/m-p/880568#M347919</link>
    <description>&lt;P&gt;dear all:&lt;/P&gt;
&lt;P&gt;The code is:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data  test;
input x $1.;
datalines;
a
b
c
;
run;

%macro test();
ods listing close ;
ods results off;
filename fbout "D:\test.xlsx";

%let i=0;
%do %while(%eval(&amp;amp;i.)&amp;lt;10); 
ods excel (id=fb) file=fbout  options(sheet_interval="none" sheet_name="test");

proc print data=test;run;
%let i=%eval(&amp;amp;i.+1);
%end;

ods excel (id=fb) close;

filename fbout clear;
ods listing  ;
ods results on;

%mend;

%test();&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;when the code is running ,I break it for some reason.But when I rerun the code ,logs shows as below:&lt;/P&gt;
&lt;P&gt;"&lt;/P&gt;
&lt;P&gt;ERROR: At least one file associated with fileref FBOUT is still in use.&lt;BR /&gt;ERROR: Error in the FILENAME statement.&lt;BR /&gt;"&lt;/P&gt;
&lt;P&gt;************some other logs*******&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;"ERROR: File is in use, D:\test.xlsx.&lt;BR /&gt;"&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;The only way I know&amp;nbsp; to fix the error is&amp;nbsp; &lt;STRONG&gt;close&amp;nbsp; SAS,delete the xlsx-file in windows OS ,restart SAS.&lt;/STRONG&gt;&amp;nbsp;Is there any other method to fix it?&lt;/P&gt;
&lt;P&gt;Any suggestion is welcom!&lt;/P&gt;
&lt;P&gt;Thanks in advance!&lt;/P&gt;</description>
    <pubDate>Wed, 14 Jun 2023 02:12:23 GMT</pubDate>
    <dc:creator>duanzongran</dc:creator>
    <dc:date>2023-06-14T02:12:23Z</dc:date>
    <item>
      <title>about  filename and ods ： ERROR: At least one file associated with fileref FBOUT is still in use.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/about-filename-and-ods-ERROR-At-least-one-file-associated-with/m-p/880568#M347919</link>
      <description>&lt;P&gt;dear all:&lt;/P&gt;
&lt;P&gt;The code is:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data  test;
input x $1.;
datalines;
a
b
c
;
run;

%macro test();
ods listing close ;
ods results off;
filename fbout "D:\test.xlsx";

%let i=0;
%do %while(%eval(&amp;amp;i.)&amp;lt;10); 
ods excel (id=fb) file=fbout  options(sheet_interval="none" sheet_name="test");

proc print data=test;run;
%let i=%eval(&amp;amp;i.+1);
%end;

ods excel (id=fb) close;

filename fbout clear;
ods listing  ;
ods results on;

%mend;

%test();&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;when the code is running ,I break it for some reason.But when I rerun the code ,logs shows as below:&lt;/P&gt;
&lt;P&gt;"&lt;/P&gt;
&lt;P&gt;ERROR: At least one file associated with fileref FBOUT is still in use.&lt;BR /&gt;ERROR: Error in the FILENAME statement.&lt;BR /&gt;"&lt;/P&gt;
&lt;P&gt;************some other logs*******&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;"ERROR: File is in use, D:\test.xlsx.&lt;BR /&gt;"&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;The only way I know&amp;nbsp; to fix the error is&amp;nbsp; &lt;STRONG&gt;close&amp;nbsp; SAS,delete the xlsx-file in windows OS ,restart SAS.&lt;/STRONG&gt;&amp;nbsp;Is there any other method to fix it?&lt;/P&gt;
&lt;P&gt;Any suggestion is welcom!&lt;/P&gt;
&lt;P&gt;Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jun 2023 02:12:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/about-filename-and-ods-ERROR-At-least-one-file-associated-with/m-p/880568#M347919</guid>
      <dc:creator>duanzongran</dc:creator>
      <dc:date>2023-06-14T02:12:23Z</dc:date>
    </item>
    <item>
      <title>Re: about  filename and ods ： ERROR: At least one file associated with fileref FBOUT is still in use</title>
      <link>https://communities.sas.com/t5/SAS-Programming/about-filename-and-ods-ERROR-At-least-one-file-associated-with/m-p/880569#M347920</link>
      <description>&lt;P&gt;Why are you opening and closing the file so many times?&lt;/P&gt;
&lt;P&gt;Do you even need to use the FILENAME statement?&amp;nbsp; You can just specify the actual file in the ODS statement.&lt;/P&gt;
&lt;P&gt;Why are you working so hard to re-invent a basic DO loop?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ods excel (id=fb) file= "D:\test.xlsx" options(sheet_interval="none" sheet_name="test"); 
%do i=0 %to 9 ;
proc print data=test;
run;
%end;
ods excel (id=fb) close;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jun 2023 02:29:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/about-filename-and-ods-ERROR-At-least-one-file-associated-with/m-p/880569#M347920</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2023-06-14T02:29:36Z</dc:date>
    </item>
  </channel>
</rss>

