<?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: difference between two dates - Days in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/difference-between-two-dates-Days/m-p/825607#M41179</link>
    <description>&lt;P&gt;You did not post the complete log. It will contain a NOTE about uninitialized variables: you use in&lt;FONT color="#FF0000"&gt;1&lt;/FONT&gt; and in&lt;FONT color="#FF0000"&gt;2&lt;/FONT&gt; in the first subsetting if, but define in&lt;FONT color="#FF0000"&gt;a&lt;/FONT&gt; and in&lt;FONT color="#FF0000"&gt;b&lt;/FONT&gt; in the dataset options.&lt;/P&gt;
&lt;P&gt;But if you have multiple observations for a given fname in both datasets, and want to find pairs wihich are within 3 days, you need to use SQL, as you must work from a cartesian join:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table have3 as
  select
    have1.fname,
    have1.dischdate,
    input(have2.notedate,yymmdd10.) as notedate_n format=yymmdd10.,
    abs(notedate_n - dischdate) as difdays
  from have1 inner join have2
  on have1.fname = have2.fname
  having difdays le 3
  order by fname, dischdate
;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;For more help, post examples of have1 and have2 as &lt;U&gt;data steps with datalines&lt;/U&gt;; &lt;STRONG&gt;do not skip this&lt;/STRONG&gt;.&lt;/P&gt;</description>
    <pubDate>Wed, 27 Jul 2022 08:32:24 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2022-07-27T08:32:24Z</dc:date>
    <item>
      <title>difference between two dates - Days</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/difference-between-two-dates-Days/m-p/824836#M41150</link>
      <description>&lt;P&gt;I want to get the difference between dischdate and notedate and grab the data with datediff between -3 and 3 days. How do I do this?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table want
as select 
c.fname,
c.dischdate,
d.fname,
d.notedate
from have1 c inner join have2 d
on c.fname=d.fname;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 22 Jul 2022 08:49:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/difference-between-two-dates-Days/m-p/824836#M41150</guid>
      <dc:creator>bhca60</dc:creator>
      <dc:date>2022-07-22T08:49:00Z</dc:date>
    </item>
    <item>
      <title>Re: difference between two dates - Days</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/difference-between-two-dates-Days/m-p/824848#M41151</link>
      <description>&lt;P&gt;Please post the data you have in usable form.&lt;/P&gt;
