Dear All,
I have 2 data frames, in dataframe 1 each patient is contained in one row,
defined by a unique patient id and a follow-up date; in data set 2, there
are multiple rows for the same patient with different labdates and
labresults (CD4), e.g.
Dataframe 1
id fupdate
1 01/02/2003
2 03/02/2003
3 05/03/2003
4 06/04/2003
Datafram 2
id labdate CD4
1 date1 200
1 date2 150
1 etc. 300
1
2
2
2
2
2
3
3
3
4
4
4
4
I would like to include for each patient as an additional column in
Dataframe 1 that single labdate (inlcuding the corresponding CD4 count and
other potential variables in the same row) of Dataframe 2 which is closest
(within three months difference) to the fupdate in Dataframe 1.
Any hints how to do this in s-plus is greatly appreciated.
Thanks in advance,
Pedram
Pedram Sendi, MD, DSc
Institute for Clinical Epidemiology & Division of Infectious Diseases
Institut fur klinische Epidemiologie & Abteilung fur Infektiologie
Basel University Hospital
Kantonsspital Basel
Hebelstrasse 10, 3rd Floor
CH-4031 Basel
Switzerland
Phone: +41 61 265 31 02
Fax: +41 61 265 31 09
E-Mail: psendi@uhbs.ch
|