<?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: missing consecutive dates in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/missing-consecutive-dates/m-p/37959#M9687</link>
    <description>This approach following Flip's suggestion:&lt;BR /&gt;
&lt;BR /&gt;
data pats;&lt;BR /&gt;
input patno:$3. visitdate:date.;&lt;BR /&gt;
cards;&lt;BR /&gt;
101 10-feb-09&lt;BR /&gt;
101 11-feb-09&lt;BR /&gt;
101 14-feb-09&lt;BR /&gt;
101 15-feb-09&lt;BR /&gt;
102 10-feb-09&lt;BR /&gt;
102 13-feb-09&lt;BR /&gt;
102 14-feb-09&lt;BR /&gt;
102 16-feb-09&lt;BR /&gt;
103 16-feb-09&lt;BR /&gt;
103 17-feb-09&lt;BR /&gt;
103 19-feb-09&lt;BR /&gt;
;;;;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
data want(keep=patno);&lt;BR /&gt;
  set pats;&lt;BR /&gt;
  by patno;&lt;BR /&gt;
  retain flag 0;&lt;BR /&gt;
  if visitdate-lag(visitdate)&amp;gt;2 then &lt;BR /&gt;
    if not first.patno then flag=1;&lt;BR /&gt;
  if last.patno and flag=1 then&lt;BR /&gt;
  do;&lt;BR /&gt;
    output;&lt;BR /&gt;
    flag=0;&lt;BR /&gt;
  end;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
proc print data=want;&lt;BR /&gt;
run;&lt;BR /&gt;
      &lt;BR /&gt;
HTH&lt;BR /&gt;
Patrick</description>
    <pubDate>Fri, 08 Jan 2010 00:50:16 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2010-01-08T00:50:16Z</dc:date>
    <item>
      <title>missing consecutive dates</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/missing-consecutive-dates/m-p/37956#M9684</link>
      <description>I have a situation like below.&lt;BR /&gt;
&lt;BR /&gt;
patno visitdate&lt;BR /&gt;
101    10-feb-09&lt;BR /&gt;
101    11-feb-09&lt;BR /&gt;
101    14-feb-09&lt;BR /&gt;
101    15-feb-09&lt;BR /&gt;
&lt;BR /&gt;
In the above example dates 12-feb and 13-feb are missing. I want to identify patients where atleast 2 consecutive dates are missing.&lt;BR /&gt;
&lt;BR /&gt;
Thanks in advance.</description>
      <pubDate>Thu, 07 Jan 2010 16:48:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/missing-consecutive-dates/m-p/37956#M9684</guid>
      <dc:creator>madhu</dc:creator>
      <dc:date>2010-01-07T16:48:06Z</dc:date>
    </item>
    <item>
      <title>Re: missing consecutive dates</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/missing-consecutive-dates/m-p/37957#M9685</link>
      <description>Try something like where not first.patno and (visitdate - lag(visitdate) &amp;gt;2);</description>
      <pubDate>Thu, 07 Jan 2010 17:13:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/missing-consecutive-dates/m-p/37957#M9685</guid>
      <dc:creator>Flip</dc:creator>
      <dc:date>2010-01-07T17:13:18Z</dc:date>
    </item>
    <item>
      <title>Re: missing consecutive dates</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/missing-consecutive-dates/m-p/37958#M9686</link>
      <description>Check out DIF function:&lt;BR /&gt;
[pre]&lt;BR /&gt;
&lt;I&gt;Returns differences between the argument and its nth lag&lt;/I&gt; &lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
data pats;&lt;BR /&gt;
   input patno:$3. visitdate:date.;&lt;BR /&gt;
   cards;&lt;BR /&gt;
101 10-feb-09&lt;BR /&gt;
101 11-feb-09&lt;BR /&gt;
101 14-feb-09&lt;BR /&gt;
101 15-feb-09&lt;BR /&gt;
102 10-feb-09&lt;BR /&gt;
102 13-feb-09&lt;BR /&gt;
102 14-feb-09&lt;BR /&gt;
102 16-feb-09&lt;BR /&gt;
;;;;&lt;BR /&gt;
   run;&lt;BR /&gt;
data pats(keep=patno);&lt;BR /&gt;
   f = 0;&lt;BR /&gt;
   do until(last.patno);&lt;BR /&gt;
      set pats;&lt;BR /&gt;
      by patno;&lt;BR /&gt;
      d = ifn(not first.patno,dif(visitDate),0);&lt;BR /&gt;
      if not f and d ge 2 then do;&lt;BR /&gt;
         output;&lt;BR /&gt;
         f=1;&lt;BR /&gt;
         end;&lt;BR /&gt;
      end;&lt;BR /&gt;
   run;&lt;BR /&gt;
proc print;&lt;BR /&gt;
   run;[/pre]</description>
      <pubDate>Thu, 07 Jan 2010 19:01:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/missing-consecutive-dates/m-p/37958#M9686</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2010-01-07T19:01:36Z</dc:date>
    </item>
    <item>
      <title>Re: missing consecutive dates</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/missing-consecutive-dates/m-p/37959#M9687</link>
      <description>This approach following Flip's suggestion:&lt;BR /&gt;
&lt;BR /&gt;
data pats;&lt;BR /&gt;
input patno:$3. visitdate:date.;&lt;BR /&gt;
cards;&lt;BR /&gt;
101 10-feb-09&lt;BR /&gt;
101 11-feb-09&lt;BR /&gt;
101 14-feb-09&lt;BR /&gt;
101 15-feb-09&lt;BR /&gt;
102 10-feb-09&lt;BR /&gt;
102 13-feb-09&lt;BR /&gt;
102 14-feb-09&lt;BR /&gt;
102 16-feb-09&lt;BR /&gt;
103 16-feb-09&lt;BR /&gt;
103 17-feb-09&lt;BR /&gt;
103 19-feb-09&lt;BR /&gt;
;;;;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
data want(keep=patno);&lt;BR /&gt;
  set pats;&lt;BR /&gt;
  by patno;&lt;BR /&gt;
  retain flag 0;&lt;BR /&gt;
  if visitdate-lag(visitdate)&amp;gt;2 then &lt;BR /&gt;
    if not first.patno then flag=1;&lt;BR /&gt;
  if last.patno and flag=1 then&lt;BR /&gt;
  do;&lt;BR /&gt;
    output;&lt;BR /&gt;
    flag=0;&lt;BR /&gt;
  end;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
proc print data=want;&lt;BR /&gt;
run;&lt;BR /&gt;
      &lt;BR /&gt;
HTH&lt;BR /&gt;
Patrick</description>
      <pubDate>Fri, 08 Jan 2010 00:50:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/missing-consecutive-dates/m-p/37959#M9687</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2010-01-08T00:50:16Z</dc:date>
    </item>
  </channel>
</rss>

