<?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 perform a complex merge/matching procedure from two datasets (Part B) in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/How-to-perform-a-complex-merge-matching-procedure-from-two/m-p/107594#M29930</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It will help others to try to answer if you can express what you want to accomplish a bit differently.&amp;nbsp; I.e., without referring to KSharp's code, or references like 60+1, what are you really trying to accomplish?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 12 Feb 2013 22:38:32 GMT</pubDate>
    <dc:creator>art297</dc:creator>
    <dc:date>2013-02-12T22:38:32Z</dc:date>
    <item>
      <title>How to perform a complex merge/matching procedure from two datasets (Part B)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-perform-a-complex-merge-matching-procedure-from-two/m-p/107593#M29929</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am posting two new questions which are based on an earlier inquiry which was partly answered regarding a complex merging procedure:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" href="https://communities.sas.com/thread/39361?start=0&amp;amp;tstart=0"&gt;https://communities.sas.com/thread/39361?start=0&amp;amp;tstart=0&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The two new questions are based on the provided solution by Ksharp:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. The basic solution shown also below matches the same currencies based on a specific date and time interval. If there exists no exact match by time, the next closest time is selected to do the matching (thus time+1 as in code). What I would like is to update this code to perform the same procedure as before instead but now instead of having time A = time B (or time B+1) to have time A = time B+60 (or time B+60 + 1). &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. The solution is provided under hash format and when executing one currency for one day it works well. However my dataset has multiple currencies and 68 days of observations (in total 64 million of observations in the first dataset and 2mln in the second dataset) which makes the execution impossible by my pc. Do you have any other ideas on how efficiently to execute the hash code?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any suggestions are very much welcome.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Many thanks for your time in advance&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Neo&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Below the hash solution&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;libname&lt;/SPAN&gt;&lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: purple; background: white;"&gt;'d:\phd thesis\sas files'&lt;/SPAN&gt;&lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;STRONG&gt;&lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: navy; background: white;"&gt;data&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp; neo.c2;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;set&lt;/SPAN&gt;&lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; neo.Chfdaily2;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;datetime=input(catx(&lt;/SPAN&gt;&lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: purple; background: white;"&gt;':'&lt;/SPAN&gt;&lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;,value_date,newtime),&lt;/SPAN&gt;&lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: teal; background: white;"&gt;anydtdtm20.&lt;/SPAN&gt;&lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;format&lt;/SPAN&gt;&lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; datetime &lt;/SPAN&gt;&lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: teal; background: white;"&gt;datetime.&lt;/SPAN&gt;&lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;STRONG&gt;&lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: navy; background: white;"&gt;run&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;STRONG&gt;&lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: navy; background: white;"&gt;data&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; neo.c3;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;set&lt;/SPAN&gt;&lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; neo.Chfr;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;datetime=dhms(datepart(Date_G_),&lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: teal; background: white;"&gt;0&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;,&lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: teal; background: white;"&gt;0&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;,int(Time_G_));&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;format&lt;/SPAN&gt;&lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; datetime &lt;/SPAN&gt;&lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: teal; background: white;"&gt;datetime.&lt;/SPAN&gt;&lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;STRONG&gt;&lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: navy; background: white;"&gt;run&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;STRONG&gt;&lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: navy; background: white;"&gt;data&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; neo.want;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;if&lt;/SPAN&gt;&lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; _n_ eq &lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: teal; background: white;"&gt;1&lt;/SPAN&gt;&lt;/STRONG&gt; &lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;then&lt;/SPAN&gt; &lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;do&lt;/SPAN&gt;&lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;if&lt;/SPAN&gt; &lt;STRONG&gt;&lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: teal; background: white;"&gt;0&lt;/SPAN&gt;&lt;/STRONG&gt; &lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;then&lt;/SPAN&gt; &lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;set&lt;/SPAN&gt;&lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; c3;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&amp;nbsp; &lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;declare&lt;/SPAN&gt;&lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; hash ha(hashexp:&lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: teal; background: white;"&gt;16&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;,dataset:&lt;/SPAN&gt;&lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: purple; background: white;"&gt;'c3'&lt;/SPAN&gt;&lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp; ha.definekey(&lt;/SPAN&gt;&lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: purple; background: white;"&gt;'_ric2'&lt;/SPAN&gt;&lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;,&lt;/SPAN&gt;&lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: purple; background: white;"&gt;'datetime'&lt;/SPAN&gt;&lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp; ha.definedata(all:&lt;/SPAN&gt;&lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: purple; background: white;"&gt;'Y'&lt;/SPAN&gt;&lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;&amp;nbsp;&amp;nbsp; ha.definedone();&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;end&lt;/SPAN&gt;&lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;call&lt;/SPAN&gt;&lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; missing(of _all_);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;set&lt;/SPAN&gt;&lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; c2;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;_ric2 =cur1cur2;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;datepart=datepart(datetime);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;do&lt;/SPAN&gt; &lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;while&lt;/SPAN&gt;&lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;(ha.find() ne &lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: teal; background: white;"&gt;0&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;datetime+&lt;/SPAN&gt;&lt;STRONG&gt;&lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: teal; background: white;"&gt;1&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;if&lt;/SPAN&gt;&lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; datepart ne datepart(datetime) &lt;/SPAN&gt;&lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;then&lt;/SPAN&gt; &lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;leave&lt;/SPAN&gt;&lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;end&lt;/SPAN&gt;&lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: 0.0001pt;"&gt;&lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: blue; background: white;"&gt;drop&lt;/SPAN&gt;&lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt; datepart LOC Price Volume;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: navy; background: white;"&gt;run&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN lang="EN" style="font-size: 10.0pt; font-family: 'Courier New'; color: black; background: white;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Feb 2013 17:39:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-perform-a-complex-merge-matching-procedure-from-two/m-p/107593#M29929</guid>
      <dc:creator>machete</dc:creator>
      <dc:date>2013-02-12T17:39:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to perform a complex merge/matching procedure from two datasets (Part B)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-perform-a-complex-merge-matching-procedure-from-two/m-p/107594#M29930</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It will help others to try to answer if you can express what you want to accomplish a bit differently.&amp;nbsp; I.e., without referring to KSharp's code, or references like 60+1, what are you really trying to accomplish?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Feb 2013 22:38:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-perform-a-complex-merge-matching-procedure-from-two/m-p/107594#M29930</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2013-02-12T22:38:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to perform a complex merge/matching procedure from two datasets (Part B)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-perform-a-complex-merge-matching-procedure-from-two/m-p/107595#M29931</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;So we deal with the following economic problem:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- we have two datasets. The first one contains the transactions of a broker with customers. the second dataset contains concluded transactions on the market (where only brokers have access but not customers).&lt;/P&gt;&lt;P&gt;- what i try to do is to compare the difference in the price the customer has paid to trade with the broker and the price which at that time was prevailing at the market.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is it more clear now?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That is why we need to match from the two datasets the currencies if they are the same (since both datasets have transactions of several currencies), then look at the dates and match the same dates and as last step match the transaction times - they should also be the same. Now comes the tricky part:&lt;/P&gt;&lt;P&gt;1 Because the broker after transacting with the customer might not trade exactly the same time with other brokers but after 1 second, the first step of the solution as you see in the hash solution checks if time A does not euqal time B, it picks time B+1. This is the first part of the problem&lt;/P&gt;&lt;P&gt;2 Now imagine I want&amp;nbsp; to directly match the transaction a broker executed with a customer with the price which was on the market (dataset B) 60 seconds after the customer transaction. However as before, there might exist no price in exactly +60 seconds, so the code must account for that and searchh for 60seconds + X, that is take exactly the nearest observation.&lt;/P&gt;&lt;P&gt;No2 of the problem as described above does not work in the hash solution &lt;/P&gt;&lt;P&gt;For No1 and potentially no2 the hash solution is not efficient as a method to execute a large dataset&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let me know if you need any additional info and look forward to your reply. Attached are also excel sheets with sample data&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Neo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Feb 2013 07:40:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-perform-a-complex-merge-matching-procedure-from-two/m-p/107595#M29931</guid>
      <dc:creator>machete</dc:creator>
      <dc:date>2013-02-14T07:40:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to perform a complex merge/matching procedure from two datasets (Part B)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-perform-a-complex-merge-matching-procedure-from-two/m-p/107596#M29932</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No, not clear enough for me.&amp;nbsp; If dataset A has the values that one paid at a particular point in time, and dataset B contains the prices at various points in time, I would think that for each record in dataset A you would want the record from dataset B that has a time that occured closest to but before the time reflected in the particular dataset A record.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Feb 2013 00:17:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-perform-a-complex-merge-matching-procedure-from-two/m-p/107596#M29932</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2013-02-15T00:17:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to perform a complex merge/matching procedure from two datasets (Part B)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-perform-a-complex-merge-matching-procedure-from-two/m-p/107597#M29933</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #575757;"&gt;Let me me explain further:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #575757;"&gt;Imagine there exist two parallel markets, market A (dataset A) where customers are allowed to trade with brokers(e.g banks) and market B (Dataset B) where only brokers are allowed to trade between themselves.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #575757;"&gt;Now lets say we would like to test whether some customers are better informed than their broker. We check how much they paid when they transacted with the broker and then we check the price the broker paid when trading with other brokers, exactly the same time or later during the day depending on the investment horizon. A numeric example.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #575757;"&gt;Customer A (is informed)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #575757;"&gt;Buys from our broker (dataset A) an asset XYZ at $5 at 10.00am on 07.02.2013&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #575757;"&gt;Our broker sells to other brokers (dataset B) the same asset as $6 at 10.01 on 07.02.2013&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #575757;"&gt;Our broker also sells to other brokers (dataset B) the same asset at $7 at 11.30 on the 07.02.2013&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #575757;"&gt;What is the price impact of the customer &lt;/SPAN&gt;&lt;SPAN style="color: #575757;"&gt;(simply put the delta between the first trade with the broker and any of the other trades between the brokers?)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #575757;"&gt;From the above we can analyze first of all whether the customer is more informed about future price changes than his broker(he knows the direction of price change, e.g buys before the price goes high) and of course up to what time horizon he has information. Is it intraday for a couple of minutes? hours? or it is days?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #575757;"&gt;For&amp;nbsp; this reason I need to program the matching code at different time horizons. This variable (price impact) will be&amp;nbsp; my dependent variable&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #575757;"&gt;I hope this makes things clearer?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #575757;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #575757;"&gt;Neo&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Feb 2013 20:41:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-perform-a-complex-merge-matching-procedure-from-two/m-p/107597#M29933</guid>
      <dc:creator>machete</dc:creator>
      <dc:date>2013-02-15T20:41:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to perform a complex merge/matching procedure from two datasets (Part B)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-perform-a-complex-merge-matching-procedure-from-two/m-p/107598#M29934</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Not for me!&amp;nbsp; You don't say what you think will constitute the "other trades" and you seem to be talking about specific brokers but, at the same time, generalizing to the market place.&amp;nbsp; I would think, again, that you want the most recent broker price for the asset before the datasetA record, as well as all of those within a certain period after the trade.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If that is what you are trying to do, then you have to let us know and what that after period should be.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 15 Feb 2013 22:22:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-perform-a-complex-merge-matching-procedure-from-two/m-p/107598#M29934</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2013-02-15T22:22:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to perform a complex merge/matching procedure from two datasets (Part B)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-perform-a-complex-merge-matching-procedure-from-two/m-p/107599#M29935</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Actually I would like to take the broker price executed at the same time as the record in dataset A.if not possible then use the broker price in time+1(the next closest). The other broker trades will have to be after the trade record in dataset A in specific time intervals. for example executed time in dataset A + 30 seconds or 60 or 90 etc. I would imagine the solution code as a standard solution then me being able to modify the periods of analysis(30 or 60 or 90 secods). this solution should deliver values in specific points in time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let me restate the problem in a similar way&lt;/P&gt;&lt;P&gt;.&lt;/P&gt;&lt;P&gt;1. I would like to match based on a trade for example EUR/USD (asset) from dataset A executed at a&amp;nbsp; specific point in time (date and time),&amp;nbsp; &lt;STRONG&gt;with&lt;/STRONG&gt; a trade of EUR/USD (same asset as in dataset A) which is part of dataset B and is executed at the same point of time (date and time) &lt;STRONG&gt;with the trade in dataset A&lt;/STRONG&gt;. If such trade to be matched at exactly the same point of time does not exist, to simply search and then match the closest trade available (e.g time +1). This is what the hash solution actually did.&lt;/P&gt;&lt;P&gt;That is, is there a more efficient code to perform the above?&lt;/P&gt;&lt;P&gt;2. The second exercise is to do exactly the same process as above, &lt;STRONG&gt;however&lt;/STRONG&gt; this time I would like to match the trade in dataset B which is X seconds after the trade in dataset A. that means that we will match trade A at a specified time and date (lets say 10:00 16/02/2013 ) with a trade in dataset B which is the same date, but time+60 seconds (lets say 10:01 16/02/2013). if there does not exist a perfect match at time+60seconds to take the closest one, e.g time+60seconds+1(e.g 10:01:01 16/02/2013)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the files attached there is also available a sheet which shows how the final matching should look like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let me know how I can support further in explaining this exercise&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Neo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 16 Feb 2013 12:09:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-perform-a-complex-merge-matching-procedure-from-two/m-p/107599#M29935</guid>
      <dc:creator>machete</dc:creator>
      <dc:date>2013-02-16T12:09:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to perform a complex merge/matching procedure from two datasets (Part B)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-perform-a-complex-merge-matching-procedure-from-two/m-p/107600#M29936</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Neo,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your 'want' file doesn't appear to match your description.&amp;nbsp; From your description, I would have expected to find at least one record in your want file for every record that exists in dataset A.&amp;nbsp; However, the first one there IIRC, was record number six.&amp;nbsp; Why?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 16 Feb 2013 14:44:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-perform-a-complex-merge-matching-procedure-from-two/m-p/107600#M29936</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2013-02-16T14:44:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to perform a complex merge/matching procedure from two datasets (Part B)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-perform-a-complex-merge-matching-procedure-from-two/m-p/107601#M29937</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;The want file is structured as follows: up to variable datetime (on the horizontal axis) these are dataset B variables and then follow dataset A variables. Datasets A and B follow the notation of our discussion from above&lt;/P&gt;&lt;P&gt;As you correctly observed the correctly matched observations start from observation no 6. The first 5 observations which are not matched I believe this is the case because the example files of dataset B which I provided was too short, thus did not had enough observations (i wanted to upload only a small part of the whole dataset). However the complete dataset B will not face such problems. For illustration, dataset A has 2 millions observations for the same time period which dataset B has 64 million observations.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 16 Feb 2013 17:52:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-perform-a-complex-merge-matching-procedure-from-two/m-p/107601#M29937</guid>
      <dc:creator>machete</dc:creator>
      <dc:date>2013-02-16T17:52:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to perform a complex merge/matching procedure from two datasets (Part B)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-perform-a-complex-merge-matching-procedure-from-two/m-p/107602#M29938</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My question probably wasn't sufficiently clear.&amp;nbsp; What is the criterion for a record not matching?&amp;nbsp; I ask because I would suggest code that gets all of the relevant data in one step.&amp;nbsp; Within a minute? An hour?&amp;nbsp; And, as for multiple matches, does that change the criterion or do you want all matches within a particular time period?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 16 Feb 2013 18:29:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-perform-a-complex-merge-matching-procedure-from-two/m-p/107602#M29938</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2013-02-16T18:29:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to perform a complex merge/matching procedure from two datasets (Part B)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-perform-a-complex-merge-matching-procedure-from-two/m-p/107603#M29939</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Art,&lt;/P&gt;&lt;P&gt;records need to fullfill the following criteria to be ,matched :&lt;/P&gt;&lt;P&gt;1. same currency(asset)&lt;/P&gt;&lt;P&gt;2. same date&lt;/P&gt;&lt;P&gt;3. same time&lt;/P&gt;&lt;P&gt;in general records sometimes do not match because time is measured up to the second (this is too detailed) and sometimes there exist no exact matches by the second in both datasets(this is why i would like the code to search for the next closest observation in terms of seconds. &lt;/P&gt;&lt;P&gt;in the example discussed above with the "want" file, the problem was that in dataset B there were no trades after 21:00 so for the trade executed in dataset A at 21:50 there was no matching trade in dataset B. this was because I added a short example (small sample) of the two datasets.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the above will net only one new variable (matched exactly by time or in the worst case matched by time+1)&lt;/P&gt;&lt;P&gt;the second matching exercise will search for a solution time in A = time in B+ 30 seconds, +60 seconds, 30min, 60mins, 720mins,24hrs (this should add 6 variables). I can though adjust the code from above and execute it 6 times to give each time one solution) . This solution will be more tricky so lets discuss in due time.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 16 Feb 2013 20:39:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-perform-a-complex-merge-matching-procedure-from-two/m-p/107603#M29939</guid>
      <dc:creator>machete</dc:creator>
      <dc:date>2013-02-16T20:39:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to perform a complex merge/matching procedure from two datasets (Part B)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-perform-a-complex-merge-matching-procedure-from-two/m-p/107604#M29940</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Neo,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You're getting closer but, like I said, I would suggest getting everything done in one run.&amp;nbsp; Does time+1 equal time+1 second?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If so, then what I would suggest is outputting the info for all six matches (i.e., the average price for those records which match:&lt;/P&gt;&lt;P&gt;(1) time &amp;lt;=time+1second&lt;/P&gt;&lt;P&gt;(2) time+1 second &amp;lt;= time+30 seconds&lt;/P&gt;&lt;P&gt;(3) time + 30 seconds &amp;lt;= time+30 minutes&lt;/P&gt;&lt;P&gt;(4) time+30 minutes &amp;lt;= time+60 minutes&lt;/P&gt;&lt;P&gt;(5) time+60 minutes &amp;lt;= to,e+720 minutes&lt;/P&gt;&lt;P&gt;(6) time+720 minutes &amp;lt;= time+24 hours&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Would that suffice?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 16 Feb 2013 21:05:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-perform-a-complex-merge-matching-procedure-from-two/m-p/107604#M29940</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2013-02-16T21:05:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to perform a complex merge/matching procedure from two datasets (Part B)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-perform-a-complex-merge-matching-procedure-from-two/m-p/107605#M29941</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I refer to Time+1 as the closest observation next to time. That is, if time in dataset A does not equal time in B then +1 in my wording meant simply the next closest observation, this can be 1 second or 10 seconds or 2mins,dependng on dataset B.Some currencies (assets) are more liquid than others, that means the next closest observation might be after one second, but for currencies of small countries the next closest trade might be in 2 mins as these currencies are not trade so often.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the base for all the matches will be time in dataset A, I modified slightly what you wrote:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(1) time(in dataset A) &amp;lt;=time(in dataset B)+1second&lt;/P&gt;&lt;P&gt;however for the next observations things change:&lt;/P&gt;&lt;P&gt;(2) time &amp;lt;= time+30 seconds&lt;/P&gt;&lt;P&gt;(3) time &amp;lt;= time+1 minutes&lt;/P&gt;&lt;P&gt;(4) time &amp;lt;= time+30 minutes&lt;/P&gt;&lt;P&gt;(5) time &amp;lt;= time+60 minutes&lt;/P&gt;&lt;P&gt;(6) time &amp;lt;= time+24 hours&lt;/P&gt;&lt;P&gt;as you can see mathematically i have the price from dataset A and the development of the price in time based on data available in dataset B.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;at the end i will get a row e.g&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; (dataset A)&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; (dataset B)&lt;/P&gt;&lt;P&gt;trade&amp;nbsp;&amp;nbsp; executed price&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; time&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; price2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; time2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; price3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; time3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ...........&amp;nbsp;&amp;nbsp; price6&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; time 6&lt;/P&gt;&lt;P&gt; 1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1.35&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; 22:36:00&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; 1.37&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 22:36:00&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 1.38&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 22:36:30&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; 1.36&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 22:36:00&amp;nbsp; (however this is after 24 hrs - the date has changed)&lt;/P&gt;&lt;P&gt; 2&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; &lt;/P&gt;&lt;P&gt; 3&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ..........................&lt;/P&gt;&lt;P&gt;.....&lt;/P&gt;&lt;P&gt;2mln&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ............................&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think it is more difficult to do all matches as once. This is shown in my example. Have a look at price 6/time 6. As this query is conditional:&lt;/P&gt;&lt;P&gt;a/ on the currency variable (that both currency codes are the same in dataset A and B)&lt;/P&gt;&lt;P&gt;b/ on the date&lt;/P&gt;&lt;P&gt;However if we search for a trade + 24hrs or in the above example +2 hours based on the trade which is executed at 22:36 then the dates will be not the same. I am not good in programming but I think this will be tricky to solve as the basic solution is conditional on that the dates are the same. if we do not condition on date in the beginning, the solution will match based on time and net wrong results because the dataset is a time series of 3 months (total of 68&amp;nbsp; working days) thus practically we will have an exact solution at 22:36 for 68 observations contained in dataset B. &lt;/P&gt;&lt;P&gt;Hope I did not confuse you with the above&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 16 Feb 2013 21:52:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-perform-a-complex-merge-matching-procedure-from-two/m-p/107605#M29941</guid>
      <dc:creator>machete</dc:creator>
      <dc:date>2013-02-16T21:52:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to perform a complex merge/matching procedure from two datasets (Part B)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-perform-a-complex-merge-matching-procedure-from-two/m-p/107606#M29942</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Neo,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Since you have both date and time in one file, and a datetime field in the other, I would just combine the two in the first file to have a datetime field in both.&amp;nbsp; That way, you only have to compare datetime differences and whether they cross dates would be irrelevant.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I can find the time to offer some code, it will be to solve everything at once.&amp;nbsp; How you use it, of course, would be your decision.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your requirement for the initial "match" should change, I think, the rest of the ranges.&amp;nbsp; I.e., if first match is the closest time, then I would think that you would want the ranges to appear something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;(1) datetime(in dataset A) &amp;lt;= the closest datetime in dataset 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; new_base_datetime = the time found in this step&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;(2) &lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;new_base_datetime&lt;/SPAN&gt;+1/100th second &amp;lt;= next datetime(s) in datasetB&amp;lt;=&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;new_base_datetime&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;+30 seconds&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;(3) &lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;new_base_datetime&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;+30 seconds+1/100th second &amp;lt;= next datetime(s) in datasetB&amp;lt;=&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;new_base_datetime&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;+1 minute&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;(4) &lt;SPAN style="font-size: 10pt;"&gt;new_base_datetime&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;+1 minute+1/100th second &amp;lt;= next datetime(s) in datasetB&amp;lt;=&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;new_base_datetime&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;+30 minutes&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;(5) &lt;SPAN style="font-size: 10pt;"&gt;new_base_datetime&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;+30 minutes+1/100th second &amp;lt;= next datetime(s) in datasetB&amp;lt;=&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;new_base_datetime&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;+60 minutes&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;(6) &lt;SPAN style="font-size: 10pt;"&gt;new_base_datetime&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;+60 minutes+1/100th second &amp;lt;= next datetime(s) in datasetB&amp;lt;=&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;new_base_datetime&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;+24 hours&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Would that work or do I still not understand what you are trying to do?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 16 Feb 2013 23:24:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-perform-a-complex-merge-matching-procedure-from-two/m-p/107606#M29942</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2013-02-16T23:24:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to perform a complex merge/matching procedure from two datasets (Part B)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-perform-a-complex-merge-matching-procedure-from-two/m-p/107607#M29943</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Art,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What you mention rgd datetime makes sense then this should not be a problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The solution will be actually easier than what you propose. The base time is fixed. That means for all the matches To (starting time) is constant and it is the datetime of a transaction in dataset A. we then simply match this one with those in dataset B which are +30seconds, +1...+24hrs further in time. as you have written it above equations (1) to (6), the left handside should be always datetime (in dataset A)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in summary:&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue',Helvetica,Arial,'Lucida Grande',sans-serif; background-color: #ffffff;"&gt;(1) datetime(in dataset A) &amp;lt;= the closest datetime in dataset B) &lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue',Helvetica,Arial,'Lucida Grande',sans-serif; background-color: #ffffff;"&gt;(2) datetime(in dataset A) &amp;lt;= &lt;SPAN style="font-size: 10pt;"&gt;database B_datetime&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;+30 seconds&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue',Helvetica,Arial,'Lucida Grande',sans-serif; background-color: #ffffff;"&gt;(3) datetime(in dataset A) &amp;lt;= &lt;SPAN style="font-size: 10pt;"&gt;database B_datetime&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;+&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;1 minute&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue',Helvetica,Arial,'Lucida Grande',sans-serif; background-color: #ffffff;"&gt;(4) datetime(in dataset A) &amp;lt;= &lt;SPAN style="font-size: 10pt;"&gt;database B_datetime&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;+30 minutes&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue',Helvetica,Arial,'Lucida Grande',sans-serif; background-color: #ffffff;"&gt;(5) datetime(in dataset A) &amp;lt;= &lt;SPAN style="font-size: 10pt;"&gt;database B_datetime&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;+&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;60 minutes&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue',Helvetica,Arial,'Lucida Grande',sans-serif; background-color: #ffffff;"&gt;(6) datetime(in dataset A) &amp;lt;= &lt;SPAN style="font-size: 10pt;"&gt;database B_datetime&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;+&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;24 hours&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue',Helvetica,Arial,'Lucida Grande',sans-serif; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 10pt;"&gt;does it make sense?&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue',Helvetica,Arial,'Lucida Grande',sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue',Helvetica,Arial,'Lucida Grande',sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-size: 10pt;"&gt;all the above conditioned on currency in database A = currency in database B (this is a text variable, i am not sure if this makes a difference for the code)&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue',Helvetica,Arial,'Lucida Grande',sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue',Helvetica,Arial,'Lucida Grande',sans-serif; background-color: #ffffff;"&gt;&lt;SPAN style="font-size: 10pt;"&gt;i am not sure if we need this part you provided in all the equations:&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-family: 'Helvetica Neue',Helvetica,Arial,'Lucida Grande',sans-serif; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;SPAN style="font-size: 10pt;"&gt; &amp;lt;= next datetime(s) in datasetB ?&lt;BR /&gt;&lt;/SPAN&gt;&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&gt;I have the feeling we are close to have the solution described in a logical order.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Neo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 17 Feb 2013 00:00:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-perform-a-complex-merge-matching-procedure-from-two/m-p/107607#M29943</guid>
      <dc:creator>machete</dc:creator>
      <dc:date>2013-02-17T00:00:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to perform a complex merge/matching procedure from two datasets (Part B)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-perform-a-complex-merge-matching-procedure-from-two/m-p/107608#M29944</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I was suggesting making all of the times relative to the closest matching time based on your comment that "&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;that means the next closest observation might be after one second, but for currencies of small countries the next closest trade might be in 2 mins as these currencies are not trade so often&lt;/SPAN&gt;".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That is why I suggested your making the categories relative to the first match.&amp;nbsp; However, I'm a Psychologist, so this is NOT really even close to my areas of expertise.&amp;nbsp; And, besides, you (not me) are the decision maker.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 17 Feb 2013 04:14:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-perform-a-complex-merge-matching-procedure-from-two/m-p/107608#M29944</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2013-02-17T04:14:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to perform a complex merge/matching procedure from two datasets (Part B)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-perform-a-complex-merge-matching-procedure-from-two/m-p/107609#M29945</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Art,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think if we treat this as two sub problems will be easier to solve. The first problem is datetime (in dataset A) &amp;lt;= the closest datetime (in dataset B) and then the second problem will be matching datetime (in dataset A) &amp;lt;= &lt;SPAN style="font-size: 10pt;"&gt;database B_datetime "&lt;/SPAN&gt;&lt;SPAN style="font-size: 10pt;"&gt;+30 seconds / 1min / 30mins / 60mins / 24hrs as discussed in earlier posts" which will give us 5 more variables in the output.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;I would suggest if you have already a code in mind to post it here so that I test it, then I think will be more easier to finalize the solution with small iterations&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Neo&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 17 Feb 2013 12:45:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-perform-a-complex-merge-matching-procedure-from-two/m-p/107609#M29945</guid>
      <dc:creator>machete</dc:creator>
      <dc:date>2013-02-17T12:45:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to perform a complex merge/matching procedure from two datasets (Part B)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-perform-a-complex-merge-matching-procedure-from-two/m-p/107610#M29946</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your call!&amp;nbsp; In your original post, &lt;A __default_attr="379045" __jive_macro_name="user" class="jive_macro jive_macro_user" data-objecttype="3" href="https://communities.sas.com/"&gt;&lt;/A&gt; had mentioned that some code &lt;A __default_attr="2746" __jive_macro_name="user" class="jive_macro jive_macro_user" data-objecttype="3" href="https://communities.sas.com/"&gt;&lt;/A&gt; had offered to solve a similar problem might be just what you were looking for.&amp;nbsp; I still don't understand what you want for the initial match, but here is a modified version of the code that PGStats had offered.&amp;nbsp; It simply gets the first Reuters' record that is greater than or equal to the chfdaily record.&amp;nbsp; It assumes that the Reuters' data in sorted in datetime order:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;libname art "c:\art";&lt;/P&gt;&lt;P&gt;data chfdaily2 (drop=value_date newtime);&lt;/P&gt;&lt;P&gt;&amp;nbsp; length Cur1Cur2 $7;&lt;/P&gt;&lt;P&gt;&amp;nbsp; format Cur1Cur2 $7.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; informat Cur1Cur2 $7.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set art.chfdaily2;&lt;/P&gt;&lt;P&gt;&amp;nbsp; format dt1 datetime19.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; dt1=dhms(input(value_date,ddmmyy10.),&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; hour(input(newtime,time8.)),&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; minute(input(newtime,time8.)),&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; second(input(newtime,time8.)));&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc sort data=chfdaily2;&lt;/P&gt;&lt;P&gt;&amp;nbsp; by dt1;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data chfreuters3 (drop=date_G_ time_G_);&lt;/P&gt;&lt;P&gt;&amp;nbsp; set art.chfreuters3;&lt;/P&gt;&lt;P&gt;&amp;nbsp; format dt2 datetime19.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; dt2=dhms(datepart(date_G_),hour(time_G_),minute(time_G_),second(time_G_));&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp; retain start_rpointer;&lt;/P&gt;&lt;P&gt;&amp;nbsp; set chfdaily2;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if _n_ eq 1 then start_rpointer=1;&lt;/P&gt;&lt;P&gt;&amp;nbsp; current_rpointer=start_rpointer;&lt;/P&gt;&lt;P&gt;&amp;nbsp; do while (dt1 ge dt2 and not have2end);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set chfreuters3 point=current_rpointer end=have2end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if dt2 ge dt1 and Cur1Cur2 eq _ric2 then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; start_rpointer=current_rpointer;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; current_rpointer+1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 17 Feb 2013 18:00:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-perform-a-complex-merge-matching-procedure-from-two/m-p/107610#M29946</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2013-02-17T18:00:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to perform a complex merge/matching procedure from two datasets (Part B)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-perform-a-complex-merge-matching-procedure-from-two/m-p/107611#M29947</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Art,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the reply. This code worked for doing the first match. However I am facing two problems:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. When I try to run this on a larger sample - one currency (14000 observations in the first dataset to be matched from 1,5million from Reuters) for the whole period (68 days) the system crashes after two hours of processing.I tried this a couple of times with other combinations of currencies but it still crashes. Is there a way we can adjust the code to execute stepwise day by day(which will mean to break down the dataset into 68 days automatically and then re-merge it)? Breaking down the dataset manually into days and currencies will take me probably days to do.Do you have any other possible solutions?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Can you provide an update solving my second problem as well - matching the reuters records which are 30,60,720 seconds further in time than the record in Dataset A etc Or shall we find a stable solution for point no 1 from above first and then deal with this one?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Neo &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 24 Feb 2013 11:53:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-perform-a-complex-merge-matching-procedure-from-two/m-p/107611#M29947</guid>
      <dc:creator>machete</dc:creator>
      <dc:date>2013-02-24T11:53:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to perform a complex merge/matching procedure from two datasets (Part B)</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/How-to-perform-a-complex-merge-matching-procedure-from-two/m-p/107612#M29948</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Without knowing why it crashed, or actually seeing the data, it is impossible to say.&amp;nbsp; Given that the code is rather straight forward, my guess would be that the Reuters data is not in datetime order or, possibly, it is in received datetime order, but has to be adjusted for timezones in order for the datetimes to be sequentially ordered.&amp;nbsp; Have you manually looked at a section of the data (say, possibly, a one hour span in the middle of some weekday)?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;From what you would observe, the solution may be obvious.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 24 Feb 2013 14:18:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/How-to-perform-a-complex-merge-matching-procedure-from-two/m-p/107612#M29948</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2013-02-24T14:18:08Z</dc:date>
    </item>
  </channel>
</rss>

