Hi there
I am working on a panel data set with multiple observations on each individual, identified by a unique ID variable (called ''pid''). I also have a variable denoting labour force status (called ''labforcestat'' which can be equal to 1, 2, or 3, for each individual at each wave. An individual's status can change between waves. Furthermore, observations on a person may not be continuous (there may be missing waves).
I want to delete the current observation and all subsequent observations on an individual from the point that their labour force status is 2 for a second time. However, I want to keep observations on that person, prior to this occuring. For example, in the data set below, I would want to keep all observations on person 1, but delete the observations on person 2 that occurred in waves 7 and 8.
If it is relevant/helpful, I have managed to create a variable called newspell which equals 1 when an individual's labour force status changes (or the first time they are observed) and is missing otherwise.
I am completely stuck, so any help you can offer would be wonderful. If I have not explained clearly enough, I apologise, and please feel free to ask for more clarification.
I am working on a panel data set with multiple observations on each individual, identified by a unique ID variable (called ''pid''). I also have a variable denoting labour force status (called ''labforcestat'' which can be equal to 1, 2, or 3, for each individual at each wave. An individual's status can change between waves. Furthermore, observations on a person may not be continuous (there may be missing waves).
I want to delete the current observation and all subsequent observations on an individual from the point that their labour force status is 2 for a second time. However, I want to keep observations on that person, prior to this occuring. For example, in the data set below, I would want to keep all observations on person 1, but delete the observations on person 2 that occurred in waves 7 and 8.
If it is relevant/helpful, I have managed to create a variable called newspell which equals 1 when an individual's labour force status changes (or the first time they are observed) and is missing otherwise.
I am completely stuck, so any help you can offer would be wonderful. If I have not explained clearly enough, I apologise, and please feel free to ask for more clarification.
pid | wave | labforcestat |
person 1 | 1 | 1 |
person 1 | 2 | 2 |
person 1 | 3 | 2 |
person 1 | 4 | 3 |
person 2 | 1 | 1 |
person 2 | 2 | 2 |
person 2 | 5 | 1 |
person 2 | 7 | 2 |
person 2 | 8 | 3 |
Comment