Date: Fri, 19 Apr 2002 13:04:57 +1000
Reply-To: Jian Wu <jw55@UOW.EDU.AU>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Jian Wu <jw55@UOW.EDU.AU>
Subject: select certain record from a data set
Content-Type: text/plain; charset=iso-8859-1
Hi,
I have a data set like the following:
id followup diag
1 1 a
1 2
1 3 e
1 4 r
2 1
2 2
2 3
3 1
3 2 e
3 3
4 1 r
Each id has various follow up times, and some values for diag are
missing.
I'd like to extract a new data set from the above data set. The new
data set should have the following features:
* each id has only one record in the new data set.
* the record with the first nonmissing value (according to followup)
for diag will be extratced.
* if all values for diag are missing for one id, then the last record
(according to followup) will be extracted.
The new data set should read like:
id followup diag
1 1 a
2 2
3 2 e
4 1 r
Any code suggestion? Your help is appreciated.
Regards
Jian