```Date: Fri, 28 Oct 2005 17:32:47 -0400 Reply-To: Tony Yang Sender: "SAS(r) Discussion" From: Tony Yang Subject: Re: A complicated data management problem Comments: To: Peter Crawford In-Reply-To: <200510281049.j9SAk0va002617@malibu.cc.uga.edu> Content-Type: text/plain; charset=ISO-8859-1 Thanks much, Peter, and sorry for the confusing question. Let me re-state the question and add one more subject for my question: 1. I want to calculate different time interval based on the IOP value, firstly we fixed the baseline value of IOP for each subject, here corresponding to *1 9/23/1997 0.40* for subject 2. 2. Then we make a difference between the subsequent value and baseline value, if the difference, >=0.2, is first detected, then we calculate the interval between the date between founded IOP and the date for the baseline IOP value, we can set it as INTERVAL1, and the number of visit time can be set as VISIT1; 3. Since we only need the first detection, difference >=0.2, hence for the remaining part of the date variable, we can calculate the interval between last date for the visit(here it is 12/5/2003 for subject 2) and the first date after detection(here it is 5/12/2000 for subject 2), and we can set it as INTERVAL2, and the number of visit for this period is VISIT2. 4. For these subjects that we can not detect the condition >=0.2, then we calculate the total number of visits, and the time interval, and put the corresponding value to INTERVAL1 and INTERVAL2, VISIT1 and VISIST2 simutaneously. Therefore, the final output can take this form(I put the concrete date for length calculation, actually it should be a number, please do not be misled) id n1 length1 n2 length2 1 5 4/26/1999-9/23/1997 5 2/5/2003-5/12/2000 2 9 1/11/2005-12/8/1993 9 1/11/2005-12/8/1993 data er; input id date mmddyy10. IOP; format date mmddyy10.; cards; 1 12/8/1993 0.50 1 1/19/1999 0.45 1 2/16/1999 0.60 1 8/24/2000 0.40 1 2/12/2002 0.45 1 1/22/2003 0.45 1 7/23/2003 0.50 1 1/21/2004 0.40 1 1/11/2005 0.45 2 9/23/1997 0.40 2 12/17/1997 0.45 2 6/4/1998 0.50 2 10/12/1998 0.30 2 4/26/1999 0.65 2 5/12/2000 0.60 2 6/15/2001 0.60 2 2/5/2002 0.30 2 6/18/2002 0.30 2 2/5/2003 0.35 ; proc print data=er; run; BTW, this is a Glaucoma medical record data. Thanks much for your suggestions. Have a nice weekend to you all! Best regards, Tony ```

Back to: Top of message | Previous page | Main SAS-L page