<?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 qualified records dynamically based on some criteria in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Select-qualified-records-dynamically-based-on-some-criteria/m-p/29362#M6885</link>
    <description>Figured it out. But looking for a better solution.&lt;BR /&gt;
&lt;BR /&gt;
DATA admission;&lt;BR /&gt;
	informat admission_date mmddyy10.;&lt;BR /&gt;
	format  admission_date mmddyy10.;&lt;BR /&gt;
   	INPUT Patient admission_date Admssion_count ; &lt;BR /&gt;
   	DATALINES; &lt;BR /&gt;
1 1/5/2006 1&lt;BR /&gt;
1 2/9/2006 2&lt;BR /&gt;
1 8/14/2006 3&lt;BR /&gt;
2 8/19/2006 1&lt;BR /&gt;
2 12/28/2006 2&lt;BR /&gt;
2 9/11/2007 3&lt;BR /&gt;
2 11/9/2007 4&lt;BR /&gt;
2 11/21/2008 5&lt;BR /&gt;
3 1/2/2006 1&lt;BR /&gt;
3 5/18/2006 2&lt;BR /&gt;
3 3/9/2007 3&lt;BR /&gt;
3 6/29/2007 4&lt;BR /&gt;
3 12/26/2007 5&lt;BR /&gt;
3 2/9/2008 6&lt;BR /&gt;
; &lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
data admission1;&lt;BR /&gt;
	set admission;&lt;BR /&gt;
	by Patient;&lt;BR /&gt;
	Index_adm = lag2(admission_date);&lt;BR /&gt;
	if Admssion_count in (1, 2) then Index_adm = . ;&lt;BR /&gt;
	format Index_adm mmddyy10.;&lt;BR /&gt;
	if (admission_date - Index_adm) ge 1 and (admission_date - Index_adm) le 365 then output;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
data admission2;&lt;BR /&gt;
	set admission1;&lt;BR /&gt;
	by Patient;&lt;BR /&gt;
	if first.Patient; &lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
proc sql;&lt;BR /&gt;
	create table admission3 as&lt;BR /&gt;
	select a.* &lt;BR /&gt;
	from admission a right join admission2 b&lt;BR /&gt;
	on a.Patient = b.Patient and&lt;BR /&gt;
		  a.admission_date between b.Index_adm and b.admission_date&lt;BR /&gt;
	order by Patient, Admssion_count;&lt;BR /&gt;
quit;</description>
    <pubDate>Mon, 31 May 2010 18:29:55 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2010-05-31T18:29:55Z</dc:date>
    <item>
      <title>Select qualified records dynamically based on some criteria</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Select-qualified-records-dynamically-based-on-some-criteria/m-p/29357#M6880</link>
      <description>Hi, &lt;BR /&gt;
