<?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: Delete XLSX file that was exported before in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Delete-XLSX-file-that-was-exported-before/m-p/584848#M166673</link>
    <description>&lt;P&gt;You have an error in your data-step. The function filename (not that well documented by sas an example how to use it in a data-step is missing) needs the name of a file-reference as first argument. The file-reference is just a string.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
   rc = filename('fname', "path\Example1.xlsx");
   put 'filename ' rc=;

   if rc = 0 and fexist('fname') then do;
      rc=fdelete('fname');
      put 'delete ' rc=;
   end;
   rc=filename('fname');
   put rc=;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 29 Aug 2019 05:07:53 GMT</pubDate>
    <dc:creator>andreas_lds</dc:creator>
    <dc:date>2019-08-29T05:07:53Z</dc:date>
    <item>
      <title>Delete XLSX file that was exported before</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-XLSX-file-that-was-exported-before/m-p/584842#M166669</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;
&lt;P&gt;I used&amp;nbsp; proc export to create an XLSX file.&lt;/P&gt;
&lt;P&gt;Then ,I decided that I want to delete the XLSX file .&lt;/P&gt;
&lt;P&gt;I am trying to go to the path of the XLSX file and right click and delete but it says that I don't have authorization to do it.&lt;/P&gt;
&lt;P&gt;Then I am trying to do it from SAS (by using SAS code)&lt;/P&gt;
&lt;P&gt;I don't get any error or warning but I found out that the file was not deleted&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;/*Step1-Export*/
proc export DATA=sashelp.cars
OUTFILE= "/path/Example1.xlsx"
DBMS=xlsx REPLACE ;
SHEET = "cars";
run;

/*Step2-Delete the XLSX file*/
data _null_;
fname="Example1.xlsx";
rc=filename(fname,"/path/");
    if rc = 0 and fexist(fname) then
       rc=fdelete(fname);
    rc=filename(fname);
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Aug 2019 04:41:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-XLSX-file-that-was-exported-before/m-p/584842#M166669</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2019-08-29T04:41:42Z</dc:date>
    </item>
    <item>
      <title>Re: Delete XLSX file that was exported before</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-XLSX-file-that-was-exported-before/m-p/584848#M166673</link>
      <description>&lt;P&gt;You have an error in your data-step. The function filename (not that well documented by sas an example how to use it in a data-step is missing) needs the name of a file-reference as first argument. The file-reference is just a string.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
   rc = filename('fname', "path\Example1.xlsx");
   put 'filename ' rc=;

   if rc = 0 and fexist('fname') then do;
      rc=fdelete('fname');
      put 'delete ' rc=;
   end;
   rc=filename('fname');
   put rc=;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 29 Aug 2019 05:07:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-XLSX-file-that-was-exported-before/m-p/584848#M166673</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2019-08-29T05:07:53Z</dc:date>
    </item>
    <item>
      <title>Re: Delete XLSX file that was exported before</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Delete-XLSX-file-that-was-exported-before/m-p/584853#M166677</link>
      <description>&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Thu, 29 Aug 2019 05:21:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Delete-XLSX-file-that-was-exported-before/m-p/584853#M166677</guid>
      <dc:creator>Ronein</dc:creator>
      <dc:date>2019-08-29T05:21:19Z</dc:date>
    </item>
  </channel>
</rss>

