I am having trouble coding this problem. Thanks in advance to anyone who can help! Let's say we have individual-level data. The dataset has families that live in neighborhoods so the dataset would look something like this: Have: ID Fam_ID Neigh_ID Income 1 A CC 100,000 2 A CC 200,000 3 B CC 60,000 4 B CC 200,000 5 B CC 120,000 6 C DD 35,000 7 C DD 40,000 I am trying to find the median income of a neighborhood for each family that excludes the income of those in said family. For example, family A would have a med_neighborhood_income of 120,000 since the only other family in neighborhood CC is family B and the median income in family B is 120,000. The med_neighborhood_income value for family B would be ((100,000+200,000)/2) or 150,000. Hope this is clear.
... View more