<?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: link dates from unbalanced data in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/link-dates-from-unbalanced-data/m-p/413099#M279927</link>
    <description>&lt;P&gt;Thanks! I tried your code but got the following error message:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ERROR: Function INTCK requires a numeric expression as argument 2.&lt;BR /&gt;ERROR: Function INTCK requires a numeric expression as argument 3.&lt;BR /&gt;ERROR: Expression using IN has components that are of different data types.&lt;BR /&gt;NOTE: The IN referred to may have been transformed from an OR to an IN at some point during&lt;BR /&gt;PROC SQL WHERE clause optimization.&lt;BR /&gt;ERROR: The following columns were not found in the contributing tables: date1, date2.&lt;/P&gt;</description>
    <pubDate>Mon, 13 Nov 2017 22:26:50 GMT</pubDate>
    <dc:creator>Leo66</dc:creator>
    <dc:date>2017-11-13T22:26:50Z</dc:date>
    <item>
      <title>link dates from unbalanced data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/link-dates-from-unbalanced-data/m-p/413090#M279924</link>
      <description>&lt;P&gt;Hi I have two data sets&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data one:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;id&amp;nbsp; date1&lt;/P&gt;&lt;P&gt;1&amp;nbsp; 01/01/2016&lt;/P&gt;&lt;P&gt;1&amp;nbsp; 01/08/2016&lt;/P&gt;&lt;P&gt;1&amp;nbsp; 02/06/2016&lt;/P&gt;&lt;P&gt;1&amp;nbsp; 03/07/2016&lt;/P&gt;&lt;P&gt;2&amp;nbsp; 01/05/2016&lt;/P&gt;&lt;P&gt;2&amp;nbsp; 01/12/2016&lt;/P&gt;&lt;P&gt;2&amp;nbsp; 02/09/2016&lt;/P&gt;&lt;P&gt;2&amp;nbsp; 03/11/2016&lt;/P&gt;&lt;P&gt;3&amp;nbsp; 01/02/2016&lt;/P&gt;&lt;P&gt;3&amp;nbsp; 01/03/2016&lt;/P&gt;&lt;P&gt;3&amp;nbsp; 02/08/2016&lt;/P&gt;&lt;P&gt;3&amp;nbsp;&amp;nbsp;03/03/2016&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data two:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;id date2&lt;/P&gt;&lt;P&gt;1 01/03/2016&lt;/P&gt;&lt;P&gt;1 01/09/2016&lt;/P&gt;&lt;P&gt;1 03/08/2016&lt;/P&gt;&lt;P&gt;2 01/06/2016&lt;/P&gt;&lt;P&gt;2 03/12/2016&lt;/P&gt;&lt;P&gt;3 01/04/2016&lt;/P&gt;&lt;P&gt;3 02/09/2016&lt;/P&gt;&lt;P&gt;3 03/04/2016&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;how to merge these two data sets by the condition that 0&amp;lt;=(date2-date1)&amp;lt;=2 days by ID?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The final data should be like:&lt;/P&gt;&lt;P&gt;id date1 date2&lt;/P&gt;&lt;P&gt;1&amp;nbsp; 01/01/2016&amp;nbsp; &amp;nbsp;&lt;SPAN&gt;01/03/2016&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;1&amp;nbsp; 01/08/2016&amp;nbsp; &amp;nbsp;&lt;SPAN&gt;01/09/2016&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;1&amp;nbsp; 02/06/2016&lt;/P&gt;&lt;P&gt;1&amp;nbsp; 03/07/2016&amp;nbsp; &amp;nbsp;&lt;SPAN&gt;03/08/2016&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;2&amp;nbsp; 01/05/2016&amp;nbsp; &amp;nbsp;&lt;SPAN&gt;01/06/2016&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;2&amp;nbsp; 01/12/2016&lt;/P&gt;&lt;P&gt;2&amp;nbsp; 02/09/2016&lt;/P&gt;&lt;P&gt;2&amp;nbsp; 03/11/2016&amp;nbsp; &amp;nbsp;&lt;SPAN&gt;03/12/2016&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;3&amp;nbsp; 01/02/2016&amp;nbsp; &amp;nbsp;&lt;SPAN&gt;01/04/2016&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;3&amp;nbsp; 01/03/2016&amp;nbsp; &amp;nbsp;&lt;SPAN&gt;01/04/2016&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;3&amp;nbsp; 02/08/2016&amp;nbsp; &amp;nbsp;&lt;SPAN&gt;02/09/2016&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;3&amp;nbsp;&amp;nbsp;03/03/2016&amp;nbsp; &amp;nbsp;&lt;SPAN&gt;03/04/2016&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please note the two data has different # of id.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Leo&lt;/P&gt;</description>
      <pubDate>Mon, 13 Nov 2017 22:03:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/link-dates-from-unbalanced-data/m-p/413090#M279924</guid>
      <dc:creator>Leo66</dc:creator>
      <dc:date>2017-11-13T22:03:38Z</dc:date>
    </item>
    <item>
      <title>Re: link dates from unbalanced data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/link-dates-from-unbalanced-data/m-p/413096#M279926</link>
      <description>&lt;P&gt;Relatively simple with 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 three as
