Date: Sun, 23 Nov 2003 22:32:57 -0500
Reply-To: "Richard A. DeVenezia" <radevenz@IX.NETCOM.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Richard A. DeVenezia" <radevenz@IX.NETCOM.COM>
Subject: Re: making an event history data
"praxis" <praxis6887@yahoo.com> wrote in message
news:bprjv7$4oi$1@geraldo.cc.utexas.edu...
> Hello,
>
> I want to build a event history type of data using this data set.
>
> id sid wave dv iv1
> 1 1 1 0 1
> 2 1 2 1 1
> 3 1 3 0 1
> 4 2 1 0 2
> 5 2 2 0 1
> 6 2 3 1 1
> 7 3 1 1 1
> 8 3 2 1 2
> 9 3 3 0 1
>
> Even though each of three individuals has data from 3 waves, I need to
take
> such cases as "id" 3, 8, and 9 out of this data set because these cases
were
> observed after the "event" was occurred (i.e., dv= 1). It would be nice if
> there is a way to control or use case number into the code, but I don't
> know. Please help.
>
> Thanks in advance.
> Jinseok
>
There are several techniques, some requiring retain, some not.
Presuming the observations of a sid group are always in adjacent rows.
Here is one requiring retain.
data filtered / view=filtered;
set wave_events;
by sid;
retain event_occurred;
drop event_occurred;
if first.sid then event_occurred = 0;
if not event_occurred; * subsetting if;
if dv ^= 0 then event_occurred = 1;
* implicit output;
run;
--
Richard A. DeVenezia
http://www.devenezia.com
|