&lt;BR /&gt;
I have a patient admission dataset. Each patient had multiple admissions (total number of admission are different from patient to patient and time interval between two admissions also varies). &lt;BR /&gt;
&lt;BR /&gt;
This is what I am trying to do:&lt;BR /&gt;
&lt;BR /&gt;
1, select those patients who had more than 3 admissions within 1 year block. &lt;BR /&gt;
2. For qualified patient, flag their admissions in that year and the qaulifed 1st admission date as an index admission.&lt;BR /&gt;
&lt;BR /&gt;
Admission dataset&lt;BR /&gt;
&lt;BR /&gt;
Patient  Admission_date   Admssion_count&lt;BR /&gt;
1           1/5/2006                   	1&lt;BR /&gt;
1           2/9/2006                   	2&lt;BR /&gt;
1           8/14/2006                 	3&lt;BR /&gt;
2           8/19/2006                 	1&lt;BR /&gt;
2           12/28/2006		        2&lt;BR /&gt;
2            9/11/2007		        3&lt;BR /&gt;
2            1/9/2007		        4&lt;BR /&gt;
2            11/21/2008		        5&lt;BR /&gt;
3           1/2/2006		        1&lt;BR /&gt;
3           5/18/2006		        2&lt;BR /&gt;
3           3/9/2007		        3&lt;BR /&gt;
3           6/29/2007		        4&lt;BR /&gt;
3           12/26/2007		        5&lt;BR /&gt;
3           2/9/2008		        6&lt;BR /&gt;
&lt;BR /&gt;
I need code to produce the following dataset:&lt;BR /&gt;
&lt;BR /&gt;
patient   Admission_date index_adm Admission_count&lt;BR /&gt;
1           1/5/2006          1/5/2006  	1&lt;BR /&gt;
1           2/9/2006          1/5/2006		2&lt;BR /&gt;
1           8/14/2006         1/5/2006	3&lt;BR /&gt;
3           3/9/2007           3/9/2007	3		&lt;BR /&gt;
3           6/29/2007	    3/9/2007	4&lt;BR /&gt;
3           12/26/2007	    3/9/2007	5&lt;BR /&gt;
&lt;BR /&gt;
Patient 1 is selected because 3 admissions incurred within one year. Although Patient 3 had 6 admissions, only admission 3, 4 and 5 incurred within one year so only these records are selected. Patient 2 won't select because none of 3 admissions incurred within one year.&lt;BR /&gt;
&lt;BR /&gt;
Any help are highly appreciated!&lt;BR /&gt;
Frank</description>
      <pubDate>Sun, 30 May 2010 23:01:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Select-qualified-records-dynamically-based-on-some-criteria/m-p/29357#M6880</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-05-30T23:01:38Z</dc:date>
    </item>
    <item>
      <title>Re: Select qualified records dynamically based on some criteria</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Select-qualified-records-dynamically-based-on-some-criteria/m-p/29358#M6881</link>
      <description>Hi:&lt;BR /&gt;
  Is there a chance that the data will be "bad"?? For example, look at patient #2's data:&lt;BR /&gt;
[pre]&lt;BR /&gt;
2 8/19/2006 1&lt;BR /&gt;
2 12/28/2006 2&lt;BR /&gt;
2 9/11/2007 3&lt;BR /&gt;
2 1/9/2007 4&lt;BR /&gt;
2 11/21/2008 5&lt;BR /&gt;
[/pre]&lt;BR /&gt;
              &lt;BR /&gt;
Admission count #3 is 9/11/2007, but admission count #4 is 1/9/2007 (before #3). So does the data need to be "scrubbed" first to make sure that the dates in the file are in the right order, regardless of admission_count value???&lt;BR /&gt;
 &lt;BR /&gt;
cynthia</description>
      <pubDate>Sun, 30 May 2010 23:10:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Select-qualified-records-dynamically-based-on-some-criteria/m-p/29358#M6881</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2010-05-30T23:10:47Z</dc:date>
    </item>
    <item>
      <title>Re: Select qualified records dynamically based on some criteria</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Select-qualified-records-dynamically-based-on-some-criteria/m-p/29359#M6882</link>
      <description>Hi.&lt;BR /&gt;
I agree with Cynthia .&lt;BR /&gt;
&lt;BR /&gt;
The date of fourth admission is 1/9/2007  for number 2 patient.&lt;BR /&gt;
However,The date of third admission is 9/11/2007. &lt;BR /&gt;
The third admission is late to the fourth admission. Is it right?</description>
      <pubDate>Mon, 31 May 2010 02:17:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Select-qualified-records-dynamically-based-on-some-criteria/m-p/29359#M6882</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2010-05-31T02:17:12Z</dc:date>
    </item>
    <item>
      <title>Re: Select qualified records dynamically based on some criteria</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Select-qualified-records-dynamically-based-on-some-criteria/m-p/29360#M6883</link>
      <description>Hi Cynthia and Ksharp,&lt;BR /&gt;
&lt;BR /&gt;
Both of you are correct. Admission #4 should be 11/9/2007. Sorry about Typo and confusion it has caused.&lt;BR /&gt;
&lt;BR /&gt;
Thank so much!&lt;BR /&gt;
&lt;BR /&gt;
Frank</description>
      <pubDate>Mon, 31 May 2010 03:25:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Select-qualified-records-dynamically-based-on-some-criteria/m-p/29360#M6883</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-05-31T03:25:52Z</dc:date>
    </item>
    <item>
      <title>Re: Select qualified records dynamically based on some criteria</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Select-qualified-records-dynamically-based-on-some-criteria/m-p/29361#M6884</link>
      <description>Figured it out by using lag2 function. Wondering if there is a better solution.&lt;BR /&gt;
