<?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 file in libname - Macro in New SAS User</title>
    <link>https://communities.sas.com/t5/New-SAS-User/Delete-file-in-libname-Macro/m-p/556042#M9752</link>
    <description>&lt;P&gt;If you want to delete a dataset then why not just use PROC DELETE?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%if %sysfunc(today(),day.) eq 1 %then %do;
  %let file=TRANSF_CLOSURE_&amp;amp;MES.;
  %if %sysfunc(exist(drm.&amp;amp;file)) %then %do;
proc delete data=drm.&amp;amp;file ;
run;
  %end;
%end;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 03 May 2019 18:38:23 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2019-05-03T18:38:23Z</dc:date>
    <item>
      <title>Delete file in libname - Macro</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Delete-file-in-libname-Macro/m-p/555931#M9732</link>
      <description>&lt;P&gt;I need to delete a file in libname if it exists.&lt;/P&gt;&lt;P&gt;It's not right...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%IF %SYSFUNC(TODAY(),DAY.) EQ 1 %THEN %DO;&lt;BR /&gt;%IF %SYSFUNC(FILEEXIST(DRM.TRANSF_PARTIAL_&amp;amp;MES.)) %THEN %DO;&lt;/P&gt;&lt;P&gt;%SYSFUNC(FDELETE(DRM.TRANSF_PARTIAL_&amp;amp;MES.));&lt;BR /&gt;%END;&lt;BR /&gt;%LET FILE=TRANSF_CLOSURE_&amp;amp;MES.;&lt;BR /&gt;%END;&lt;/P&gt;</description>
      <pubDate>Fri, 03 May 2019 13:53:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Delete-file-in-libname-Macro/m-p/555931#M9732</guid>
      <dc:creator>a_ramos</dc:creator>
      <dc:date>2019-05-03T13:53:18Z</dc:date>
    </item>
    <item>
      <title>Re: Delete file in libname - Macro</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Delete-file-in-libname-Macro/m-p/555939#M9734</link>
      <description>&lt;P&gt;Are you attempting to delete a SAS date set or an external non-SAS file? FILEEXIST function checks for the existence of external files, not SAS data sets. You would use EXIST function to determine if a SAS data set or view is present.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;FDELETE is intended to delete external files and the reference would be "is a character constant, variable, or expression that specifies the &lt;SPAN class="xis-userSuppliedValue"&gt;fileref&lt;/SPAN&gt; that you assign to the external file or directory.&amp;nbsp;" not a libname.dataset construct. You would have to generate an operating system path/filename instead of the library.dataset reference for Fdelete to work.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 May 2019 14:31:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Delete-file-in-libname-Macro/m-p/555939#M9734</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-05-03T14:31:19Z</dc:date>
    </item>
    <item>
      <title>Re: Delete file in libname - Macro</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Delete-file-in-libname-Macro/m-p/555940#M9735</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/186412"&gt;@a_ramos&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I need to delete a file in libname if it exists.&lt;/P&gt;
&lt;P&gt;It's not right...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%IF %SYSFUNC(TODAY(),DAY.) EQ 1 %THEN %DO;&lt;BR /&gt;%IF %SYSFUNC(FILEEXIST(DRM.TRANSF_PARTIAL_&amp;amp;MES.)) %THEN %DO;&lt;/P&gt;
&lt;P&gt;%SYSFUNC(FDELETE(DRM.TRANSF_PARTIAL_&amp;amp;MES.));&lt;BR /&gt;%END;&lt;BR /&gt;%LET FILE=TRANSF_CLOSURE_&amp;amp;MES.;&lt;BR /&gt;%END;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;How is it not right? Are you getting an error? Is it not working? I'm assuming this is wrapped in a MACRO?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Your condition will never be true until the first day of the month so you'll need to change that to test it for sure.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 May 2019 14:36:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Delete-file-in-libname-Macro/m-p/555940#M9735</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-05-03T14:36:26Z</dc:date>
    </item>
    <item>
      <title>Re: Delete file in libname - Macro</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Delete-file-in-libname-Macro/m-p/556039#M9751</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Yes, it is external.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Please, how can I put FILEREF in the macro?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Is there a way to delete this file just by pointing to libname?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 03 May 2019 18:30:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Delete-file-in-libname-Macro/m-p/556039#M9751</guid>
      <dc:creator>a_ramos</dc:creator>
      <dc:date>2019-05-03T18:30:12Z</dc:date>
    </item>
    <item>
      <title>Re: Delete file in libname - Macro</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Delete-file-in-libname-Macro/m-p/556042#M9752</link>
      <description>&lt;P&gt;If you want to delete a dataset then why not just use PROC DELETE?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%if %sysfunc(today(),day.) eq 1 %then %do;
  %let file=TRANSF_CLOSURE_&amp;amp;MES.;
  %if %sysfunc(exist(drm.&amp;amp;file)) %then %do;
proc delete data=drm.&amp;amp;file ;
run;
  %end;
%end;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 03 May 2019 18:38:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Delete-file-in-libname-Macro/m-p/556042#M9752</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-05-03T18:38:23Z</dc:date>
    </item>
    <item>
      <title>Re: Delete file in libname - Macro</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Delete-file-in-libname-Macro/m-p/556078#M9758</link>
      <description>&lt;P&gt;It worked perfectly when I simulated day 1, thank you.&lt;BR /&gt;I was confusing the EXIST functions with FILEEXIST and FDELETE with PROC DELETE. Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%IF %SYSFUNC(TODAY(),DAY.) EQ 1 %THEN %DO;&lt;BR /&gt;%IF %SYSFUNC(EXIST(DRM.TRANSF_PARTIAL_&amp;amp;MES.)) %THEN %DO;&lt;BR /&gt;PROC DELETE DATA=DRM.TRANSF_PARTIAL_&amp;amp;MES.;&lt;BR /&gt;%END;&lt;BR /&gt;%LET FILE=TRANSF_CLOSURE_&amp;amp;MES.;&lt;BR /&gt;%END;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%ELSE %DO;&lt;BR /&gt;%LET FILE=TRANSF_PARTIAL_&amp;amp;MES.;&lt;BR /&gt;%END;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 03 May 2019 19:35:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Delete-file-in-libname-Macro/m-p/556078#M9758</guid>
      <dc:creator>a_ramos</dc:creator>
      <dc:date>2019-05-03T19:35:02Z</dc:date>
    </item>
    <item>
      <title>Re: Delete file in libname - Macro</title>
      <link>https://communities.sas.com/t5/New-SAS-User/Delete-file-in-libname-Macro/m-p/556084#M9759</link>
      <description>&lt;P&gt;I was confusing the EXIST functions with FILEEXIST and FDELETE with PROC DELETE.&lt;BR /&gt;Tom helped me.&lt;BR /&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 03 May 2019 19:39:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/New-SAS-User/Delete-file-in-libname-Macro/m-p/556084#M9759</guid>
      <dc:creator>a_ramos</dc:creator>
      <dc:date>2019-05-03T19:39:23Z</dc:date>
    </item>
  </channel>
</rss>

