Hi all,

I would like to drop any family (as shown by their famid) when the "Head" and "Spouse" do not have data in the years 1984 and 1989. So, I would like to drop all given members with the same famid if there is no data for the Head and Spouse in those years. I would like to keep families when this is not the case. What is an efficient way to do this? I have tried using egen and _N, but am not sure how to specify just the years 1984 and 1989. Below is an example of a family I would like to drop, which includes a Head, Spouse, and three Children.

Thank you!
Cora

Code:

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input float ID int year float(famid Head Spouse Child)
6004 1985 6 . 1 .
6004 1986 6 . 1 .
6004 1993 6 . 1 .
6030 1985 6 . . 1
6030 1986 6 . . 1
6030 1993 6 . . 1
6031 1985 6 . . 1
6031 1986 6 . . 1
6031 1993 6 . . 1
6170 1985 6 1 . .
6170 1986 6 1 . .
6170 1993 6 1 . .
6171 1985 6 . . 1
6171 1986 6 . . 1
6171 1993 6 . . 1
end