<?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: Deleting logs for 30 days older in the specific DFS directory path in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Deleting-logs-for-30-days-older-in-the-specific-DFS-directory/m-p/820251#M323736</link>
    <description>&lt;P&gt;"not executing" tells us next to nothing. Please be more specific.&lt;/P&gt;
&lt;P&gt;In particular, always post the log of code that does not work as expected.&lt;/P&gt;
&lt;P&gt;If there are no ERRORs or WARNINGs, describe in detail what did not work as expected.&lt;/P&gt;</description>
    <pubDate>Fri, 24 Jun 2022 14:14:23 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2022-06-24T14:14:23Z</dc:date>
    <item>
      <title>Deleting logs for 30 days older in the specific DFS directory path</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Deleting-logs-for-30-days-older-in-the-specific-DFS-directory/m-p/820231#M323730</link>
      <description>&lt;P&gt;Hi All ,&lt;/P&gt;&lt;P&gt;I would like to delete more than 30 days older log files in DFS path like&amp;nbsp; "\\data\output\listings\" . The log files has an extension .log2&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please provide sample program for the above requirement and also if any one can provide code for to run at command prompt for this requirement. I have researched for this requirement ,Below is the sample command using forfiles. Can anyone confirm, can I use forfies for this requirement. Can you modify below command using below example sample log files.&lt;/P&gt;&lt;P&gt;C:\&amp;gt; forfiles /m testfile.txt /c "cmd /c Del testfile.txt " /d -30&lt;/P&gt;&lt;P&gt;For example below are samples log files exist in the dfs path&amp;nbsp;"\\data\output\listings\" .&lt;/P&gt;&lt;P&gt;TEST_X_900_20220616_ 20831.log2&lt;/P&gt;&lt;P&gt;TEST_Y_800_20220310_ 20831.log2&lt;/P&gt;&lt;P&gt;TEST_Z_700_20220205_ 20831.log2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using below sample code for this requirement but it is not executing . Please help me on this case.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;%macro mr_clean(dirpath=,dayskeep=30,ext=.log);&lt;BR /&gt;data _null_;&lt;BR /&gt;length memname $256;&lt;BR /&gt;deldate = today() - &amp;amp;dayskeep;&lt;BR /&gt;rc = filename('indir',"&amp;amp;dirpath");&lt;BR /&gt;did = dopen('indir');&lt;BR /&gt;if did then&lt;BR /&gt;do i=1 to dnum(did);&lt;BR /&gt;memname = dread(did,i);&lt;BR /&gt;if reverse(trim(memname)) ^=: reverse("&amp;amp;ext") then continue;&lt;BR /&gt;rc = filename('inmem',"&amp;amp;dirpath/"!!memname);&lt;BR /&gt;fid = fopen('inmem');&lt;BR /&gt;if fid then&lt;BR /&gt;do;&lt;BR /&gt;moddate = input(finfo(fid,'Last Modified'),date9.); /* see WARNING below */&lt;BR /&gt;rc = fclose(fid);&lt;BR /&gt;if . &amp;lt; moddate &amp;lt;= deldate then rc = fdelete('inmem');&lt;BR /&gt;end;&lt;BR /&gt;end;&lt;BR /&gt;rc = dclose(did);&lt;BR /&gt;rc = filename('inmem');&lt;BR /&gt;rc = filename('indir');&lt;BR /&gt;run;&lt;BR /&gt;%mend mr_clean;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%mr_clean(dirpath=\\quintiles.net\enterprise\Apps\GDM_SAS_EDC\DEV\BLIND\BASILEA\RZA01124\DATA\OUTPUT\LISTINGS,dayskeep=30,ext=.log2)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please check the above code and can provide working code for this requirement.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you .&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Chandu&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jun 2022 13:01:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Deleting-logs-for-30-days-older-in-the-specific-DFS-directory/m-p/820231#M323730</guid>
      <dc:creator>chandu1</dc:creator>
      <dc:date>2022-06-24T13:01:40Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting logs for 30 days older in the specific DFS directory path</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Deleting-logs-for-30-days-older-in-the-specific-DFS-directory/m-p/820251#M323736</link>
      <description>&lt;P&gt;"not executing" tells us next to nothing. Please be more specific.&lt;/P&gt;
