Statalist The Stata Listserver


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

st: n-1 variable continuously


From   [email protected]
To   [email protected]
Subject   st: n-1 variable continuously
Date   Sun, 28 Jan 2007 13:07:29 +0100

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/




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