<?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: 5 days old dates from my Today()  should be deleted in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/5-days-old-dates-from-my-Today-should-be-deleted/m-p/708341#M217681</link>
    <description>&lt;P&gt;You can try&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;five_mo_ago = intnx('day',today(), -5);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Other than that, I'm afraid I don't understand your problem. Do you mean you want to delete records where variable DATE is &lt;FONT color="#FF0000"&gt;greater than 5 days old&lt;/FONT&gt;? Or do you mean something else?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please don't ever say "but It is not working" and provide no other information. We can't help you if you provide no other information. Please do show us the LOG for the code that isn't working (all of it, 100%, the code as it appears in the LOG, the ERRORs, WARNINGs, NOTEs, in the sequence it appears in the log, with nothing chopped out).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 27 Dec 2020 14:31:26 GMT</pubDate>
    <dc:creator>PaigeMiller</dc:creator>
    <dc:date>2020-12-27T14:31:26Z</dc:date>
    <item>
      <title>5 days old dates from my Today()  should be deleted</title>
      <link>https://communities.sas.com/t5/SAS-Programming/5-days-old-dates-from-my-Today-should-be-deleted/m-p/708339#M217680</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data housekeeping_Data;
input Date DATE10. ;
format Date DATE10.;
cards;
26DEC2020
25DEC2020
27DEC2020
28DEC2020
29DEC2020
30DEC2020
17NOV2020
15NOV2020
01NOV2020
11NOV2020
;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Hi everyone ,&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Above is the input data now I want that the observations which are 5 days old from my Today()&amp;nbsp; should be deleted/removed whenever I run the date.&lt;/P&gt;
&lt;P&gt;FYI : I used,&amp;nbsp; five_mo_ago = intnx('date',today(), -5 ,same);&amp;nbsp; but It is not working.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any other approach is welcomed.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;output should be like below when today is 27th Dec'2020:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE width="173" aria-label="Data Set WORK.FINAL"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="64"&gt;Obs&lt;/TD&gt;
&lt;TD width="109"&gt;Date&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="64"&gt;1&lt;/TD&gt;
&lt;TD width="109"&gt;26-Dec-20&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="64"&gt;2&lt;/TD&gt;
&lt;TD width="109"&gt;25-Dec-20&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="64"&gt;3&lt;/TD&gt;
&lt;TD width="109"&gt;27-Dec-20&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="64"&gt;4&lt;/TD&gt;
&lt;TD width="109"&gt;28-Dec-20&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="64"&gt;5&lt;/TD&gt;
&lt;TD width="109"&gt;29-Dec-20&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="64"&gt;6&lt;/TD&gt;
&lt;TD width="109"&gt;30-Dec-20&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;</description>
      <pubDate>Sun, 27 Dec 2020 14:17:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/5-days-old-dates-from-my-Today-should-be-deleted/m-p/708339#M217680</guid>
      <dc:creator>librasonali</dc:creator>
      <dc:date>2020-12-27T14:17:23Z</dc:date>
    </item>
    <item>
      <title>Re: 5 days old dates from my Today()  should be deleted</title>
      <link>https://communities.sas.com/t5/SAS-Programming/5-days-old-dates-from-my-Today-should-be-deleted/m-p/708341#M217681</link>
      <description>&lt;P&gt;You can try&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;five_mo_ago = intnx('day',today(), -5);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Other than that, I'm afraid I don't understand your problem. Do you mean you want to delete records where variable DATE is &lt;FONT color="#FF0000"&gt;greater than 5 days old&lt;/FONT&gt;? Or do you mean something else?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please don't ever say "but It is not working" and provide no other information. We can't help you if you provide no other information. Please do show us the LOG for the code that isn't working (all of it, 100%, the code as it appears in the LOG, the ERRORs, WARNINGs, NOTEs, in the sequence it appears in the log, with nothing chopped out).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 27 Dec 2020 14:31:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/5-days-old-dates-from-my-Today-should-be-deleted/m-p/708341#M217681</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-12-27T14:31:26Z</dc:date>
    </item>
    <item>
      <title>Re: 5 days old dates from my Today()  should be deleted</title>
      <link>https://communities.sas.com/t5/SAS-Programming/5-days-old-dates-from-my-Today-should-be-deleted/m-p/708344#M217682</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;You can try&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;five_mo_ago = intnx('day',today(), -5);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Other than that, I'm afraid I don't understand your problem. Do you mean you want to delete records where variable DATE is &lt;FONT color="#FF0000"&gt;greater than 5 days old&lt;/FONT&gt;? Or do you mean something else?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please don't ever say "but It is not working" and provide no other information. We can't help you if you provide no other information. Please do show us the LOG for the code that isn't working (all of it, 100%, the code as it appears in the LOG, the ERRORs, WARNINGs, NOTEs, in the sequence it appears in the log, with nothing chopped out).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I did not pasted because was not able to code much on this but still I am keeping my code below.&amp;nbsp; :&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data final;
