<?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: How to mix and match dates in SAS?? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-mix-and-match-dates-in-SAS/m-p/79409#M256526</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a variable delivery_date with one observation and test_date with 20 observations. I'd like to find the closest date in test_date to delivery_date by find the minimum absolute difference and retain the minimum value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I merge the datasets I only get two observations paired up and get missing values for the rest. Would anyone please explain how to go about this with maybe a do loop or...???&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" height="96" style="width: 82px;"&gt;&lt;TBODY&gt;&lt;TR style="height: 15.0pt;"&gt;&lt;TD height="20" style="border: 0px solid black; width: 88pt; height: 15.0pt;" width="117"&gt;delivery_date&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 15.0pt;"&gt;&lt;TD align="right" class="xl63" height="20" style="border: 0px solid black; height: 15.0pt;"&gt;11/16/2011&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 15.0pt;"&gt;&lt;TD align="right" class="xl63" height="20" style="border: 0px solid black; height: 15.0pt;"&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 15.0pt;"&gt;&lt;TD align="right" class="xl63" height="20" style="border: 0px solid black; height: 15.0pt;"&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" style="width: 95px;"&gt;&lt;TBODY&gt;&lt;TR style="height: 15.0pt;"&gt;&lt;TD height="20" style="border: 0px solid black; width: 71pt; height: 15.0pt;" width="95"&gt;Test_date&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 15.0pt;"&gt;&lt;TD align="right" class="xl65" height="20" style="border: 0px solid black; height: 15.0pt;"&gt;13-Mar-11&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 15.0pt;"&gt;&lt;TD align="right" class="xl65" height="20" style="border: 0px solid black; height: 15.0pt;"&gt;10-Apr-11&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 15.0pt;"&gt;&lt;TD align="right" class="xl65" height="20" style="border: 0px solid black; height: 15.0pt;"&gt;20-May-11&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 15.0pt;"&gt;&lt;TD align="right" class="xl65" height="20" style="border: 0px solid black; height: 15.0pt;"&gt;9-Jun-11&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 15.0pt;"&gt;&lt;TD align="right" class="xl65" height="20" style="border: 0px solid black; height: 15.0pt;"&gt;31-Jul-11&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 15.0pt;"&gt;&lt;TD align="right" class="xl65" height="20" style="border: 0px solid black; height: 15.0pt;"&gt;17-Aug-11&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 15.0pt;"&gt;&lt;TD align="right" class="xl65" height="20" style="border: 0px solid black; height: 15.0pt;"&gt;12-Sep-11&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 15.0pt;"&gt;&lt;TD align="right" class="xl65" height="20" style="border: 0px solid black; height: 15.0pt;"&gt;10-Nov-11&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 15.0pt;"&gt;&lt;TD align="right" class="xl65" height="20" style="border: 0px solid black; height: 15.0pt;"&gt;11-Oct-11&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 15.0pt;"&gt;&lt;TD align="right" class="xl65" height="20" style="border: 0px solid black; height: 15.0pt;"&gt;12-Dec-11&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 15.0pt;"&gt;&lt;TD align="right" class="xl65" height="20" style="border: 0px solid black; height: 15.0pt;"&gt;29-Feb-12&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 15.0pt;"&gt;&lt;TD align="right" class="xl65" height="20" style="border: 0px solid black; height: 15.0pt;"&gt;13-Mar-13&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 15.0pt;"&gt;&lt;TD align="right" class="xl65" height="20" style="border: 0px solid black; height: 15.0pt;"&gt;10-Apr-10&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 15.0pt;"&gt;&lt;TD align="right" class="xl65" height="20" style="border: 0px solid black; height: 15.0pt;"&gt;20-May-10&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 15.0pt;"&gt;&lt;TD align="right" class="xl65" height="20" style="border: 0px solid black; height: 15.0pt;"&gt;9-Jun-10&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 15.0pt;"&gt;&lt;TD align="right" class="xl65" height="20" style="border: 0px solid black; height: 15.0pt;"&gt;21-Jul-11&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 15.0pt;"&gt;&lt;TD align="right" class="xl65" height="20" style="border: 0px solid black; height: 15.0pt;"&gt;15-Aug-11&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 15.0pt;"&gt;&lt;TD align="right" class="xl65" height="20" style="border: 0px solid black; height: 15.0pt;"&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 15.0pt;"&gt;&lt;TD align="right" class="xl65" height="20" style="border: 0px solid black; height: 15.0pt;"&gt;19-Oct-11&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 15.0pt;"&gt;&lt;TD align="right" class="xl65" height="20" style="border: 0px solid black; height: 15.0pt;"&gt;21-Nov-11&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 15.0pt;"&gt;&lt;TD align="right" class="xl65" height="20" style="border: 0px solid black; height: 15.0pt;"&gt;22-Dec-11&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 20 May 2013 03:40:24 GMT</pubDate>
    <dc:creator>Sandy</dc:creator>
    <dc:date>2013-05-20T03:40:24Z</dc:date>
    <item>
      <title>How to mix and match dates in SAS??</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-mix-and-match-dates-in-SAS/m-p/79407#M256524</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Based on data could anyone assist me - making program that contains &lt;/P&gt;&lt;P&gt;test_date closest to delivery_date.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;delivery_date&lt;/STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;test_date&amp;nbsp; &lt;/STRONG&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;11/16/2011&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; 21/nov/2011&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &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; 10/nov/2011&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; 15/oct/2010&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 19 May 2013 23:46:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-mix-and-match-dates-in-SAS/m-p/79407#M256524</guid>
      <dc:creator>Sandy</dc:creator>
      <dc:date>2013-05-19T23:46:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to mix and match dates in SAS??</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-mix-and-match-dates-in-SAS/m-p/79408#M256525</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, I figure you should have an 'id' variable in this case, but if you don't, feel free to take it out:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sql;&lt;/P&gt;&lt;P&gt;&amp;nbsp; create table want as&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; select distinct a.* from have a, have b&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; where a.id=b.id&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; group by a.id /*I assume you should have one*/, b.delivery_date&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; having abs(b.test_date-a.delivery_date)=min(abs(a.delivery_date-b.test_date));&lt;/P&gt;&lt;P&gt;quit;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Haikuo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 May 2013 02:51:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-mix-and-match-dates-in-SAS/m-p/79408#M256525</guid>
      <dc:creator>Haikuo</dc:creator>
      <dc:date>2013-05-20T02:51:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to mix and match dates in SAS??</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-mix-and-match-dates-in-SAS/m-p/79409#M256526</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a variable delivery_date with one observation and test_date with 20 observations. I'd like to find the closest date in test_date to delivery_date by find the minimum absolute difference and retain the minimum value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I merge the datasets I only get two observations paired up and get missing values for the rest. Would anyone please explain how to go about this with maybe a do loop or...???&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" height="96" style="width: 82px;"&gt;&lt;TBODY&gt;&lt;TR style="height: 15.0pt;"&gt;&lt;TD height="20" style="border: 0px solid black; width: 88pt; height: 15.0pt;" width="117"&gt;delivery_date&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 15.0pt;"&gt;&lt;TD align="right" class="xl63" height="20" style="border: 0px solid black; height: 15.0pt;"&gt;11/16/2011&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 15.0pt;"&gt;&lt;TD align="right" class="xl63" height="20" style="border: 0px solid black; height: 15.0pt;"&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 15.0pt;"&gt;&lt;TD align="right" class="xl63" height="20" style="border: 0px solid black; height: 15.0pt;"&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" style="width: 95px;"&gt;&lt;TBODY&gt;&lt;TR style="height: 15.0pt;"&gt;&lt;TD height="20" style="border: 0px solid black; width: 71pt; height: 15.0pt;" width="95"&gt;Test_date&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 15.0pt;"&gt;&lt;TD align="right" class="xl65" height="20" style="border: 0px solid black; height: 15.0pt;"&gt;13-Mar-11&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 15.0pt;"&gt;&lt;TD align="right" class="xl65" height="20" style="border: 0px solid black; height: 15.0pt;"&gt;10-Apr-11&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 15.0pt;"&gt;&lt;TD align="right" class="xl65" height="20" style="border: 0px solid black; height: 15.0pt;"&gt;20-May-11&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 15.0pt;"&gt;&lt;TD align="right" class="xl65" height="20" style="border: 0px solid black; height: 15.0pt;"&gt;9-Jun-11&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 15.0pt;"&gt;&lt;TD align="right" class="xl65" height="20" style="border: 0px solid black; height: 15.0pt;"&gt;31-Jul-11&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 15.0pt;"&gt;&lt;TD align="right" class="xl65" height="20" style="border: 0px solid black; height: 15.0pt;"&gt;17-Aug-11&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 15.0pt;"&gt;&lt;TD align="right" class="xl65" height="20" style="border: 0px solid black; height: 15.0pt;"&gt;12-Sep-11&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 15.0pt;"&gt;&lt;TD align="right" class="xl65" height="20" style="border: 0px solid black; height: 15.0pt;"&gt;10-Nov-11&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 15.0pt;"&gt;&lt;TD align="right" class="xl65" height="20" style="border: 0px solid black; height: 15.0pt;"&gt;11-Oct-11&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 15.0pt;"&gt;&lt;TD align="right" class="xl65" height="20" style="border: 0px solid black; height: 15.0pt;"&gt;12-Dec-11&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 15.0pt;"&gt;&lt;TD align="right" class="xl65" height="20" style="border: 0px solid black; height: 15.0pt;"&gt;29-Feb-12&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 15.0pt;"&gt;&lt;TD align="right" class="xl65" height="20" style="border: 0px solid black; height: 15.0pt;"&gt;13-Mar-13&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 15.0pt;"&gt;&lt;TD align="right" class="xl65" height="20" style="border: 0px solid black; height: 15.0pt;"&gt;10-Apr-10&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 15.0pt;"&gt;&lt;TD align="right" class="xl65" height="20" style="border: 0px solid black; height: 15.0pt;"&gt;20-May-10&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 15.0pt;"&gt;&lt;TD align="right" class="xl65" height="20" style="border: 0px solid black; height: 15.0pt;"&gt;9-Jun-10&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 15.0pt;"&gt;&lt;TD align="right" class="xl65" height="20" style="border: 0px solid black; height: 15.0pt;"&gt;21-Jul-11&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 15.0pt;"&gt;&lt;TD align="right" class="xl65" height="20" style="border: 0px solid black; height: 15.0pt;"&gt;15-Aug-11&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 15.0pt;"&gt;&lt;TD align="right" class="xl65" height="20" style="border: 0px solid black; height: 15.0pt;"&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 15.0pt;"&gt;&lt;TD align="right" class="xl65" height="20" style="border: 0px solid black; height: 15.0pt;"&gt;19-Oct-11&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 15.0pt;"&gt;&lt;TD align="right" class="xl65" height="20" style="border: 0px solid black; height: 15.0pt;"&gt;21-Nov-11&lt;/TD&gt;&lt;/TR&gt;&lt;TR style="height: 15.0pt;"&gt;&lt;TD align="right" class="xl65" height="20" style="border: 0px solid black; height: 15.0pt;"&gt;22-Dec-11&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 20 May 2013 03:40:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-mix-and-match-dates-in-SAS/m-p/79409#M256526</guid>
      <dc:creator>Sandy</dc:creator>
      <dc:date>2013-05-20T03:40:24Z</dc:date>
    </item>
  </channel>
</rss>

