<?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: Identify Subjects missing 4 or more consecutive doses in SAS Health and Life Sciences</title>
    <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/Identify-Subjects-missing-4-or-more-consecutive-doses/m-p/53046#M1432</link>
    <description>Sorry, it looks like I did not understand your problem. So, the above code is only a part of the solution. Please submit a sample of your data then it will be easier to get into a solution. This is my second attempt:&lt;BR /&gt;
[pre]&lt;BR /&gt;
proc freq data=EX_BID noprint;&lt;BR /&gt;
  tables EXDT/out=freq (where=(Count &amp;lt; 2));&lt;BR /&gt;
  by USUBJID;&lt;BR /&gt;
run;  &lt;BR /&gt;
data miss;&lt;BR /&gt;
  set freq;&lt;BR /&gt;
  miss=2-count;&lt;BR /&gt;
run;&lt;BR /&gt;
proc transpose data=miss out=M prefix=M;&lt;BR /&gt;
  var miss;&lt;BR /&gt;
  by USUBJID;&lt;BR /&gt;
run;&lt;BR /&gt;
proc transpose data=miss out=D prefix=D;&lt;BR /&gt;
  var EXDT;&lt;BR /&gt;
  by USUBJID;&lt;BR /&gt;
run;&lt;BR /&gt;
data tr;&lt;BR /&gt;
  merge d m;&lt;BR /&gt;
  by USUBJID;&lt;BR /&gt;
run;&lt;BR /&gt;
data r;&lt;BR /&gt;
  set tr;&lt;BR /&gt;
  array d d:;&lt;BR /&gt;
  array m m:;&lt;BR /&gt;
  if DIM(d) &amp;gt; 1 then do; &lt;BR /&gt;
    do i=2 to DIM(d);&lt;BR /&gt;
      if      2 &amp;lt;= SUM(d[i],-d[i-1]) then output;&lt;BR /&gt;
      else if 1  = SUM(d[i],-d[i-1]) then do;&lt;BR /&gt;
        if 4 &amp;lt;= 2+SUM(m[i],m[i-1]) then output; &lt;BR /&gt;
      end;&lt;BR /&gt;
    end;&lt;BR /&gt;
  end;&lt;BR /&gt;
  keep USUBJID D:; &lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
SPR</description>
    <pubDate>Mon, 20 Dec 2010 22:36:25 GMT</pubDate>
    <dc:creator>SPR</dc:creator>
    <dc:date>2010-12-20T22:36:25Z</dc:date>
    <item>
      <title>Identify Subjects missing 4 or more consecutive doses</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/Identify-Subjects-missing-4-or-more-consecutive-doses/m-p/53044#M1430</link>
      <description>I have a situation where subject is receiving  drug twice a day. I have to identify subjects missing 4 or more consecutive doses.  I am using the following code - where USUBJID is subject number and EXDT is date. However with d &amp;gt;= 2 it is listing even if the subject missses 2 doses on the same day. IF I use d &amp;gt;2 it does not list subjects if 4 consecutive doses are missed in 3 days. Any suggestions are appreciated &lt;BR /&gt;
&lt;BR /&gt;
Thanks in advance.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
data miss2;&lt;BR /&gt;
   f=0;&lt;BR /&gt;
  do until(last.USUBJID);&lt;BR /&gt;
     set EX_BID;&lt;BR /&gt;
	 by USUBJID;&lt;BR /&gt;
  d = ifn(not first.USUBJID,dif(EXDT),0);  &lt;BR /&gt;
&lt;BR /&gt;
  if d ge 2 then do;  &lt;BR /&gt;
  output;   &lt;BR /&gt;
 &lt;BR /&gt;
 f=1;&lt;BR /&gt;