&lt;P&gt;In particular, always post the log of code that does not work as expected.&lt;/P&gt;
&lt;P&gt;If there are no ERRORs or WARNINGs, describe in detail what did not work as expected.&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jun 2022 14:14:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Deleting-logs-for-30-days-older-in-the-specific-DFS-directory/m-p/820251#M323736</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-06-24T14:14:23Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting logs for 30 days older in the specific DFS directory path</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Deleting-logs-for-30-days-older-in-the-specific-DFS-directory/m-p/820275#M323745</link>
      <description>&lt;P&gt;Hi Kurt Bremser,&lt;/P&gt;&lt;P&gt;Thanks for your reply.&lt;/P&gt;&lt;P&gt;Have a look into below code and log. Seems to be the code is not completely executing in SAS EG . Please suggest on this&amp;nbsp; or you can provide new sas code for to delete more than 30 days log files in DFS shared path.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Code:&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;options symbolgen mprint mlogic;&lt;BR /&gt;%macro mr_clean(dirpath=,dayskeep=30,ext=.log);&lt;BR /&gt;data _null_;&lt;BR /&gt;length memname $256;&lt;BR /&gt;deldate = today() - &amp;amp;dayskeep;&lt;BR /&gt;rc = filename('indir',"&amp;amp;dirpath");&lt;BR /&gt;did = dopen('indir');&lt;BR /&gt;if did then&lt;BR /&gt;do i=1 to dnum(did);&lt;BR /&gt;memname = dread(did,i);&lt;BR /&gt;if reverse(trim(memname)) ^=: reverse("&amp;amp;ext") then continue;&lt;BR /&gt;rc = filename('inmem',"&amp;amp;dirpath/"!!memname);&lt;BR /&gt;fid = fopen('inmem');&lt;BR /&gt;if fid then&lt;BR /&gt;do;&lt;BR /&gt;moddate = input(finfo(fid,'Last Modified'),date9.); /* see WARNING below */&lt;BR /&gt;rc = fclose(fid);&lt;BR /&gt;if . &amp;lt; moddate &amp;lt;= deldate then rc = fdelete('inmem');&lt;BR /&gt;end;&lt;BR /&gt;end;&lt;BR /&gt;rc = dclose(did);&lt;BR /&gt;rc = filename('inmem');&lt;BR /&gt;rc = filename('indir');&lt;BR /&gt;run;&lt;BR /&gt;%mend mr_clean;&lt;/P&gt;&lt;P&gt;%mr_clean(dirpath=\\auintiles.net\enterprise\Apps\GDM_SAS_EDC\DEV\BLIND\VASILEA\RZA01124\DATA\OUTPUT\LISTINGS,dayskeep=30,ext=.log2)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Log :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1 The SAS System 07:23 Friday, June 24, 2022&lt;/P&gt;&lt;P&gt;1 %_eg_hidenotesandsource;&lt;BR /&gt;2 ;*';*";*/;quit;run;&lt;BR /&gt;3 OPTIONS PAGENO=MIN;&lt;BR /&gt;4 %_eg_restorenotesandsource;&lt;BR /&gt;5 %_eg_hidenotesandsource;&lt;BR /&gt;6&lt;BR /&gt;7 %LET _CLIENTTASKLABEL='Dellog1.sas';&lt;BR /&gt;8 %LET _CLIENTPROCESSFLOWNAME='Standalone Not In Project';&lt;BR /&gt;9 %LET _CLIENTPROJECTPATH='';&lt;BR /&gt;10 %LET _CLIENTPROJECTPATHHOST='';&lt;BR /&gt;11 %LET _CLIENTPROJECTNAME='';&lt;BR /&gt;12 %LET _SASPROGRAMFILE='\\auintiles.net\enterprise\Apps\sasdata\StatOpB\TestingProcHadoop\Purna\Dellog1.sas';&lt;BR /&gt;13 %LET _SASPROGRAMFILEHOST='CA2XAPPSAS01D';&lt;BR /&gt;14&lt;BR /&gt;15 ODS _ALL_ CLOSE;&lt;BR /&gt;16 OPTIONS DEV=SVG;&lt;BR /&gt;NOTE: The quoted string currently being processed has become more than 262 characters long. You might have unbalanced quotation&lt;BR /&gt;marks.&lt;BR /&gt;17 GOPTIONS XPIXELS=0 YPIXELS=0;&lt;BR /&gt;18 %macro HTML5AccessibleGraphSupported;&lt;BR /&gt;19 %if %_SAS_VERCOMP_FV(9,4,4, 0,0,0) &amp;gt;= 0 %then ACCESSIBLE_GRAPH;&lt;BR /&gt;20 %mend;&lt;BR /&gt;21 FILENAME EGHTML TEMP;&lt;BR /&gt;22 ODS HTML5(ID=EGHTML) FILE=EGHTML&lt;BR /&gt;23 OPTIONS(BITMAP_MODE='INLINE')&lt;BR /&gt;24 %HTML5AccessibleGraphSupported&lt;BR /&gt;25 ENCODING='utf-8'&lt;BR /&gt;26 STYLE=HTMLBlue&lt;BR /&gt;27 NOGTITLE&lt;BR /&gt;28 NOGFOOTNOTE&lt;BR /&gt;29 GPATH=&amp;amp;sasworklocation&lt;BR /&gt;30 ;&lt;BR /&gt;31&lt;BR /&gt;32 %_eg_restorenotesandsource;&lt;BR /&gt;33&lt;BR /&gt;34 %mr_clean(dirpath=\\auintiles.net\enterprise\Apps\GDM_SAS_EDC\DEV\BLIND\VASILEA\RZA01124\DATA\OUTPUT\LISTINGS,dayskeep=30&lt;BR /&gt;34 ! ,ext=.log2)&lt;BR /&gt;35&lt;BR /&gt;36 %_eg_hidenotesandsource;&lt;BR /&gt;37&lt;BR /&gt;38 %LET _CLIENTTASKLABEL=;&lt;BR /&gt;39 %LET _CLIENTPROCESSFLOWNAME=;&lt;BR /&gt;40 %LET _CLIENTPROJECTPATH=;&lt;BR /&gt;41 %LET _CLIENTPROJECTPATHHOST=;&lt;BR /&gt;42 %LET _CLIENTPROJECTNAME=;&lt;BR /&gt;43 %LET _SASPROGRAMFILE=;&lt;BR /&gt;44 %LET _SASPROGRAMFILEHOST=;&lt;BR /&gt;45&lt;BR /&gt;46 ;*';*";*/;quit;run;&lt;BR /&gt;47 ODS _ALL_ CLOSE;&lt;BR /&gt;48&lt;BR /&gt;49 %_eg_restorenotesandsource;&lt;BR /&gt;50&lt;BR /&gt;51&lt;BR /&gt;52 %_eg_hidenotesandsource;&lt;BR /&gt;53 QUIT; RUN;&lt;BR /&gt;54 %_eg_restorenotesandsource;&lt;BR /&gt;55&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jun 2022 16:38:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Deleting-logs-for-30-days-older-in-the-specific-DFS-directory/m-p/820275#M323745</guid>
      <dc:creator>chandu1</dc:creator>
      <dc:date>2022-06-24T16:38:15Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting logs for 30 days older in the specific DFS directory path</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Deleting-logs-for-30-days-older-in-the-specific-DFS-directory/m-p/820281#M323750</link>
      <description>&lt;P&gt;This is key:&lt;/P&gt;