DATA admission;&lt;BR /&gt;
	informat admission_date mmddyy10.;&lt;BR /&gt;
	format  admission_date mmddyy10.;&lt;BR /&gt;
   	INPUT Patient admission_date Admssion_count ; &lt;BR /&gt;
   	DATALINES; &lt;BR /&gt;
1 1/5/2006 1&lt;BR /&gt;
1 2/9/2006 2&lt;BR /&gt;
1 8/14/2006 3&lt;BR /&gt;
2 8/19/2006 1&lt;BR /&gt;
2 12/28/2006 2&lt;BR /&gt;
2 9/11/2007 3&lt;BR /&gt;
2 11/9/2007 4&lt;BR /&gt;
2 11/21/2008 5&lt;BR /&gt;
3 1/2/2006 1&lt;BR /&gt;
3 5/18/2006 2&lt;BR /&gt;
3 3/9/2007 3&lt;BR /&gt;
3 6/29/2007 4&lt;BR /&gt;
3 12/26/2007 5&lt;BR /&gt;
3 2/9/2008 6&lt;BR /&gt;
; &lt;BR /&gt;
run;&lt;BR /&gt;
data admission1;&lt;BR /&gt;
	set admission;&lt;BR /&gt;
	by Patient;&lt;BR /&gt;
	Index_adm = lag2(admission_date);&lt;BR /&gt;
	if Admssion_count in (1, 2) then Index_adm = . ;&lt;BR /&gt;
	format Index_adm mmddyy10.;&lt;BR /&gt;
	if 1 &amp;lt;= admission_date - Index_adm &amp;lt;=365 then output;&lt;BR /&gt;
run;&lt;BR /&gt;
data admission2;&lt;BR /&gt;
	set admission1;&lt;BR /&gt;
	by Patient;&lt;BR /&gt;
	if first.Patient; &lt;BR /&gt;
run;&lt;BR /&gt;
proc sql;&lt;BR /&gt;
	create table admission3 as&lt;BR /&gt;
	select a.* &lt;BR /&gt;
	from admission a right join admission2 b&lt;BR /&gt;
	on a.Patient = b.Patient and  a.admission_date between b.Index_adm and b.admission_date&lt;BR /&gt;
	order by Patient, Admssion_count;&lt;BR /&gt;
quit;</description>
      <pubDate>Mon, 31 May 2010 18:04:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Select-qualified-records-dynamically-based-on-some-criteria/m-p/29361#M6884</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-05-31T18:04:11Z</dc:date>
    </item>
    <item>
      <title>Re: Select qualified records dynamically based on some criteria</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Select-qualified-records-dynamically-based-on-some-criteria/m-p/29362#M6885</link>
      <description>Figured it out. But looking for a better solution.&lt;BR /&gt;
&lt;BR /&gt;
DATA admission;&lt;BR /&gt;
	informat admission_date mmddyy10.;&lt;BR /&gt;
	format  admission_date mmddyy10.;&lt;BR /&gt;
   	INPUT Patient admission_date Admssion_count ; &lt;BR /&gt;
   	DATALINES; &lt;BR /&gt;
