Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • How do I keep respondents who meet a condition at a particular year?

    Hello

    I am using the British Household Survey and have restricted my sample to mothers and have created an indicator variable showing when these mothers switched from employment to maternity leave. I am only interested in studying these mothers across waves.

    I have tried to only keep those who have experienced this switch but it deletes all of the other wave history of the same mothers apart from the wave at which the switch took place.

    I basically want to keep the identification number of these mothers but also of the waves each of this id has responded to.

    There are 700+ of these women so telling stata to keep only these identification numbers would take a lot of time.

    Also bare in mind that there is no set number of waves that all of the mothers in my list have responded to so I can't just use a certain _N= command given that I don't have such consistency.

    Below is a table of what my data looks like.
    id wave employment status
    1 1 unemployment-->employment
    1 2 employment--> maternity leave
    2 6 employment -->employment
    2 7
    employment -->employment
    2 8
    employment -->employment
    3 1 employment-->maternity leave
    3 2 maternity leave-->employment
    3 4 employment-->employment
    Thanks in advance

  • #2
    Even the best descriptions of data are no substitute for an actual example of the data. There are many ways your data might be organized that are consistent with your description, and each would require a somewhat different approach. In order to get a helpful response, you need to show some example data.

    Be sure to use the dataex command to do this. If you are running version 15.1 or later, or a fully updated version 14.2, dataex is already part of your official Stata installation. If not, run ssc install dataex to get it. Either way, run help dataex and read the simple instructions for using it. dataex will save you time; it is easier and quicker than typing out tables. It includes complete information about aspects of the data that are often critical to answering your question but cannot be seen from tabular displays or screenshots. It also makes it possible for those who want to help you to create a faithful representation of your example to try out their code, which in turn makes it more likely that their answer will actually work in your data.

    In choosing sample data to output with dataex be sure that your data includes at least one woman who transitioned from employment to maternity leave, and be sure to explain how the variable is coded, if it is not obvious from the output.

    When asking for help with code, always show example data. When showing example data, always use dataex.

    Comment

    Working...
    X