&lt;P&gt;Do you have proper dates or strings?&lt;/P&gt;
&lt;P&gt;The code ist, of course, untested.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  merge have1(keep=fname dischdate in=in1) have2(keep= fname notedate in=in2);
  by fname;
  if in1 and in2;
  if -3 &amp;lt;= intck('day', dischdate, notedate) &amp;lt;= 3;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 22 Jul 2022 09:40:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/difference-between-two-dates-Days/m-p/824848#M41151</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2022-07-22T09:40:10Z</dc:date>
    </item>
    <item>
      <title>Re: difference between two dates - Days</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/difference-between-two-dates-Days/m-p/824859#M41152</link>
      <description>notedate is $CHAR11.&lt;BR /&gt;dischdate $10.&lt;BR /&gt;</description>
      <pubDate>Fri, 22 Jul 2022 11:14:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/difference-between-two-dates-Days/m-p/824859#M41152</guid>
      <dc:creator>bhca60</dc:creator>
      <dc:date>2022-07-22T11:14:03Z</dc:date>
    </item>
    <item>
      <title>Re: difference between two dates - Days</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/difference-between-two-dates-Days/m-p/824861#M41153</link>
      <description>&lt;P&gt;These are character variables, and cannot be treated as dates in SAS (even if they look like dates to humans). You cannot subtract one character variable from another character variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;These will have to be converted to valid SAS dates, which are numeric values equal to the number of days since 01JAN1960.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please show us examples of how both of these variables appear to you.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Jul 2022 11:17:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/difference-between-two-dates-Days/m-p/824861#M41153</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-07-22T11:17:35Z</dc:date>
    </item>
    <item>
      <title>Re: difference between two dates - Days</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/difference-between-two-dates-Days/m-p/824862#M41154</link>
      <description>2021-10-15 - this is how it looks for both notedate and dischdate</description>
      <pubDate>Fri, 22 Jul 2022 11:25:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/difference-between-two-dates-Days/m-p/824862#M41154</guid>
      <dc:creator>bhca60</dc:creator>
      <dc:date>2022-07-22T11:25:34Z</dc:date>
    </item>
    <item>
      <title>Re: difference between two dates - Days</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/difference-between-two-dates-Days/m-p/824864#M41155</link>
      <description>&lt;P&gt;I modify the solution from&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/15475"&gt;@andreas_lds&lt;/a&gt;&amp;nbsp;to convert these character strings to actual SAS date values, via the INPUT function and the YYMMDD10 informat.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  merge have1(keep=fname dischdate in=in1) have2(keep= fname notedate in=in2);
  by fname;
  if in1 and in2;
  dischdate_n=input(dischdate,yymmdd10.);
  notedate_n=input(notedate,yymmdd10.);
  if -3 &amp;lt;= intck('day', dischdate_n, notedate_n) &amp;lt;= 3;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 22 Jul 2022 11:30:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/difference-between-two-dates-Days/m-p/824864#M41155</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-07-22T11:30:24Z</dc:date>
    </item>
    <item>
      <title>Re: difference between two dates - Days</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/difference-between-two-dates-Days/m-p/824866#M41156</link>
      <description>I did the above and i got this note:&lt;BR /&gt;&lt;BR /&gt;NOTE: Numeric values have been converted to character values at the places given by: (Line):(Column).&lt;BR /&gt;      28:21   &lt;BR /&gt;NOTE: Invalid argument to function INPUT at line 28 column 15.</description>
      <pubDate>Fri, 22 Jul 2022 11:48:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/difference-between-two-dates-Days/m-p/824866#M41156</guid>
      <dc:creator>bhca60</dc:creator>
      <dc:date>2022-07-22T11:48:43Z</dc:date>
    </item>
    <item>
      <title>Re: difference between two dates - Days</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/difference-between-two-dates-Days/m-p/824868#M41157</link>
      <description>&lt;P&gt;A couple of things. Whenever there are issues in the log, we need to see the &lt;FONT color="#FF0000"&gt;ENTIRE&lt;/FONT&gt; log for this DATA step, not selected parts of it. (And in the future, the same requirements hold). Copy the log as text and paste the log into the window that appears when you click on the &amp;lt;/&amp;gt;&amp;nbsp; icon.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Insert Log Icon in SAS Communities.png" style="width: 859px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/66171iFEC370B1DBF07B28/image-size/large?v=v2&amp;amp;px=999" role="button" title="Insert Log Icon in SAS Communities.png" alt="Insert Log Icon in SAS Communities.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;We also need to see a portion of the data — please provide data with all of your questions from now on, &lt;FONT color="#FF0000"&gt;in a usable form&lt;/FONT&gt;, which is either manually typed working SAS data step code, or using &lt;A href="https://blogs.sas.com/content/sastraining/2016/03/11/jedi-sas-tricks-data-to-data-step-macro/" target="_self"&gt;these instructions&lt;/A&gt;. Attachments and screen captures are not acceptable.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please comply with these requests from now, don't make us keep asking.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Jul 2022 12:04:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/difference-between-two-dates-Days/m-p/824868#M41157</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2022-07-22T12:04:17Z</dc:date>
    </item>
    <item>
      <title>Re: difference between two dates - Days</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/difference-between-two-dates-Days/m-p/825587#M41173</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;Still trying to get the difference between the dischdate and notedate so that it outputs the number of days difference.&lt;/P&gt;