1 1/5/2006 1&lt;BR /&gt;
1 2/9/2006 2&lt;BR /&gt;
1 8/14/2006 3&lt;BR /&gt;
2 8/19/2006 1&lt;BR /&gt;
2 12/28/2006 2&lt;BR /&gt;
2 9/11/2007 3&lt;BR /&gt;
2 11/9/2007 4&lt;BR /&gt;
2 11/21/2008 5&lt;BR /&gt;
3 1/2/2006 1&lt;BR /&gt;
3 5/18/2006 2&lt;BR /&gt;
3 3/9/2007 3&lt;BR /&gt;
3 6/29/2007 4&lt;BR /&gt;
3 12/26/2007 5&lt;BR /&gt;
3 2/9/2008 6&lt;BR /&gt;
; &lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
data admission1;&lt;BR /&gt;
	set admission;&lt;BR /&gt;
	by Patient;&lt;BR /&gt;
	Index_adm = lag2(admission_date);&lt;BR /&gt;
	if Admssion_count in (1, 2) then Index_adm = . ;&lt;BR /&gt;
	format Index_adm mmddyy10.;&lt;BR /&gt;
	if (admission_date - Index_adm) ge 1 and (admission_date - Index_adm) le 365 then output;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
data admission2;&lt;BR /&gt;
	set admission1;&lt;BR /&gt;
	by Patient;&lt;BR /&gt;
	if first.Patient; &lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
proc sql;&lt;BR /&gt;
	create table admission3 as&lt;BR /&gt;
	select a.* &lt;BR /&gt;
	from admission a right join admission2 b&lt;BR /&gt;
	on a.Patient = b.Patient and&lt;BR /&gt;
		  a.admission_date between b.Index_adm and b.admission_date&lt;BR /&gt;
	order by Patient, Admssion_count;&lt;BR /&gt;
quit;</description>
      <pubDate>Mon, 31 May 2010 18:29:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Select-qualified-records-dynamically-based-on-some-criteria/m-p/29362#M6885</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-05-31T18:29:55Z</dc:date>
    </item>
    <item>
      <title>Re: Select qualified records dynamically based on some criteria</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Select-qualified-records-dynamically-based-on-some-criteria/m-p/29363#M6886</link>
      <description>if you allow "year blocks" to overlap, the situation becomes complex. Consider the following admission dates for one patient:&lt;BR /&gt;
   march 07, september 07, october 07, January 08 &lt;BR /&gt;
The pair of admissions in Sept-07 and Oct-07 may be within "year blocks" starting Mar-07 and/or Sep-07. Is this restricted? On what basis?&lt;BR /&gt;
What if the dates sequence places the 4th closer to the 3rd than the 2nd is to the first. E.G. Jan-07, Nov-07, Dec-07, Jan-08 &lt;BR /&gt;
In that case Nov-07 to Jan-08 looks more of an episode than Jan-07 to Dec-07.&lt;BR /&gt;
If you want "&lt;B&gt;every year block including 3 admissions&lt;/B&gt;", then that will involve overlapping blocks. Is that required? If not, on what basis should there be restriction?&lt;BR /&gt;
My first example included 4 admissions within 12 months. &lt;BR /&gt;
Is that treated as one group? When there are, say 9 admissions within 12 months, is that 3 episodes or one?&lt;BR /&gt;
 &lt;BR /&gt;
sorry to start asking questions when you seem to be close to closure &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;BR /&gt;
 &lt;BR /&gt;
peterC</description>
      <pubDate>Tue, 01 Jun 2010 14:30:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Select-qualified-records-dynamically-based-on-some-criteria/m-p/29363#M6886</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2010-06-01T14:30:36Z</dc:date>
    </item>
    <item>
      <title>Re: Select qualified records dynamically based on some criteria</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Select-qualified-records-dynamically-based-on-some-criteria/m-p/29364#M6887</link>
      <description>Hi,FrankL&lt;BR /&gt;
I think your code has something wrong.&lt;BR /&gt;
Such as ,&lt;BR /&gt;
No, 3 patient should have four obs.&lt;BR /&gt;
3 3/9/2007 3&lt;BR /&gt;
3 6/29/2007 4&lt;BR /&gt;
3 12/26/2007 5&lt;BR /&gt;
3 2/9/2008 6&lt;BR /&gt;
&lt;BR /&gt;
3/9/2007 - 3/9/2008  should be one year .&lt;BR /&gt;
However, your code only have &lt;BR /&gt;
3 3/9/2007 3&lt;BR /&gt;
3 6/29/2007 4&lt;BR /&gt;
3 12/26/2007 5&lt;BR /&gt;
&lt;BR /&gt;
I am not sure whether i understand your mean.</description>
      <pubDate>Tue, 01 Jun 2010 14:54:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Select-qualified-records-dynamically-based-on-some-criteria/m-p/29364#M6887</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2010-06-01T14:54:18Z</dc:date>
    </item>
    <item>
      <title>Re: Select qualified records dynamically based on some criteria</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Select-qualified-records-dynamically-based-on-some-criteria/m-p/29365#M6888</link>
      <description>Hi Peter,&lt;BR /&gt;
