On Wed, 25 Jul 2007 09:42:21 +0200, Robert Bardos <bardos2@ANSYS.CH> wrote:
>> Betreff: Re: Truncate dataset at specified value for field in
>> longitudinal data
>>
>> Hi there; was wondering if anyone could help?
>> thanks
>> Shuaib
>Well, I did recall correctly and you did receive an answer from Arild
>on Monday, July 23, which seemed to make perfectly sense.
Well thanks, but reviewing it I see it was part sense part rubbish :-)
I blame the coffee. The error was the newFollowupTime, which of course is
set to max for all kids.. tested on *two* kids i suggest:
data children;
input Number feed1 dayNo followuptime
(childDoB childeventdate)(:date9.) childevent;
format childDoB childeventdate date9.;
cards;
105011 0 1 23 20MAY2002 12JUN02 72
105011 0 2 23 20MAY2002 12JUN02 72
105011 0 3 23 20MAY2002 12JUN02 72
105011 0 4 23 20MAY2002 12JUN02 72
105011 . 5 23 20MAY2002 12JUN02 72
105011 . 6 23 20MAY2002 12JUN02 72
105011 0 7 23 20MAY2002 12JUN02 72
105011 0 8 23 20MAY2002 12JUN02 72
105011 . 9 23 20MAY2002 12JUN02 72
105011 . 10 23 20MAY2002 12JUN02 72
105011 . 11 23 20MAY2002 12JUN02 72
105011 . 12 23 20MAY2002 12JUN02 72
105011 . 13 23 20MAY2002 12JUN02 72
105011 . 14 23 20MAY2002 12JUN02 72
105011 . 15 23 20MAY2002 12JUN02 72
105011 . 16 23 20MAY2002 12JUN02 72
105011 . 17 23 20MAY2002 12JUN02 72
105011 . 18 23 20MAY2002 12JUN02 72
105011 . 19 23 20MAY2002 12JUN02 72
105011 . 20 23 20MAY2002 12JUN02 72
105011 . 21 23 20MAY2002 12JUN02 72
105011 . 22 23 20MAY2002 12JUN02 72
105011 . 23 23 20MAY2002 12JUN02 72
105012 0 1 23 20MAY2002 12JUN02 72
105012 0 2 23 20MAY2002 12JUN02 72
105012 0 3 23 20MAY2002 12JUN02 72
105012 0 4 23 20MAY2002 12JUN02 72
105012 . 5 23 20MAY2002 12JUN02 72
105012 . 6 23 20MAY2002 12JUN02 72
105012 0 7 23 20MAY2002 12JUN02 72
105012 0 8 23 20MAY2002 12JUN02 72
105012 0 9 23 20MAY2002 12JUN02 72
105012 0 10 23 20MAY2002 12JUN02 72
105012 0 11 23 20MAY2002 12JUN02 72
105012 0 12 23 20MAY2002 12JUN02 72
105012 0 13 23 20MAY2002 12JUN02 72
105012 . 14 23 20MAY2002 12JUN02 72
105012 . 15 23 20MAY2002 12JUN02 72
105012 . 16 23 20MAY2002 12JUN02 72
105012 . 17 23 20MAY2002 12JUN02 72
105012 . 18 23 20MAY2002 12JUN02 72
105012 . 19 23 20MAY2002 12JUN02 72
105012 . 20 23 20MAY2002 12JUN02 72
105012 . 21 23 20MAY2002 12JUN02 72
105012 . 22 23 20MAY2002 12JUN02 72
105012 . 23 23 20MAY2002 12JUN02 72
;
run;
proc sql;
select *, count(*) as newFollowupTime
from children a
where dayNo <=
(select max(dayNo) from children b
where a.number = b.number
and not missing(b.feed1))
group by number
order by number, dayNo;
quit;
But please double check it :-)
|
|
0
|
|
|
|
Reply
|
sko (123)
|
7/25/2007 8:16:51 AM |
|