A weighted mean is always obtainable one step at a time. Calculate the numerator; the denominator; and then divide.
Code:
bysort newdate: egen R3_q5 = total(cond(q_R3 == 5, w * ex_ret, .) ) bysort newdate: egen denom = total(cond(q_R3 == 5, w, .) ) replace R3_q5 = R3_q5 / denom
Comment