Date: Fri, 21 Dec 2007 14:49:18 -0600
Reply-To: Mary <mlhoward@avalon.net>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Mary <mlhoward@AVALON.NET>
Subject: Re: challenge in data step
Content-Type: text/plain; charset="iso-8859-1"
People rarely say thanks; it is very nice to hear it. Have a great Christmas, and may all your analysis be significant....
-Mary
----- Original Message -----
From: Suhong Tong
To: SAS-L@LISTSERV.UGA.EDU
Sent: Friday, December 21, 2007 2:04 PM
Subject: Re: challenge in data step
Hi Yu,
Thank you very much for your question, not only it leads me found the cases you
listed below, but also leads to more complicated data issue. I need more
home work to do before I come back again.
Unfortunately I am always the only analyst in my job(s), fortunately I always
get support from talented SAS-L people, no words can express how much I
appreciate each of you who have offered hands to me.
Please allow me borrow this space (so not to add additional email traffic to
the list) to wish all the listers
Have a great holiday season and a prosper 2008.
Sophia
Date: Thu, 20 Dec 2007 10:21:28 -0600
From: zhangyu05@gmail.com
To: sophiDT@hotmail.com
Subject: Re: challenge in data step
Does your data has case like this:
2 1 1 1 6/27/2002 7/8/2000
2 2 2 2 7/8/2003 7/18/2005
2 3 3 3 7/18/2005 4/8/2006
.....
or more than 2 consecutive enrollment.
if you have case like this, how you are going to code flag variable?
Yu
On Dec 20, 2007 9:34 AM, Sophia Tong <sophiDT@hotmail.com> wrote:
Dear list,
I have a challenge in data step and it is my weak spot in programming.
I need to flag patients with consecutive program enrollment, meaning that
the program starting date is the same as previous program ending date. I
have no problem to flag it, however, the investigator ask to code the
previous one as 1 and the following one as 2, I have no problem to code them
if a patient only have 2 enrollment. The challenge to me is to differentiate
the program that not related to these 2 consecutive enrollment.
Below are the sample data I made up to represent the difficult cases I have
and the results I want:
ID PR PEP PP SDATE EDATE
1 1 1 1 12/20/2002 4/21/2005
1 2 2 2 4/21/2005 7/12/2005
1 2 2 3 12/16/2005 4/12/2006
2 1 1 1 6/27/2002 7/8/2000
2 2 2 2 1/13/2003 7/18/2005
2 3 3 3 7/18/2005 4/8/2006
2 4 4 4 8/23/2006 3/10/2007
2 5 5 5 3/10/2007 3/27/2007
ID PR PEP PP SDATE EDATE PGMSTART PGM_FLG
1 1 1 1 12/20/2002 4/21/2005 0 1
1 2 2 2 4/21/2005 7/12/2005 1 2
1 2 2 3 12/16/2005 4/12/2006 0 0
2 1 1 1 6/27/2002 7/8/2000 0 0
2 2 2 2 1/13/2003 7/18/2005 0 1
2 3 3 3 7/18/2005 4/8/2006 1 2
2 4 4 4 8/23/2006 3/10/2007 0 1
2 5 5 5 3/10/2007 3/27/2007 1 2
I got PGMSTART coded right, but have problem with PGM_FLG. Please help.
Thanks in advance.
Sophia
_________________________________________________________________
Get the power of Windows + Web with the new Windows Live.
http://www.windowslive.com?ocid=TXT_TAGHM_Wave2_powerofwindows_122007=