Using the code below, I am trying to ask Stata to use weight variables in 1998 for each id (hhidpn) and constantly use them over the years after 1998 as weight variables. The code returns an error: varlist not allowed.
foreach v of varlist raehsamp rwtcrnh rwtresp raestrat {
by hhidpn , sort: egen `v'_base = max(cond(year== 1998))}
by hhidpn , sort: egen `v'_base = max(cond(year== 1998))}
Comment