<?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 do I merge 2 datasets on 2 different timestamps in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-do-I-merge-2-datasets-on-2-different-timestamps/m-p/364343#M86410</link>
    <description>&lt;P&gt;I tried both solutions and they both worked!&amp;nbsp; Thank you so much!&lt;/P&gt;</description>
    <pubDate>Mon, 05 Jun 2017 19:25:18 GMT</pubDate>
    <dc:creator>stc200896</dc:creator>
    <dc:date>2017-06-05T19:25:18Z</dc:date>
    <item>
      <title>how do I merge 2 datasets on 2 different timestamps</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-do-I-merge-2-datasets-on-2-different-timestamps/m-p/364294#M86385</link>
      <description>&lt;P&gt;I have two massive datasets that I need to merge.&amp;nbsp; All of the fields are the same with the exception of the time field.&amp;nbsp; I want to merge the two datasets where T1.time is within 30 minutes of T2.time.&amp;nbsp; I have tried everything I can think of but that's probably not saying too much ;-).&amp;nbsp; Here's a sample of data below...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DATA T1;&lt;BR /&gt;INPUT STORE KEY2 DATE TIME VAR3&lt;BR /&gt;DATALINES;&lt;BR /&gt;3 163003 03SEP2016 18:47 1;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DATA T2;&lt;BR /&gt;INPUT STORE KEY2 DATE TIME VAR1 VAR2;&lt;BR /&gt;DATALINES;&lt;BR /&gt;3 163003 03SEP2016 18:33 1 1;&lt;BR /&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DATA T3;&lt;/P&gt;&lt;P&gt;MERGE T2 (IN=A) T1;&lt;/P&gt;&lt;P&gt;BY STORE KEY2 DATE;&lt;/P&gt;&lt;P&gt;IF A;&lt;/P&gt;&lt;P&gt;IF.........;&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The final table should be a left join to T2 to pull in var3 from T1 if T1.time is within 30 minutes of T2.time.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I sincererly appreciate any help anyone could provide.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Mon, 05 Jun 2017 15:27:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-do-I-merge-2-datasets-on-2-different-timestamps/m-p/364294#M86385</guid>
      <dc:creator>stc200896</dc:creator>
      <dc:date>2017-06-05T15:27:28Z</dc:date>
    </item>
    <item>
      <title>Re: how do I merge 2 datasets on 2 different timestamps</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-do-I-merge-2-datasets-on-2-different-timestamps/m-p/364298#M86388</link>
      <description>&lt;P&gt;Please try proc sql&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table want as select a.*,(a.time-b.time)/60 as t,b.var1,b.var2 from t1 as a left join t2 as b on 
a.store=b.store and a.key2=b.key2 and a.date=b.date having t&amp;lt;30;
quit;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 05 Jun 2017 15:36:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-do-I-merge-2-datasets-on-2-different-timestamps/m-p/364298#M86388</guid>
      <dc:creator>Jagadishkatam</dc:creator>
      <dc:date>2017-06-05T15:36:50Z</dc:date>
    </item>
    <item>
      <title>Re: how do I merge 2 datasets on 2 different timestamps</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-do-I-merge-2-datasets-on-2-different-timestamps/m-p/364304#M86391</link>
      <description>&lt;P&gt;something like this should work&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;proc sql;
select a.*, var2
from t1 a
left join
t2 b
on a.store =b.store
and a.key2 =b.key2
and b.time between  a.time - '00:30't and a.time;
quit;&lt;/PRE&gt;</description>
      <pubDate>Mon, 05 Jun 2017 15:53:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-do-I-merge-2-datasets-on-2-different-timestamps/m-p/364304#M86391</guid>
      <dc:creator>kiranv_</dc:creator>
      <dc:date>2017-06-05T15:53:43Z</dc:date>
    </item>
    <item>
      <title>Re: how do I merge 2 datasets on 2 different timestamps</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-do-I-merge-2-datasets-on-2-different-timestamps/m-p/364343#M86410</link>
      <description>&lt;P&gt;I tried both solutions and they both worked!&amp;nbsp; Thank you so much!&lt;/P&gt;</description>
      <pubDate>Mon, 05 Jun 2017 19:25:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-do-I-merge-2-datasets-on-2-different-timestamps/m-p/364343#M86410</guid>
      <dc:creator>stc200896</dc:creator>
      <dc:date>2017-06-05T19:25:18Z</dc:date>
    </item>
  </channel>
</rss>

