Hi,

For each individual i in my dataset, I am trying to generate a variable which is the mean income of all respondents who are up to five years older or younger than individual i (with the same sex, region, education level, etc). Because of the age criterion, every individual in the dataset will more or less have a unique "reference group" with which to generate mean income. In addition, it needs to be population-weighted (using either pweight or svy). How can I do this for a dataset with over 300000 individuals?