<?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 merge datasets based on date of service within 7 days and two other variables? in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-merge-datasets-based-on-date-of-service-within-7-days-and/m-p/885720#M43344</link>
    <description>&lt;P&gt;Not much detail to go on, no data set names, no variable names.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can select with something like this, assuming your date values are actually SAS date values:&lt;/P&gt;
&lt;PRE&gt; JOIN ON basedate le desireddate le intnx('days',basedate,7)&lt;/PRE&gt;
&lt;P&gt;if you want a desired date variable to between some other date variable and 7 days later. SAS dates you could actually just use (basedate+7) but the intnx function would be the way to increment another date by week, month, quarter or year with some others mixed in.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This would be done in Proc SQL to get reliable many-to-many join.&lt;/P&gt;
&lt;P&gt;Likely you would have aliases indicating which dataset each of your date variables comes from.&lt;/P&gt;
&lt;P&gt;I think you likely would be using the provider visit date as "basedate" and the medication date as the "desireddate" above.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 20 Jul 2023 22:22:11 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2023-07-20T22:22:11Z</dc:date>
    <item>
      <title>How to merge datasets based on date of service within 7 days and two other variables?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-merge-datasets-based-on-date-of-service-within-7-days-and/m-p/885715#M43343</link>
      <description>&lt;P&gt;I have two datasets and I need to merge them together. These datasets will require a many to many merge. One is a healthcare visit dataset and the other is a medication pick-up dataset. Two of the variables I need to merge on are a patient id and provider id and then I also need to merge on a visit date. However I do not need the visit date to be the same, I need it to be either on the same day or within the following X amount of days (7 for example). I am not sure how I can merge two datasets on an inexact but specified timeframe rather than a single variable. Is there a way to do this? Is there another approach for this outside of also merging on date?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jul 2023 21:21:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-merge-datasets-based-on-date-of-service-within-7-days-and/m-p/885715#M43343</guid>
      <dc:creator>csantia</dc:creator>
      <dc:date>2023-07-20T21:21:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to merge datasets based on date of service within 7 days and two other variables?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-merge-datasets-based-on-date-of-service-within-7-days-and/m-p/885720#M43344</link>
      <description>&lt;P&gt;Not much detail to go on, no data set names, no variable names.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can select with something like this, assuming your date values are actually SAS date values:&lt;/P&gt;
&lt;PRE&gt; JOIN ON basedate le desireddate le intnx('days',basedate,7)&lt;/PRE&gt;
&lt;P&gt;if you want a desired date variable to between some other date variable and 7 days later. SAS dates you could actually just use (basedate+7) but the intnx function would be the way to increment another date by week, month, quarter or year with some others mixed in.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This would be done in Proc SQL to get reliable many-to-many join.&lt;/P&gt;
&lt;P&gt;Likely you would have aliases indicating which dataset each of your date variables comes from.&lt;/P&gt;
&lt;P&gt;I think you likely would be using the provider visit date as "basedate" and the medication date as the "desireddate" above.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jul 2023 22:22:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-merge-datasets-based-on-date-of-service-within-7-days-and/m-p/885720#M43344</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2023-07-20T22:22:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to merge datasets based on date of service within 7 days and two other variables?</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-merge-datasets-based-on-date-of-service-within-7-days-and/m-p/885721#M43345</link>
      <description>&lt;P&gt;Please provide sample data of what you HAVE and what you WANT.&amp;nbsp; You'll get much better results.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jul 2023 23:00:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/How-to-merge-datasets-based-on-date-of-service-within-7-days-and/m-p/885721#M43345</guid>
      <dc:creator>mkeintz</dc:creator>
      <dc:date>2023-07-20T23:00:49Z</dc:date>
    </item>
  </channel>
</rss>