&lt;BR /&gt;
The following is my clarification. Thanks for reviewing my posting.&lt;BR /&gt;
&lt;BR /&gt;
The pair of admissions in Sept-07 and Oct-07 may be within "year blocks" starting Mar-07 and/or Sep-07. Is this restricted? On what basis?&lt;BR /&gt;
&lt;BR /&gt;
No, as long as 3 admissions are within 365 days.&lt;BR /&gt;
&lt;BR /&gt;
What if the dates sequence places the 4th closer to the 3rd than the 2nd is to the first. E.G. Jan-07, Nov-07, Dec-07, Jan-08&lt;BR /&gt;
In that case Nov-07 to Jan-08 looks more of an episode than Jan-07 to Dec-07&lt;BR /&gt;
&lt;BR /&gt;
No. In this case, Jan-07, Nov-07, Dec-07 will be selected because it is the 1st episode.&lt;BR /&gt;
&lt;BR /&gt;
My first example included 4 admissions within 12 months.&lt;BR /&gt;
Is that treated as one group? When there are, say 9 admissions within 12 months, is that 3 episodes or one?&lt;BR /&gt;
&lt;BR /&gt;
One episode. One episode is defined as "3 or more admissions within 365 days". &lt;BR /&gt;
&lt;BR /&gt;
Thanks! &lt;BR /&gt;
--Frank</description>
      <pubDate>Thu, 03 Jun 2010 02:08:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Select-qualified-records-dynamically-based-on-some-criteria/m-p/29365#M6888</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-06-03T02:08:38Z</dc:date>
    </item>
    <item>
      <title>Re: Select qualified records dynamically based on some criteria</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Select-qualified-records-dynamically-based-on-some-criteria/m-p/29366#M6889</link>
      <description>Hi Ksharp,&lt;BR /&gt;
&lt;BR /&gt;
You are correct. See below for new code.&lt;BR /&gt;
&lt;BR /&gt;
proc sql;&lt;BR /&gt;
create table admission3 as&lt;BR /&gt;
select a.*&lt;BR /&gt;
from admission a right join admission2 b&lt;BR /&gt;
on a.Patient = b.Patient and&lt;BR /&gt;
a.admission_date between b.Index_adm and (b.Index_adm+365)&lt;BR /&gt;
order by Patient, Admssion_count;&lt;BR /&gt;
quit; &lt;BR /&gt;
&lt;BR /&gt;
Thanks for review it!&lt;BR /&gt;
--Frank</description>
      <pubDate>Thu, 03 Jun 2010 02:33:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Select-qualified-records-dynamically-based-on-some-criteria/m-p/29366#M6889</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2010-06-03T02:33:05Z</dc:date>
    </item>
    <item>
      <title>Re: Select qualified records dynamically based on some criteria</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Select-qualified-records-dynamically-based-on-some-criteria/m-p/29367#M6890</link>
      <description>Hi . Frank&lt;BR /&gt;
