Dear All,
I would like to insert information from one's right neighbor to an individual i's row of observations. Let's imagine I have the following minimal example:
Aiming to create a variable Neighbor_Age, I would like the get the age information from the respective right neighbor HHID, such as:
The idea is to jump the row of one's neighbor and extract the age information from there. It seems super easy, yet, I am clueless how to code this in Stata. Of course, the peer information is not uniformly either below or above the row of interest.
Does anyone have ideas?
I would like to insert information from one's right neighbor to an individual i's row of observations. Let's imagine I have the following minimal example:
HHID | Age | Right_Neighbor_HHID | Neighbor_Age |
1 | 30 | 3 | |
2 | 40 | 1 | |
3 | 50 | 2 |
HHID | Age | Right_Neighbor_HHID | Neighbor_Age |
1 | 30 | 3 | 50 |
2 | 40 | 1 | 30 |
3 | 50 | 2 | 40 |
Does anyone have ideas?
Comment