Announcement

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

  • Filter households' data from a census

    Hi everyone! I'm working on my Master's thesis and I need help.
    I'm working with census data, and I need to analyze the family context of teenage women, therefore I need to consider all the members of each family, grouped into households. I made a unique code for each household, which is repeated among all family members, and I grouped them with "group" to be able to count them. Now I need to filter and keep only households where a teenage mother (<19) lives. I have the variables "do you have any alive-born child?" and "Age groups". I tried with the command "bysort group: keep if hjs_vivos==1" (1 is "I have alive children") but it drops all the members and only keeps women with children. Maybe I miss some steps before or that is not the command I need.

    Thank you in advance!

  • #2
    Code:
    bysort group: egen tokeep = max(hjs_vivos==1)
    keep if tokeep==1
    drop tokeep

    Comment

    Working...
    X