The length of study is 8 years. If the
period of work was 7 years without a
break, then there are only two possibilities:
the person did not work in the first year
or the person did not work in the last year.
by pid : egen emplo = count(work == 1)
by pid : gen work7 = count == 7 & (work[1] != 1 | work[8] != 1)
Nick
[email protected]
[email protected]
> 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
*
* 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/