&lt;P&gt;The data I have is:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;have1:&lt;BR /&gt;fname&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;dischdate &lt;BR /&gt;joe morris&amp;nbsp; &amp;nbsp; 2021-10-14 &lt;BR /&gt;john doe&amp;nbsp; &amp;nbsp; &amp;nbsp; 2021-11-15&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;have2:&lt;BR /&gt;fname&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; notedate&lt;BR /&gt;joe morris&amp;nbsp; &amp;nbsp; 2021-10-17&lt;BR /&gt;john doe&amp;nbsp; &amp;nbsp; &amp;nbsp; 2021-11-17&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The fname is a character.&lt;BR /&gt;The dischdate is a numeric; length 8; format YYMMDD10.&lt;BR /&gt;The notedate is a character; length 11; format $CHAR11&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jul 2022 04:26:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/difference-between-two-dates-Days/m-p/825587#M41173</guid>
      <dc:creator>bhca60</dc:creator>
      <dc:date>2022-07-27T04:26:05Z</dc:date>
    </item>
    <item>
      <title>Re: difference between two dates - Days</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/difference-between-two-dates-Days/m-p/825589#M41174</link>
      <description>&lt;P&gt;A modified version of&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;'s program should work in that case since dischdate is already a SAS date:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data want;
  merge have1(keep=fname dischdate in=in1) have2(keep= fname notedate in=in2);
  by fname;
  if in1 and in2;
  notedate_n=input(notedate,yymmdd10.);
  if -3 &amp;lt;= intck('day', dischdate, notedate_n) &amp;lt;= 3;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 27 Jul 2022 04:41:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/difference-between-two-dates-Days/m-p/825589#M41174</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2022-07-27T04:41:03Z</dc:date>
    </item>
    <item>
      <title>Re: difference between two dates - Days</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/difference-between-two-dates-Days/m-p/825591#M41175</link>
      <description>I did what you told me but the output for notedate_n looks like this:&lt;BR /&gt;22539, 22735, etc. they are all 5 digit numbers&lt;BR /&gt;&lt;BR /&gt;Also, I wanted to create a column where the difdays populate.</description>
      <pubDate>Wed, 27 Jul 2022 04:50:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/difference-between-two-dates-Days/m-p/825591#M41175</guid>
      <dc:creator>bhca60</dc:creator>
      <dc:date>2022-07-27T04:50:35Z</dc:date>
    </item>
    <item>
      <title>Re: difference between two dates - Days</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/difference-between-two-dates-Days/m-p/825595#M41176</link>
      <description>&lt;P&gt;Always (as in&amp;nbsp;&lt;STRONG&gt;ALWAYS&lt;/STRONG&gt;) post the complete log of a step, so we can see the statements SAS is complaining about. Use this button to post the log:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Bildschirmfoto 2020-04-07 um 08.32.59.jpg" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/54552i914D97BE1B0F21E5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Bildschirmfoto 2020-04-07 um 08.32.59.jpg" alt="Bildschirmfoto 2020-04-07 um 08.32.59.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jul 2022 05:42:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/difference-between-two-dates-Days/m-p/825595#M41176</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-07-27T05:42:11Z</dc:date>
    </item>
    <item>
      <title>Re: difference between two dates - Days</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/difference-between-two-dates-Days/m-p/825596#M41177</link>
      <description>&lt;P&gt;Values like these are most likely valid SAS date values (count of days from 1960-01-01) and need only a proper fornat to become human-readable.&lt;/P&gt;
&lt;P&gt;Show your complete code and log where you try to create difdays.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jul 2022 05:47:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/difference-between-two-dates-Days/m-p/825596#M41177</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-07-27T05:47:11Z</dc:date>
    </item>
    <item>
      <title>Re: difference between two dates - Days</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/difference-between-two-dates-Days/m-p/825601#M41178</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;23         data have3;
24         merge have1 (keep=fname dischdate in=ina)
25         	 have2(keep=fname notedate in=inb);
26         by fname;
27         if in1 and in2;
28         notedate_n=input(notedate,yymmdd10.);
29         if -3 &amp;lt;= intck('day', dischdate, notedate_n) &amp;lt;= 3;
30         run;
NOTE: MERGE statement has more than one data set with repeats of BY values.
NOTE: Missing values were generated as a result of performing an operation on missing values.
      Each place is given by: (Number of times) at (Line):(Column).
      115 at 29:10 &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I wanted to create a column called difdays doing a formula like this: difdays=intck('day', dischdate, notedate_n)&amp;nbsp; &amp;nbsp;then do&amp;nbsp; something like : if -3 &amp;lt;= difdays &amp;lt;= 3;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jul 2022 06:35:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/difference-between-two-dates-Days/m-p/825601#M41178</guid>
      <dc:creator>bhca60</dc:creator>
      <dc:date>2022-07-27T06:35:31Z</dc:date>
    </item>
    <item>
      <title>Re: difference between two dates - Days</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/difference-between-two-dates-Days/m-p/825607#M41179</link>
      <description>&lt;P&gt;You did not post the complete log. It will contain a NOTE about uninitialized variables: you use in&lt;FONT color="#FF0000"&gt;1&lt;/FONT&gt; and in&lt;FONT color="#FF0000"&gt;2&lt;/FONT&gt; in the first subsetting if, but define in&lt;FONT color="#FF0000"&gt;a&lt;/FONT&gt; and in&lt;FONT color="#FF0000"&gt;b&lt;/FONT&gt; in the dataset options.&lt;/P&gt;
&lt;P&gt;But if you have multiple observations for a given fname in both datasets, and want to find pairs wihich are within 3 days, you need to use SQL, as you must work from a cartesian join:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc sql;
create table have3 as
  select
    have1.fname,
    have1.dischdate,
    input(have2.notedate,yymmdd10.) as notedate_n format=yymmdd10.,
    abs(notedate_n - dischdate) as difdays
  from have1 inner join have2
  on have1.fname = have2.fname
  having difdays le 3
  order by fname, dischdate
