I would like to drop households from my dataset if they were not surveyed in both of my survey years, 2004 and 2012 (observations with hhid==2 or hhid==3 in the data example below). That means, I would like to drop all observations with a given hhid only if no household member was surveyed in both years. I would like to keep those households in which only single members did not participate in both survey rounds (hhid==1 or hhid==4 below). What is an efficient way to go about this? I have tried to work with egen and the total function, but haven't figured out a solution yet.
Many thanks!
Sophia
Code:
* Example generated by -dataex-. clear input int(hhid id) float syear 1 1 04 1 1 12 1 2 12 1 3 04 1 3 12 2 1 04 2 2 04 3 1 12 3 2 12 3 3 12 1 1 04 1 2 04 1 2 12 end
0 Response to Drop observations by group if not in all survey rounds
Post a Comment