Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: RE: RE: Data management


From   "Roy,Suryadipta" <[email protected]>
To   [email protected]
Subject   Re: st: RE: RE: Data management
Date   Wed, 21 Mar 2007 17:17:53 -0500

Hi,

I had a follow-up question to the one I asked today. I am trying to generate this variable z for each id for different years. The formula for z is as follows:

z (id=1 for year=2000)=75= dist(between 1 and 2=5)*tshare of id=2 for year 2000 + dist(between 1 and 3=missing)*tshare of id=3 for year 2000 (missing) + dist(between 1 and 4=15)*tshare of id=4 for year 2000 (5), and so on for different id-s for different years.

id year oid did dist tvol tsum tshare z
1 2000 1 2 5 1 6 0.2 75
1 2000 1 3 10 1 6 0.2 75
1 2000 1 4 15 1 6 0.2 75
1 2001 1 2 5 2 4 1 26.43
1 2001 1 3 10 2 4 1 26.43
1 2001 1 4 15 2 4 1 26.43
1 2002 1 2 5 3 17 0.21 22.97
1 2002 1 3 10 3 17 0.21 22.97
1 2002 1 4 15 3 17 0.21 22.97
2 2001 2 1 5 2 4 1 1
2 2001 2 3 4 2 4 1 1
2 2001 2 4 2 2 4 1 1
2 2002 2 1 5 4 17 0.31 3.93
2 2002 2 3 4 4 17 0.31 3.93
2 2002 2 4 2 4 17 0.31 3.93
4 2000 4 1 15 5 6 5 3
4 2000 4 2 2 5 6 5 3
4 2000 4 3 5 5 6 5 3
4 2001 4 1 15 4 17
4 2001 4 2 2 4 17
4 2001 4 3 5 4 17
4 2002 4 1 15 10 17 1.43 3.83
4 2002 4 2 2 10 17 1.43 3.83
4 2002 4 3 5 10 17 1.43 3.83

Thanks again!!!
S.
*
* 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/




© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index