[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Merging observations

From   Sander <>
Subject   st: Merging observations
Date   Fri, 11 Apr 2008 10:05:31 +0200

Hi all,

It may be obvious, but I can't find a way to merge observations. I
don't mean merging data-files but just individual observations.

In my data set individuals can be identified by a variable called rin.
However, since there are multiple occurrences of almost all
individuals, I want to merge these observations. Every occurrence of
an individual means that there has been a change in the person's
situation. Every observation has it's own startdate and enddate, which
mark the period for which this observation is valid. There is also a
variable called mutcode, which tells me what kind of change happened.
Now there are three different scenarios that can take place:

1) The change was not interesting for my research and I just want to
replace the enddate of the first observation with the enddate of the
observation after the change has taken place. Let's say that this has

2) The change was interesting for my research. Let's say that the
marital status of a person has changed to married==1. What I'd like
now, is to create a new variable in the first occurrence, that shows
the startdate of the second occurrence and a second new variable that
shows married2==1. Let's say that the mutcode==2.

3) When a person moves within a municipality, this is not very
interesting for me. However, when a person moves to another
municipality, this change is interesting. Both have mutcode==3. Is it
possible to do something similar to (2) here for the persons that
moved to another municipality and something similar to (1) when they
move within a municipality.

I hope someone can help me out with this, or point me to the right command.

Thanks a lot,

*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index