I recode it based your sql.&lt;BR /&gt;
I found proc sql's Cartesian Product is very usful...&lt;BR /&gt;
I like sas. I like proc sql very much.&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
DATA admission;&lt;BR /&gt;
informat admission_date mmddyy10.;&lt;BR /&gt;
format admission_date mmddyy10.;&lt;BR /&gt;
INPUT Patient admission_date Admssion_count ;&lt;BR /&gt;
DATALINES;&lt;BR /&gt;
1 1/5/2006 1&lt;BR /&gt;
1 2/9/2006 2&lt;BR /&gt;
1 8/14/2006 3&lt;BR /&gt;
2 8/19/2006 1&lt;BR /&gt;
2 12/28/2006 2&lt;BR /&gt;
2 9/11/2007 3&lt;BR /&gt;
2 11/9/2007 4&lt;BR /&gt;
2 11/21/2008 5&lt;BR /&gt;
3 1/2/2006 1&lt;BR /&gt;
3 5/18/2006 2&lt;BR /&gt;
3 3/9/2007 3&lt;BR /&gt;
3 6/29/2007 4&lt;BR /&gt;
3 12/26/2007 5&lt;BR /&gt;
3 2/9/2008 6&lt;BR /&gt;
;&lt;BR /&gt;
run;&lt;BR /&gt;
&lt;BR /&gt;
proc sql;&lt;BR /&gt;
  select  distinct b.* &lt;BR /&gt;
    from admission as a,admission as b&lt;BR /&gt;
	where a.patient eq b.patient and &lt;BR /&gt;
          (b.admission_date between a.admission_date and a.admission_date+365)&lt;BR /&gt;
	group by  a.admission_date&lt;BR /&gt;
	having count(*) ge 3 &lt;BR /&gt;
	order by b.patient;&lt;BR /&gt;
quit;&lt;BR /&gt;
[/pre]&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
distinct in proc sql can be  optional.&lt;BR /&gt;
Ksharp

Message was edited by: Ksharp</description>
      <pubDate>Thu, 03 Jun 2010 11:22:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Select-qualified-records-dynamically-based-on-some-criteria/m-p/29367#M6890</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2010-06-03T11:22:23Z</dc:date>
    </item>
    <item>
      <title>Re: Select qualified records dynamically based on some criteria</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Select-qualified-records-dynamically-based-on-some-criteria/m-p/29368#M6891</link>
      <description>FrankL&lt;BR /&gt;
&lt;BR /&gt;
thank you for your response ......&lt;BR /&gt;
Where I asked.&lt;BR /&gt;
&amp;gt; ......... When there are, say 9&lt;BR /&gt;
&amp;gt; admissions within 12 months, is that 3 episodes or&lt;BR /&gt;
&amp;gt; one?&lt;BR /&gt;
 &lt;BR /&gt;
You respond&lt;BR /&gt;
&amp;gt; One episode. One episode is defined as "3 or more&lt;BR /&gt;
&amp;gt; admissions within 365 days". &lt;BR /&gt;
&lt;BR /&gt;
Why should monthly visits from January to September not be treated as 7 episodes each episode having 3or more visits and starting on a different start date- ?&lt;BR /&gt;
 Jan - Sep =9 visits&lt;BR /&gt;
Feb - Sep =8 visits&lt;BR /&gt;
Mar - Sep =7 &lt;BR /&gt;
....&lt;BR /&gt;
July - Sep =3 visits&lt;BR /&gt;
 &lt;BR /&gt;
For a less easily dismissed example of a patient with 4 visits:&lt;BR /&gt;
   June, Sept, Mar, July&lt;BR /&gt;
Is this 2 episodes, June-Mar and Sept-July ?&lt;BR /&gt;
Or, once a visit is assigned to an episode, does it become attached to that episode and excluded from other episodes?&lt;BR /&gt;
 &lt;BR /&gt;
Peter</description>
      <pubDate>Thu, 03 Jun 2010 11:50:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Select-qualified-records-dynamically-based-on-some-criteria/m-p/29368#M6891</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2010-06-03T11:50:02Z</dc:date>
    </item>
    <item>
      <title>Re: Select qualified records dynamically based on some criteria</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Select-qualified-records-dynamically-based-on-some-criteria/m-p/29369#M6892</link>
      <description>I check Frank's code too. Find it only can test the first episode having 3or more visits.&lt;BR /&gt;
But I found proc sql'sCasteric Product is very useful..</description>
      <pubDate>Fri, 04 Jun 2010 01:46:47 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Select-qualified-records-dynamically-based-on-some-criteria/m-p/29369#M6892</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2010-06-04T01:46:47Z</dc:date>
    </item>
  </channel>
</rss>

