<?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: Select rows based on the predefined amount of time since the last eligible data by group in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Select-rows-based-on-the-predefined-amount-of-time-since-the/m-p/539591#M148705</link>
    <description>This is great. Thanks Novinosrin.</description>
    <pubDate>Fri, 01 Mar 2019 11:59:22 GMT</pubDate>
    <dc:creator>Cruise</dc:creator>
    <dc:date>2019-03-01T11:59:22Z</dc:date>
    <item>
      <title>Select rows based on the predefined amount of time since the last eligible data by group</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Select-rows-based-on-the-predefined-amount-of-time-since-the/m-p/539498#M148663</link>
      <description>&lt;P&gt;Hi Folks,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm trying to create a data of patients who fulfills the following criteria:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;TABLE width="411"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="72"&gt;Keep&lt;/TD&gt;
&lt;TD width="339"&gt;IF: First observation of the patient&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;Delete&lt;/TD&gt;
&lt;TD&gt;IF: Less than 12 mo since the last eligible data by patients&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In other words:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="wanted for 12 mo spaced data.png" style="width: 600px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/27594i4C8DE3ACFA3EF69E/image-size/large?v=v2&amp;amp;px=999" role="button" title="wanted for 12 mo spaced data.png" alt="wanted for 12 mo spaced data.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The observation needs to be compared to the last eligible data. For instance, for the second subject (PAT_ID=2), third row is eligible because time passed since the last eligible observation is longer than 12 mo. The last eligible observation is the first row. Because second row was deleted due to its ineligibility.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;DATA HAVE; 
INPUT PAT_ID DATE_VISITS DIFF_VISITS;
CARDS;
1	15391	.
1	15573	5.98
1	15945	12.22
2	15406	.
2	15586	5.92
2	15798	6.96
3	15775	.
3	16139	11.96
3	16321	5.98
4	15439	.
4	15621	5.97
4	16349	23.92
5	15438	.
5	15655	7.13
5	16019	11.96
6	15349	.
6	15558	6.87
6	15768	6.9
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you wonder why do this?&lt;/P&gt;
&lt;P&gt;The biological marker concerned here is not highly dynamic over time. Therefore, you would not want to make a premature decision based on the observations captured over less than 12 months in between at least.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Feb 2019 21:54:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Select-rows-based-on-the-predefined-amount-of-time-since-the/m-p/539498#M148663</guid>
      <dc:creator>Cruise</dc:creator>
      <dc:date>2019-02-28T21:54:17Z</dc:date>
    </item>
    <item>
      <title>Re: Select rows based on the predefined amount of time since the last eligible data by group</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Select-rows-based-on-the-predefined-amount-of-time-since-the/m-p/539509#M148669</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;
DATA HAVE; 
INPUT PAT_ID DATE_VISITS DIFF_VISITS;
format DATE_VISITS date9.;
CARDS;
1	15391	.
1	15573	5.98
1	15945	12.22
2	15406	.
2	15586	5.92
2	15798	6.96
3	15775	.
3	16139	11.96
3	16321	5.98
4	15439	.
4	15621	5.97
4	16349	23.92
5	15438	.
5	15655	7.13
5	16019	11.96
6	15349	.
6	15558	6.87
6	15768	6.9
;

data want;
set have;
by PAT_ID;
retain d;
if first.pat_id then do;output; d=DATE_VISITS;end;
else do;
	dif=intck('month',d,DATE_VISITS);
	if dif&amp;gt;=12 then do;output;d=DATE_VISITS;end;
end;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 28 Feb 2019 22:28:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Select-rows-based-on-the-predefined-amount-of-time-since-the/m-p/539509#M148669</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-02-28T22:28:42Z</dc:date>
    </item>
    <item>
      <title>Re: Select rows based on the predefined amount of time since the last eligible data by group</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Select-rows-based-on-the-predefined-amount-of-time-since-the/m-p/539510#M148670</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/132289"&gt;@Cruise&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Add the&amp;nbsp; drop statement&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;drop d dif&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;to the previous&lt;/P&gt;</description>
      <pubDate>Thu, 28 Feb 2019 22:32:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Select-rows-based-on-the-predefined-amount-of-time-since-the/m-p/539510#M148670</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-02-28T22:32:18Z</dc:date>
    </item>
    <item>
      <title>Re: Select rows based on the predefined amount of time since the last eligible data by group</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Select-rows-based-on-the-predefined-amount-of-time-since-the/m-p/539591#M148705</link>
      <description>This is great. Thanks Novinosrin.</description>
      <pubDate>Fri, 01 Mar 2019 11:59:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Select-rows-based-on-the-predefined-amount-of-time-since-the/m-p/539591#M148705</guid>
      <dc:creator>Cruise</dc:creator>
      <dc:date>2019-03-01T11:59:22Z</dc:date>
    </item>
    <item>
      <title>Re: Select rows based on the predefined amount of time since the last eligible data by group</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Select-rows-based-on-the-predefined-amount-of-time-since-the/m-p/539617#M148718</link>
      <description>&lt;P&gt;Pleasure is mine:)&lt;/P&gt;</description>
      <pubDate>Fri, 01 Mar 2019 13:56:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Select-rows-based-on-the-predefined-amount-of-time-since-the/m-p/539617#M148718</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2019-03-01T13:56:25Z</dc:date>
    </item>
  </channel>
</rss>

