<?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: Remove records based on today's date in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Remove-records-based-on-today-s-date/m-p/124233#M34153</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;try the modified EJ's code below:&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; create table myfinal as&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; select a.*, b.date_pres&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from myresult as a left join ( select name, max(date_pres) as date_pres, today() - &lt;SPAN style="color: #ff0000;"&gt;input(date_pres,date9.)&lt;/SPAN&gt; as check&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from myhistory where calculated check &amp;gt; 90 ) as b&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; on a.name = b.name&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 28 Feb 2013 21:06:38 GMT</pubDate>
    <dc:creator>Linlin</dc:creator>
    <dc:date>2013-02-28T21:06:38Z</dc:date>
    <item>
      <title>Remove records based on today's date</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Remove-records-based-on-today-s-date/m-p/124229#M34149</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Lets say I have the following two table :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Table : mylib.myresult&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" style="BORDER-BOTTOM: #000000 1px solid; BORDER-LEFT: #000000 1px solid; WIDTH: 100%; BORDER-TOP: #000000 1px solid; BORDER-RIGHT: #000000 1px solid;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;"&gt;&lt;STRONG&gt;Name&lt;/STRONG&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;Bob&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;Alex&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;John&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;Nicolas&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Table : mylib.myhistory &lt;/P&gt;&lt;TABLE border="1" class="jiveBorder" style="width: 100%; border: #000000 1px solid;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;"&gt;&lt;STRONG&gt;Name&lt;/STRONG&gt;&lt;/TH&gt;&lt;TH style="text-align: center; background-color: #6690bc; color: #ffffff; padding: 2px;"&gt;&lt;STRONG&gt;Date_Pres&lt;/STRONG&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;Bob&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;15FEB2012&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;Alex&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;10JAN2013&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;John&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;12DEC2012&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD style="padding: 2px;"&gt;Nicolas&lt;/TD&gt;&lt;TD style="padding: 2px;"&gt;11APR2012&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to create a table named 'myfinal' that only shows the records from table myresult where TODAY() - DATE_PRES &amp;gt; 90 days.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So the table 'myfinal' would display only Alex and John record.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Those are two example tables, I really need to have a link between table myresult and table myhistory because my real history table contains a lot of names that need to be matched.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope you understand my problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your help and time with this.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Feb 2013 19:51:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Remove-records-based-on-today-s-date/m-p/124229#M34149</guid>
      <dc:creator>nicnad</dc:creator>
      <dc:date>2013-02-28T19:51:54Z</dc:date>
    </item>
    <item>
      <title>Re: Remove records based on today's date</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Remove-records-based-on-today-s-date/m-p/124230#M34150</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would also like to add :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the same name has two or more entries in the myhistory table, take only the latest one.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To explain my whole problem more clearly, here are the steps I want the procedure to make :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#1 Does the name in 'myresult' table exist in 'myhistory' table, if it does go to step #2, if not include it in 'myfinal' table. &lt;/P&gt;&lt;P&gt;#2 Does the latest date_pres entry for that name is more than 3 months old, if it does include it in 'myfinal' table if not do nothing.&lt;/P&gt;&lt;P&gt;#3 Loop each name from 'myresult' table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this is clearer.&lt;/P&gt;&lt;P&gt;thank you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Feb 2013 20:00:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Remove-records-based-on-today-s-date/m-p/124230#M34150</guid>
      <dc:creator>nicnad</dc:creator>
      <dc:date>2013-02-28T20:00:18Z</dc:date>
    </item>
    <item>
      <title>Re: Remove records based on today's date</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Remove-records-based-on-today-s-date/m-p/124231#M34151</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Myabe I am missing something because it really sounds like you want just a left join between the two table:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; create table myfinal as&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; select a.*, b.date_pres&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from myresult as a left join ( select name, max(date_pres) as date_pres, today() - date_pres as check&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from myhistory where calculated check &amp;gt; 90 ) as b&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; on a.name = b.name&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The real problem my be if the names are from two different sources where there could be typos / different spellings so matches will not be found.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EJ&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Feb 2013 20:34:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Remove-records-based-on-today-s-date/m-p/124231#M34151</guid>
      <dc:creator>esjackso</dc:creator>
      <dc:date>2013-02-28T20:34:11Z</dc:date>
    </item>
    <item>
      <title>Re: Remove records based on today's date</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Remove-records-based-on-today-s-date/m-p/124232#M34152</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This seems to be just what I wanted!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The only thing is that I get the following error :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ERROR: Expression using subtraction - requires numeric types.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;date_pres value was entered like this : &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;date_pres = put(&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="color: #008080; font-size: 10pt; font-family: Courier New;"&gt;&lt;STRONG style="color: #008080; font-size: 10pt; font-family: Courier New;"&gt;&lt;STRONG style="color: #008080; font-size: 10pt; font-family: Courier New;"&gt;'31DEC2012'd&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; font-family: Courier New;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="color: #008080; font-size: 10pt; font-family: Courier New;"&gt;date9.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: Courier New; font-size: 10pt;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your help and time.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Feb 2013 20:43:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Remove-records-based-on-today-s-date/m-p/124232#M34152</guid>
      <dc:creator>nicnad</dc:creator>
      <dc:date>2013-02-28T20:43:29Z</dc:date>
    </item>
    <item>
      <title>Re: Remove records based on today's date</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Remove-records-based-on-today-s-date/m-p/124233#M34153</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;try the modified EJ's code below:&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; create table myfinal as&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; select a.*, b.date_pres&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from myresult as a left join ( select name, max(date_pres) as date_pres, today() - &lt;SPAN style="color: #ff0000;"&gt;input(date_pres,date9.)&lt;/SPAN&gt; as check&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from myhistory where calculated check &amp;gt; 90 ) as b&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; on a.name = b.name&lt;/P&gt;&lt;P&gt;;&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Feb 2013 21:06:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Remove-records-based-on-today-s-date/m-p/124233#M34153</guid>
      <dc:creator>Linlin</dc:creator>
      <dc:date>2013-02-28T21:06:38Z</dc:date>
    </item>
    <item>
      <title>Re: Remove records based on today's date</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Remove-records-based-on-today-s-date/m-p/124234#M34154</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you both for your help!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is exactly what I wanted.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Feb 2013 21:35:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Remove-records-based-on-today-s-date/m-p/124234#M34154</guid>
      <dc:creator>nicnad</dc:creator>
      <dc:date>2013-02-28T21:35:08Z</dc:date>
    </item>
    <item>
      <title>Re: Remove records based on today's date</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Remove-records-based-on-today-s-date/m-p/124235#M34155</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What is the proper way to create a table that would contains the records that were excluded in myfinal table?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Feb 2013 22:23:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Remove-records-based-on-today-s-date/m-p/124235#M34155</guid>
      <dc:creator>nicnad</dc:creator>
      <dc:date>2013-02-28T22:23:16Z</dc:date>
    </item>
    <item>
      <title>Re: Remove records based on today's date</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Remove-records-based-on-today-s-date/m-p/124236#M34156</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Also the left join still pulls the records where the check is &amp;lt; 90... is using inner join instead the proper way to do this?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 28 Feb 2013 22:27:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Remove-records-based-on-today-s-date/m-p/124236#M34156</guid>
      <dc:creator>nicnad</dc:creator>
      <dc:date>2013-02-28T22:27:46Z</dc:date>
    </item>
    <item>
      <title>Re: Remove records based on today's date</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Remove-records-based-on-today-s-date/m-p/124237#M34157</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Given the fact that you are having issues with the check and want to output the data to multiple places you might want to go to data step merge.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But I think to fix the subquery in the sql step, since the date is a character value, you might have to input the date for the max and then use that to formulate the check :&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;proc sql;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; create table myfinal as&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; select a.*, b.date_pres&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from myresult as a left join ( select name, &lt;STRONG&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;max(&lt;/SPAN&gt;&lt;SPAN style="font-family: inherit; font-style: inherit; color: #ff0000;"&gt;input(date_pres,date9.)) &lt;/SPAN&gt;&lt;/STRONG&gt; as date_pres,&lt;STRONG&gt; today() - calculated date_pres&lt;/STRONG&gt; as check&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; from myhistory where calculated check &amp;gt; 90 ) as b&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; on a.name = b.name&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;quit;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;If you really want to output to two datasets just do a regular left join just from myhistory (if you still want the last instance of a name then leave the max of the date code in the query) then create the check in a data step where you could out put to two datasets based on the value of the check.&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;Hope this helps!&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;EJ &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Mar 2013 02:22:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Remove-records-based-on-today-s-date/m-p/124237#M34157</guid>
      <dc:creator>esjackso</dc:creator>
      <dc:date>2013-03-01T02:22:52Z</dc:date>
    </item>
  </channel>
</rss>

