<?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: Retrieve first instance of date between dates located in another table in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Retrieve-first-instance-of-date-between-dates-located-in-another/m-p/579644#M164550</link>
    <description>&lt;P&gt;Thank you for the infromation.&amp;nbsp; I will work on generating the code because of currently I haven't written anything as those two tables are on our database and I didn't know where to begin.&lt;/P&gt;</description>
    <pubDate>Wed, 07 Aug 2019 12:31:44 GMT</pubDate>
    <dc:creator>Sotarkadin</dc:creator>
    <dc:date>2019-08-07T12:31:44Z</dc:date>
    <item>
      <title>Retrieve first instance of date between dates located in another table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Retrieve-first-instance-of-date-between-dates-located-in-another/m-p/579491#M164493</link>
      <description>&lt;P&gt;Good Day all,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I currently have two tables I am trying to join to do data validations between a source of record system and the end system for it.&lt;/P&gt;
&lt;P&gt;Currently Table A has account, date, and amount.&amp;nbsp; Table B has account date and amount as well where as the account and amounts "should match" the date can vary because of the system lag and processing until it's updated into the system.&amp;nbsp; I am trying to find the first instance of the matching account and dollar amount in Table B that happens between each period of time in the rows of Table A.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have an example of each table below and what the expected result should be.&amp;nbsp; Table A has a record for each month with the amount posted.&amp;nbsp; Depending on updates to the system, table B has multiple entries as it records every time a change is made.&amp;nbsp; I am only looking to find the first instance after the date from Table A, which as you can see in the results Table, our first date in table A is 2/22/2019, and our second is 3/22/2019.&amp;nbsp; For Table B I want to find the first date that occurs after 2/22 but only if it occurs before 3/22 for the matching amount in table A.&amp;nbsp; I hope I have provided enough information.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE width="392"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD colspan="3" width="196"&gt;Table A&lt;/TD&gt;
&lt;TD colspan="3" width="196"&gt;Table B&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;account&lt;/TD&gt;
&lt;TD&gt;Date&lt;/TD&gt;
&lt;TD&gt;Amount&lt;/TD&gt;
&lt;TD&gt;account&lt;/TD&gt;
&lt;TD&gt;Date&lt;/TD&gt;
&lt;TD&gt;Amount&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;12345&lt;/TD&gt;
&lt;TD&gt;2/22/2019&lt;/TD&gt;
&lt;TD&gt;5000&lt;/TD&gt;
&lt;TD&gt;12345&lt;/TD&gt;
&lt;TD&gt;2/23/2019&lt;/TD&gt;
&lt;TD&gt;5000&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;12345&lt;/TD&gt;
&lt;TD&gt;3/22/2019&lt;/TD&gt;
&lt;TD&gt;5000&lt;/TD&gt;
&lt;TD&gt;12345&lt;/TD&gt;
&lt;TD&gt;2/24/2019&lt;/TD&gt;
&lt;TD&gt;5000&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;12345&lt;/TD&gt;
&lt;TD&gt;4/22/2019&lt;/TD&gt;
&lt;TD&gt;4800&lt;/TD&gt;
&lt;TD&gt;12345&lt;/TD&gt;
&lt;TD&gt;3/1/2019&lt;/TD&gt;
&lt;TD&gt;5000&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;12345&lt;/TD&gt;
&lt;TD&gt;5/22/2019&lt;/TD&gt;
&lt;TD&gt;4600&lt;/TD&gt;
&lt;TD&gt;12345&lt;/TD&gt;
&lt;TD&gt;3/23/2019&lt;/TD&gt;
&lt;TD&gt;5000&lt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t;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;12345&lt;/TD&gt;
&lt;TD&gt;5000&lt;/TD&gt;
&lt;TD&gt;2/22/2019&lt;/TD&gt;
&lt;TD&gt;2/23/2019&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;12345&lt;/TD&gt;
&lt;TD&gt;5000&lt;/TD&gt;
&lt;TD&gt;3/22/2019&lt;/TD&gt;
&lt;TD&gt;3/23/2019&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;12345&lt;/TD&gt;
&lt;TD&gt;4800&lt;/TD&gt;
&lt;TD&gt;4/22/2019&lt;/TD&gt;
&lt;TD&gt;5/12/2019&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;12345&lt;/TD&gt;
&lt;TD&gt;4600&lt;/TD&gt;
&lt;TD&gt;5/22/2019&lt;/TD&gt;
&lt;TD&gt;5/23/2019&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;12345&lt;/TD&gt;
&lt;TD&gt;4500&lt;/TD&gt;
&lt;TD&gt;6/22/2019&lt;/TD&gt;
&lt;TD&gt;6/22/2019&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;</description>
      <pubDate>Tue, 06 Aug 2019 20:06:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Retrieve-first-instance-of-date-between-dates-located-in-another/m-p/579491#M164493</guid>
      <dc:creator>Sotarkadin</dc:creator>
      <dc:date>2019-08-06T20:06:44Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve first instance of date between dates located in another table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Retrieve-first-instance-of-date-between-dates-located-in-another/m-p/579529#M164502</link>
      <description>&lt;P&gt;&lt;EM&gt;&amp;gt;I hope I have provided enough information.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;I think you did.&lt;/P&gt;
&lt;P&gt;What's missing is the code to generate the data to save us time and confusion.&lt;/P&gt;
&lt;P&gt;See&amp;nbsp;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-data-AKA-generate/ta-p/258712" target="_blank" rel="noopener noreferrer"&gt;How to convert datasets to data steps&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Aug 2019 23:42:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Retrieve-first-instance-of-date-between-dates-located-in-another/m-p/579529#M164502</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2019-08-06T23:42:55Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve first instance of date between dates located in another table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Retrieve-first-instance-of-date-between-dates-located-in-another/m-p/579644#M164550</link>
      <description>&lt;P&gt;Thank you for the infromation.&amp;nbsp; I will work on generating the code because of currently I haven't written anything as those two tables are on our database and I didn't know where to begin.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Aug 2019 12:31:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Retrieve-first-instance-of-date-between-dates-located-in-another/m-p/579644#M164550</guid>
      <dc:creator>Sotarkadin</dc:creator>
      <dc:date>2019-08-07T12:31:44Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieve first instance of date between dates located in another table</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Retrieve-first-instance-of-date-between-dates-located-in-another/m-p/579645#M164551</link>
      <description>&lt;P&gt;The request from&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/16961"&gt;@ChrisNZ&lt;/a&gt;&amp;nbsp;was not to see your code, the request was to provide the sample data in a usable form for us, that usable form is a SAS data step and can be created by the instructions at the link he gave.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Aug 2019 12:36:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Retrieve-first-instance-of-date-between-dates-located-in-another/m-p/579645#M164551</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2019-08-07T12:36:17Z</dc:date>
    </item>
  </channel>
</rss>