;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;For more help, post examples of have1 and have2 as &lt;U&gt;data steps with datalines&lt;/U&gt;; &lt;STRONG&gt;do not skip this&lt;/STRONG&gt;.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jul 2022 08:32:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/difference-between-two-dates-Days/m-p/825607#M41179</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2022-07-27T08:32:24Z</dc:date>
    </item>
    <item>
      <title>Re: difference between two dates - Days</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/difference-between-two-dates-Days/m-p/825693#M41180</link>
      <description>&lt;P&gt;Everything ran fine, it's just that the notedate_n column brought back 5 digit numbers as explained in previous post.&amp;nbsp; Also, the log had no errors:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;23         data have3;
24         merge have1 (keep=fname dischdate in=in1)
25         	 have2(keep=fname notedate in=in2);
26         by fname;
27         if in1 and in2;
28         notedate_n=input(notedate,yymmdd10.);
29         if -3 &amp;lt;= intck('day', dischdate, notedate_n) &amp;lt;= 3;
30         run;
NOTE: MERGE statement has more than one data set with repeats of BY values.
NOTE: Missing values were generated as a result of performing an operation on missing values.
      Each place is given by: (Number of times) at (Line):(Column).
      115 at 29:10   &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I am trying to create a column for difdays that brings in anybody who has between -3 and 3 days difference between the dischdate and the notedate_n.&amp;nbsp; this is all. I didnt think it would be this complicated. I will try something else, thank you&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jul 2022 15:22:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/difference-between-two-dates-Days/m-p/825693#M41180</guid>
      <dc:creator>bhca60</dc:creator>
      <dc:date>2022-07-27T15:22:40Z</dc:date>
    </item>
    <item>
      <title>Re: difference between two dates - Days</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/difference-between-two-dates-Days/m-p/825715#M41181</link>
      <description>&lt;P&gt;You are on the right track. The character date string (NOTEDATE)&amp;nbsp; first needs to be converted to a numeric date value with the INPUT function. The 5-digit results you see are correct, a SAS date is the number of days since Jan 1, 1960. You need to apply a format to the date value so it displays properly. Once you convert the date, you can find the number of days between the two dates with the INTCK function, and then subset the table appropriately.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example:&lt;/P&gt;
&lt;P&gt;data have1;&lt;BR /&gt;infile cards dsd truncover;&lt;BR /&gt;input fname :$12. dischdate :yymmdd10.;&lt;BR /&gt;format dischdate yymmdd10.;&lt;BR /&gt;cards;&lt;BR /&gt;jane doe,2021-11-17&lt;BR /&gt;joe morris,2021-10-14&lt;BR /&gt;john doe,2021-11-15&lt;BR /&gt;mary jones,2021-11-12&lt;BR /&gt;tom brown,2021-12-02&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;data have2;&lt;BR /&gt;infile cards dsd truncover;&lt;BR /&gt;input fname :$12. notedate :$11.;&lt;BR /&gt;cards;&lt;BR /&gt;jane doe,2021-11-15&lt;BR /&gt;joe morris,2021-10-17&lt;BR /&gt;john doe,2021-11-17&lt;BR /&gt;mary jones,2021-11-18&lt;BR /&gt;tom brown,2021-11-25&lt;BR /&gt;;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;data have3 (drop=notedate);&lt;BR /&gt;merge have1 (keep=fname dischdate in=ina)&lt;BR /&gt;have2(keep=fname notedate in=inb);&lt;BR /&gt;by fname;&lt;BR /&gt;if ina and inb;&lt;BR /&gt;notedate_n=input(notedate,yymmdd10.);&lt;BR /&gt;format notedate_n yymmdd10.;&lt;BR /&gt;datediff=intck('day', dischdate, notedate_n);&lt;BR /&gt;if -3 &amp;lt;= datediff &amp;lt;= 3;&lt;BR /&gt;run;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you get any notes/errors/warnings with your code, please send in the entire log so we can better determine the issue.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jul 2022 16:06:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/difference-between-two-dates-Days/m-p/825715#M41181</guid>
      <dc:creator>jebjur</dc:creator>
      <dc:date>2022-07-27T16:06:25Z</dc:date>
    </item>
    <item>
      <title>Re: difference between two dates - Days</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/difference-between-two-dates-Days/m-p/825741#M41182</link>
      <description>OMG! THANK YOU SOOOOO MUCH!!!</description>
      <pubDate>Wed, 27 Jul 2022 16:55:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/difference-between-two-dates-Days/m-p/825741#M41182</guid>
      <dc:creator>bhca60</dc:creator>
      <dc:date>2022-07-27T16:55:04Z</dc:date>
    </item>
  </channel>
</rss>