set housekeeping_data;
five_days_ago = intnx('day',today(), -5);
if date &amp;lt; Today() then delete /* HERE  want that the observations which are 5 days old from my Today() 
should be deleted/removed*/;

drop five_days_Ago;
proc print;

run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Yes,&amp;nbsp;Do you mean you want to delete records where variable DATE is gt&lt;FONT color="#FF0000"&gt;&amp;nbsp;than 5 days old from today.&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 27 Dec 2020 15:17:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/5-days-old-dates-from-my-Today-should-be-deleted/m-p/708344#M217682</guid>
      <dc:creator>librasonali</dc:creator>
      <dc:date>2020-12-27T15:17:24Z</dc:date>
    </item>
    <item>
      <title>Re: 5 days old dates from my Today()  should be deleted</title>
      <link>https://communities.sas.com/t5/SAS-Programming/5-days-old-dates-from-my-Today-should-be-deleted/m-p/708345#M217683</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if date &amp;lt; five_days_ago then&amp;nbsp;delete;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sun, 27 Dec 2020 15:26:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/5-days-old-dates-from-my-Today-should-be-deleted/m-p/708345#M217683</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2020-12-27T15:26:06Z</dc:date>
    </item>
    <item>
      <title>Re: 5 days old dates from my Today()  should be deleted</title>
      <link>https://communities.sas.com/t5/SAS-Programming/5-days-old-dates-from-my-Today-should-be-deleted/m-p/708346#M217684</link>
      <description>&lt;P&gt;Why did you calculate a date that is five days before TODAY but then not use it.&lt;/P&gt;
&lt;P&gt;Note that SAS stores dates as number of days.&amp;nbsp; So to get a difference in days just subtract two date values.&lt;/P&gt;
&lt;P&gt;If you have a date, X, and another date, Y then the difference in days is X-Y.&amp;nbsp; &amp;nbsp;If the difference is negative then Y is after X.&amp;nbsp; If the difference is positive then X is after Y.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So if today is 15DEC2020 then 5 day ago would be 10DEC2020, which you can calculate by using (today()-5).&amp;nbsp; If you want to remove values with dates before 10DEC2020 then code something like:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if date &amp;lt; (today()-5) then delete;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you also want to delete the dates that fall on 10DEC2020 then use &amp;lt;= instead of = in the comparison.&lt;/P&gt;
&lt;P&gt;What do you want to do with observations where DATE is missing?&amp;nbsp; SAS will treat missing values as less than any actual number so observations with missing value of DATE will be deleted by the statement above.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 27 Dec 2020 16:05:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/5-days-old-dates-from-my-Today-should-be-deleted/m-p/708346#M217684</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-12-27T16:05:27Z</dc:date>
    </item>
    <item>
      <title>Re: 5 days old dates from my Today()  should be deleted</title>
      <link>https://communities.sas.com/t5/SAS-Programming/5-days-old-dates-from-my-Today-should-be-deleted/m-p/708347#M217685</link>
      <description>yes , i should think that subtracting -5 , date difference also I used initially but&lt;BR /&gt;&lt;BR /&gt; if date &amp;lt; (today()-5) then delete; this worked. Thanks</description>
      <pubDate>Sun, 27 Dec 2020 15:39:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/5-days-old-dates-from-my-Today-should-be-deleted/m-p/708347#M217685</guid>
      <dc:creator>librasonali</dc:creator>
      <dc:date>2020-12-27T15:39:17Z</dc:date>
    </item>
  </channel>
</rss>

