Hi everyone,

I am having difficulties wrapping my head around the following problem:

I have a panel data set with two rounds (year), household (hhid) and person (id) identifiers. the sample consists of children, and I want to only keep one girl and one boy (sex) per household, being as close to each other as possible by birth order (BH). As you can see, these are many specific restrictions, and I find it hard to get something out of it.

Any suggestions? Thanks a lot folks!

Best, Marco