Constructing a reference group using weights
Hi, I am trying to construct an income reference group for each individual in each wave but am having issues incorporating the population weights into the Stata code. I would like each individual's reference income to be the mean income for people of the same sex, region and education level.
The code I have written is:
svyset psu [pweight=g_indscus_lw], strata(strata)
svy: bysort gor_dv sex hiqual_dv: egen refgrs1 = mean(fimngrs_dv) if fimngrs_tc==0
However, Stata cannot run the last line because of the 'svy'. How I can resolve this issue?