Supoose that in data set 1, I have for each observation a personid and
his date of birth and date of death.
For example, for persons 1 and 2:
personid dob dod
1 1/1/00 1/1/01
2 5/1/05 8/5/09
In data set 2, I have information on, say, a daily pollution measure
for each day of every year. The (dob, dod) pair of dates in data set 1
is always a subset of the time range in data set 2.
For example, for the month of January in 2000:
time pollution
1/1/00 50
1/2/00 49.5
.
.
.
12/31/10 65
I would like to merge these two data sets. The resulting merged data
set would have, for each person, the pollution level for each day of
life. That is, I'd like the merged data set to look like this:
personid dob dod time pollution
1 1/1/00 1/1/01 1/1/00 50
1 1/1/00 1/1/01 1/2/00 49.5
.
.
.
1 1/1/00 1/1/01 1/1/01 55
2 5/1/05 8/5/09 5/1/05 65
2 5/1/05 8/5/09 5/2/05 62
.
.
.
2 5/1/05 8/5/09 8/5/09 69
etc. etc.
What would be the most efficient way to complete this task?
Thanks in advance for any advice.
Best,
David
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/