Dear All, I found this question here (http://bbs.pinggu.org/forum.php?mod=...a=#pid55243106). The data (and my code) is
Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input str9 id int year double x
A 1978  .692
A 1979  .712
A 1980  .746
B 1978  .761
B 1979  .759
B 1980  .761
C 1978 1.107
C 1979 1.119
C 1980 1.181
end

bys id: gen tem1 = x if year == 1980
bys id : egen tem2 = mean(tem1)
gen wanted = x/tem2
The purpose is, for each `id', to divide `x' by its value in 1980. I wonder if there is more concise way to do this.