Dear Suryadipta Roy--
clear
input str1 octy str1 dcty dist tshare
a b 10 0.13
a c 15 0.13
a d 25 0.13
b a 10 0.44
b c 30 0.44
b d 25 0.44
c a 15 0.22
c b 30 0.22
c d 5 0.22
d a 25 0.21
d b 25 0.21
d c 5 0.21
end
gen double other_tshare=.
qui levelsof octy, local(clist)
foreach i of local clist {
su tshare if octy=="`i'", meanonly
qui replace other_tshare=r(mean) if dcty=="`i'"
}
g dt=dist*other_tshare
egen x1=sum(dt), by(octy)
*Value x1=12.95 for octy=a given by the formula:
*tshare(b)*dist(a,b)+tshare(c)*dist(a,c)+tshare(d)*dist(a,d).
l, noo clean
On 2/28/07, Roy,Suryadipta <[email protected]> wrote:
I had posted a similar query sometime back and did not get
any response- so probably my question was not very clear.
Here I have modified the query and it would be extremely
helpful to get some help. The dataset is as follows:
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/