select 
    a.id,
    a.date1,
    b.date2
from 
    one as a left join
    two as b on a.id=b.id and intck("day", date1, date2) between 0 and 2
order by id, date1, date2;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 13 Nov 2017 22:11:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/link-dates-from-unbalanced-data/m-p/413096#M279926</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2017-11-13T22:11:22Z</dc:date>
    </item>
    <item>
      <title>Re: link dates from unbalanced data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/link-dates-from-unbalanced-data/m-p/413099#M279927</link>
      <description>&lt;P&gt;Thanks! I tried your code but got the following error message:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;ERROR: Function INTCK requires a numeric expression as argument 2.&lt;BR /&gt;ERROR: Function INTCK requires a numeric expression as argument 3.&lt;BR /&gt;ERROR: Expression using IN has components that are of different data types.&lt;BR /&gt;NOTE: The IN referred to may have been transformed from an OR to an IN at some point during&lt;BR /&gt;PROC SQL WHERE clause optimization.&lt;BR /&gt;ERROR: The following columns were not found in the contributing tables: date1, date2.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Nov 2017 22:26:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/link-dates-from-unbalanced-data/m-p/413099#M279927</guid>
      <dc:creator>Leo66</dc:creator>
      <dc:date>2017-11-13T22:26:50Z</dc:date>
    </item>
    <item>
      <title>Re: link dates from unbalanced data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/link-dates-from-unbalanced-data/m-p/413103#M279928</link>
      <description>&lt;P&gt;INTCK&amp;nbsp;requires numeric date&amp;nbsp;values. Your dates are likely&amp;nbsp;character values, which are atrocious for trying to calculate "within 2 days".&lt;/P&gt;
&lt;P&gt;Convert them to SAS date values using input(datevar,mmddyy10.) in the INTCK calculations.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Better would be to go back in your process and insure that your variables are SAS date valued numeric for many reasons.&lt;/P&gt;</description>
      <pubDate>Mon, 13 Nov 2017 22:41:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/link-dates-from-unbalanced-data/m-p/413103#M279928</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-11-13T22:41:45Z</dc:date>
    </item>
    <item>
      <title>Re: link dates from unbalanced data</title>
      <link>https://communities.sas.com/t5/SAS-Programming/link-dates-from-unbalanced-data/m-p/414866#M279929</link>
      <description>&lt;P&gt;It works now, thanks for all your help!&lt;/P&gt;</description>
      <pubDate>Mon, 20 Nov 2017 15:26:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/link-dates-from-unbalanced-data/m-p/414866#M279929</guid>
      <dc:creator>Leo66</dc:creator>
      <dc:date>2017-11-20T15:26:28Z</dc:date>
    </item>
  </channel>
</rss>

