[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: n-1 variable continuously
I have a question about how calculate the number of years work continuously.
I have a panel of 8 year and I want calculated the person how has work
for 7 years no stop. (1111110)
I used this procedure:
by pid : egen emplo=count(work==1)
here work is=1 if work. after I did the tab emplo and I have the table
for 8 years.
but there aredifferente sequence how 0111111, or 1011111 ecc and I
want only 1111110.
for ex: 1011111 but is incorrect
pid emplo wave work
1 7 1 1
1 7 3 1
1 7 4 1
How is possible to make it?
thanks
*
* 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/