I have been unable to figure-out how to combine a number of different
data sets (7) of which 5 have dates for time varying covariates. I can
append all of the data sets together, but then I have struggled with how to
fill-in, in the correct order, the appropriate values. All values, including
dates, are numerical.
Is there a good method for merging these data into one format (see the “desired”
table below)?
Current Data Set 1:
ID Age Sex
1 25 0
2 27 0
3 27 1
Current Data Set 2:
ID Start End
1 Jan 1, 2001 July 1, 2003
1 July 1, 2003 July 31, 2005
2 March 2, 1997
3 Jan 1, 1998 December 31, 2001
3 Jan 1, 2002 December 1, 2006
Current Data Set 3:
ID Review Date Rating
1 April 1, 2001 100
1 April 1, 2002 90
1 April 1, 2003 100
1 April 1, 2004 95
1 April 1, 2005 110
2 March 2, 1998 95
2 March 2, 1999 95
2 March 2, 2000 100
.
.
3 Jan 1, 1999 120
3 Jan 1, 2000 110
3 Jan 1, 2001 115
Desired Format:
ID Age Sex T0 T1 Rating
1 25 0 Jan 1, 2001 April 1, 2001 100
1 25 0 April 1, 2001 April 1, 2002 90
1 25 0 April 1, 2002 April 1, 2003 100
1 25 0 April 1, 2003 July 1, 2003 100
1 25 0 July 1, 200 3 April 1, 2004 95
1 25 0 April 1, 2004 April 1, 2005 110
1 25 0 April
1, 2005 July 31, 2005 110
Thank you for your help.
Anthony Nyberg
PhD Candidate
University of Wisconsin, Madison