end;     &lt;BR /&gt;
end;   &lt;BR /&gt;
run;</description>
      <pubDate>Mon, 20 Dec 2010 20:25:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/Identify-Subjects-missing-4-or-more-consecutive-doses/m-p/53044#M1430</guid>
      <dc:creator>madhu</dc:creator>
      <dc:date>2010-12-20T20:25:41Z</dc:date>
    </item>
    <item>
      <title>Re: Identify Subjects missing 4 or more consecutive doses</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/Identify-Subjects-missing-4-or-more-consecutive-doses/m-p/53045#M1431</link>
      <description>Hello Madhu,&lt;BR /&gt;
&lt;BR /&gt;
This could be a solution to your problem:&lt;BR /&gt;
[pre]&lt;BR /&gt;
proc freq data=EX_BID noprint;&lt;BR /&gt;
  tables EXDT/nopct out=freq(where=(Count &amp;lt;= 2));&lt;BR /&gt;
  by USUBJID;&lt;BR /&gt;
run;  &lt;BR /&gt;
[/pre]&lt;BR /&gt;
Sincerely,&lt;BR /&gt;
SPR</description>
      <pubDate>Mon, 20 Dec 2010 21:47:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/Identify-Subjects-missing-4-or-more-consecutive-doses/m-p/53045#M1431</guid>
      <dc:creator>SPR</dc:creator>
      <dc:date>2010-12-20T21:47:44Z</dc:date>
    </item>
    <item>
      <title>Re: Identify Subjects missing 4 or more consecutive doses</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/Identify-Subjects-missing-4-or-more-consecutive-doses/m-p/53046#M1432</link>
      <description>Sorry, it looks like I did not understand your problem. So, the above code is only a part of the solution. Please submit a sample of your data then it will be easier to get into a solution. This is my second attempt:&lt;BR /&gt;
[pre]&lt;BR /&gt;
proc freq data=EX_BID noprint;&lt;BR /&gt;
  tables EXDT/out=freq (where=(Count &amp;lt; 2));&lt;BR /&gt;
  by USUBJID;&lt;BR /&gt;
run;  &lt;BR /&gt;
data miss;&lt;BR /&gt;
  set freq;&lt;BR /&gt;
  miss=2-count;&lt;BR /&gt;
run;&lt;BR /&gt;
proc transpose data=miss out=M prefix=M;&lt;BR /&gt;
  var miss;&lt;BR /&gt;
  by USUBJID;&lt;BR /&gt;
run;&lt;BR /&gt;
proc transpose data=miss out=D prefix=D;&lt;BR /&gt;
  var EXDT;&lt;BR /&gt;
  by USUBJID;&lt;BR /&gt;
run;&lt;BR /&gt;
data tr;&lt;BR /&gt;
  merge d m;&lt;BR /&gt;
  by USUBJID;&lt;BR /&gt;
run;&lt;BR /&gt;
data r;&lt;BR /&gt;
  set tr;&lt;BR /&gt;
  array d d:;&lt;BR /&gt;
  array m m:;&lt;BR /&gt;
  if DIM(d) &amp;gt; 1 then do; &lt;BR /&gt;
    do i=2 to DIM(d);&lt;BR /&gt;
      if      2 &amp;lt;= SUM(d[i],-d[i-1]) then output;&lt;BR /&gt;
      else if 1  = SUM(d[i],-d[i-1]) then do;&lt;BR /&gt;
        if 4 &amp;lt;= 2+SUM(m[i],m[i-1]) then output; &lt;BR /&gt;
      end;&lt;BR /&gt;
    end;&lt;BR /&gt;
  end;&lt;BR /&gt;
  keep USUBJID D:; &lt;BR /&gt;
run;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
SPR</description>
      <pubDate>Mon, 20 Dec 2010 22:36:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/Identify-Subjects-missing-4-or-more-consecutive-doses/m-p/53046#M1432</guid>
      <dc:creator>SPR</dc:creator>
      <dc:date>2010-12-20T22:36:25Z</dc:date>
    </item>
  </channel>
</rss>