&lt;PRE&gt;NOTE: The quoted string currently being processed has become more than 262 characters long. You might have unbalanced quotation
marks.&lt;/PRE&gt;
&lt;P&gt;Something (unbalanced quotes, incomplete macro definition, ...) corrupted your SAS session. Start a fresh session and redo your test; start by running the data _null_ without the macro definition (set the macro variables with %LET).&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jun 2022 16:51:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Deleting-logs-for-30-days-older-in-the-specific-DFS-directory/m-p/820281#M323750</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-06-24T16:51:46Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting logs for 30 days older in the specific DFS directory path</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Deleting-logs-for-30-days-older-in-the-specific-DFS-directory/m-p/820293#M323758</link>
      <description>&lt;P&gt;Hi Kurt Bremser,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have run the code as you suggested but the code was seems to be continuously executing .I was waited more than 10 min and canceled the job. Below is the log. is there any issues in the code ? Please suggest on this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Log :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1 The SAS System 13:18 Friday, June 24, 2022&lt;/P&gt;&lt;P&gt;1 %_eg_hidenotesandsource;&lt;BR /&gt;5 %_eg_hidenotesandsource;&lt;BR /&gt;33&lt;BR /&gt;34 %let dirpath=\\auintiles.net\enterprise\Apps\GDM_SAS_EDC\DEV\BLIND\VASILEA\RZA01124\DATA\OUTPUT\LISTINGS;&lt;BR /&gt;35 %let dayskeep=30;&lt;BR /&gt;36 %let ext=.log2;&lt;BR /&gt;37 data _null_;&lt;BR /&gt;38 length memname $256;&lt;BR /&gt;39 deldate = today() - &amp;amp;dayskeep;&lt;BR /&gt;40 rc = filename('indir',"&amp;amp;dirpath");&lt;BR /&gt;41 did = dopen('indir');&lt;BR /&gt;42 if did then&lt;BR /&gt;43 do i=1 to dnum(did);&lt;BR /&gt;44 memname = dread(did,i);&lt;BR /&gt;45 if reverse(trim(memname)) ^=: reverse("&amp;amp;ext") then continue;&lt;BR /&gt;46 rc = filename('inmem',"&amp;amp;dirpath/"!!memname);&lt;BR /&gt;47 fid = fopen('inmem');&lt;BR /&gt;48 if fid then&lt;BR /&gt;49 do;&lt;BR /&gt;50 moddate = input(finfo(fid,'Last Modified'),date9.); /* see WARNING below */&lt;BR /&gt;51 rc = fclose(fid);&lt;BR /&gt;52 if . &amp;lt; moddate &amp;lt;= deldate then rc = fdelete('inmem');&lt;BR /&gt;53 end;&lt;BR /&gt;54 end;&lt;BR /&gt;55 rc = dclose(did);&lt;BR /&gt;56 rc = filename('inmem');&lt;BR /&gt;57 rc = filename('indir');&lt;BR /&gt;58 run;&lt;/P&gt;&lt;P&gt;NOTE: The DATA step has been abnormally terminated.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt;real time 12:11.62&lt;BR /&gt;cpu time 1.18 seconds&lt;/P&gt;&lt;P&gt;59&lt;BR /&gt;60 %_eg_hidenotesandsource;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jun 2022 17:42:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Deleting-logs-for-30-days-older-in-the-specific-DFS-directory/m-p/820293#M323758</guid>
      <dc:creator>chandu1</dc:creator>
      <dc:date>2022-06-24T17:42:18Z</dc:date>
    </item>
    <item>
      <title>Re: Deleting logs for 30 days older in the specific DFS directory path</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Deleting-logs-for-30-days-older-in-the-specific-DFS-directory/m-p/820295#M323760</link>
      <description>&lt;P&gt;Add some diagnostic messages to your code so you can see its progress in the log.&lt;/P&gt;
&lt;P&gt;A real time of 12 minutes while only 1 CPU second is used points to very long wait times for the "disk" operation(s) occurring over a network mount.&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jun 2022 18:07:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Deleting-logs-for-30-days-older-in-the-specific-DFS-directory/m-p/820295#M323760</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-06-24T18:07:09Z</dc:date>
    </item>
  </channel>
</rss>

