Quantcast
Channel: Statalist
Viewing all articles
Browse latest Browse all 65561

Duration of non-employment spell

$
0
0
Hi All,

I have to compute the duration of a non-employment spell. Currently, I have identified the non-employment spells (which are defined as spells of unemployment and non-participation). However, when computing the duration, I am unable to get a cumulative sum for the number of months of non-participation.

Below is an example of my dataset:

Code:
* Example generated by -dataex-. To install: ssc install dataex
clear
input str16 idww int year byte(month begin) float(spell spellemp spellue spellnp duration durationemp durationue durationnp spellnonemp durationnonemp)
"0190037546300201" 1996  8 0 0 . . 0 25  . . 25 0 25
"0190037546300201" 1996  9 0 0 . . 0 25  . . 25 0 25
"0190037546300201" 1996 10 0 0 . . 0 25  . . 25 0 25
"0190037546300201" 1996 11 0 0 . . 0 25  . . 25 0 25
"0190037546300201" 1996 12 0 0 . . 0 25  . . 25 0 25
"0190037546300201" 1997  1 0 0 . . 0 25  . . 25 0 25
"0190037546300201" 1997  2 0 0 . . 0 25  . . 25 0 25
"0190037546300201" 1997  3 0 0 . . 0 25  . . 25 0 25
"0190037546300201" 1997  4 0 0 . . 0 25  . . 25 0 25
"0190037546300201" 1997  5 0 0 . . 0 25  . . 25 0 25
"0190037546300201" 1997  6 0 0 . . 0 25  . . 25 0 25
"0190037546300201" 1997  7 0 0 . . 0 25  . . 25 0 25
"0190037546300201" 1997  8 0 0 . . 0 25  . . 25 0 25
"0190037546300201" 1997  9 0 0 . . 0 25  . . 25 0 25
"0190037546300201" 1997 10 0 0 . . 0 25  . . 25 0 25
"0190037546300201" 1997 11 0 0 . . 0 25  . . 25 0 25
"0190037546300201" 1997 12 0 0 . . 0 25  . . 25 0 25
"0190037546300201" 1998  1 0 0 . . 0 25  . . 25 0 25
"0190037546300201" 1998  2 0 0 . . 0 25  . . 25 0 25
"0190037546300201" 1998  3 0 0 . . 0 25  . . 25 0 25
"0190037546300201" 1998  4 0 0 . . 0 25  . . 25 0 25
"0190037546300201" 1998  5 0 0 . . 0 25  . . 25 0 25
"0190037546300201" 1998  6 0 0 . . 0 25  . . 25 0 25
"0190037546300201" 1998  7 0 0 . . 0 25  . . 25 0 25
"0190037546300201" 1998  8 0 0 . . 0 25  . . 25 0 25
"0190037546300201" 1998  9 1 1 1 . . 16 16 .  . .  .
"0190037546300201" 1998 10 0 1 1 . . 16 16 .  . .  .
"0190037546300201" 1998 11 0 1 1 . . 16 16 .  . .  .
"0190037546300201" 1998 12 0 1 1 . . 16 16 .  . .  .
"0190037546300201" 1999  1 0 1 1 . . 16 16 .  . .  .
"0190037546300201" 1999  2 0 1 1 . . 16 16 .  . .  .
"0190037546300201" 1999  3 0 1 1 . . 16 16 .  . .  .
"0190037546300201" 1999  4 0 1 1 . . 16 16 .  . .  .
"0190037546300201" 1999  5 0 1 1 . . 16 16 .  . .  .
"0190037546300201" 1999  6 0 1 1 . . 16 16 .  . .  .
"0190037546300201" 1999  7 0 1 1 . . 16 16 .  . .  .
"0190037546300201" 1999  8 0 1 1 . . 16 16 .  . .  .
"0190037546300201" 1999  9 0 1 1 . . 16 16 .  . .  .
"0190037546300201" 1999 10 0 1 1 . . 16 16 .  . .  .
"0190037546300201" 1999 11 0 1 1 . . 16 16 .  . .  .
"0190037546300201" 1999 12 0 1 1 . . 16 16 .  . .  .
"0190037546300203" 1996  8 0 0 0 . . 15 15 .  . .  .
"0190037546300203" 1996  9 0 0 0 . . 15 15 .  . .  .
"0190037546300203" 1996 10 0 0 0 . . 15 15 .  . .  .
"0190037546300203" 1996 11 0 0 0 . . 15 15 .  . .  .
"0190037546300203" 1996 12 0 0 0 . . 15 15 .  . .  .
"0190037546300203" 1997  3 0 0 0 . . 15 15 .  . .  .
"0190037546300203" 1997  4 0 0 0 . . 15 15 .  . .  .
"0190037546300203" 1997  5 0 0 0 . . 15 15 .  . .  .
"0190037546300203" 1997  6 0 0 0 . . 15 15 .  . .  .
"0190037546300203" 1997  7 0 0 0 . . 15 15 .  . .  .
"0190037546300203" 1997  8 0 0 0 . . 15 15 .  . .  .
"0190037546300203" 1997  9 0 0 0 . . 15 15 .  . .  .
"0190037546300203" 1997 10 0 0 0 . . 15 15 .  . .  .
"0190037546300203" 1997 11 0 0 0 . . 15 15 .  . .  .
"0190037546300203" 1997 12 0 0 0 . . 15 15 .  . .  .
"0190037546300203" 1998  1 1 1 . . 1  4  . .  4 1  4
"0190037546300203" 1998  2 0 1 . . 1  4  . .  4 1  4
"0190037546300203" 1998  3 0 1 . . 1  4  . .  4 1  4
"0190037546300203" 1998  4 0 1 . . 1  4  . .  4 1  4
"0190037546300203" 1998  5 1 2 . 1 .  1  . 1  . 2  1
"0190037546300203" 1998  6 1 3 . . 2 19  . . 19 3 19
"0190037546300203" 1998  7 0 3 . . 2 19  . . 19 3 19
"0190037546300203" 1998  8 0 3 . . 2 19  . . 19 3 19
"0190037546300203" 1998  9 0 3 . . 2 19  . . 19 3 19
"0190037546300203" 1998 10 0 3 . . 2 19  . . 19 3 19
"0190037546300203" 1998 11 0 3 . . 2 19  . . 19 3 19
"0190037546300203" 1998 12 0 3 . . 2 19  . . 19 3 19
"0190037546300203" 1999  1 0 3 . . 2 19  . . 19 3 19
"0190037546300203" 1999  2 0 3 . . 2 19  . . 19 3 19
"0190037546300203" 1999  3 0 3 . . 2 19  . . 19 3 19
"0190037546300203" 1999  4 0 3 . . 2 19  . . 19 3 19
"0190037546300203" 1999  5 0 3 . . 2 19  . . 19 3 19
"0190037546300203" 1999  6 0 3 . . 2 19  . . 19 3 19
"0190037546300203" 1999  7 0 3 . . 2 19  . . 19 3 19
"0190037546300203" 1999  8 0 3 . . 2 19  . . 19 3 19
"0190037546300203" 1999  9 0 3 . . 2 19  . . 19 3 19
"0190037546300203" 1999 10 0 3 . . 2 19  . . 19 3 19
"0190037546300203" 1999 11 0 3 . . 2 19  . . 19 3 19
"0190037546300203" 1999 12 0 3 . . 2 19  . . 19 3 19
"0190037546300204" 1996  8 0 0 . 0 .  2  . 2  . 0  2
"0190037546300204" 1996  9 0 0 . 0 .  2  . 2  . 0  2
"0190037546300204" 1996 10 1 1 1 . . 39 39 .  . .  .
"0190037546300204" 1996 11 0 1 1 . . 39 39 .  . .  .
"0190037546300204" 1996 12 0 1 1 . . 39 39 .  . .  .
"0190037546300204" 1997  1 0 1 1 . . 39 39 .  . .  .
"0190037546300204" 1997  2 0 1 1 . . 39 39 .  . .  .
"0190037546300204" 1997  3 0 1 1 . . 39 39 .  . .  .
"0190037546300204" 1997  4 0 1 1 . . 39 39 .  . .  .
"0190037546300204" 1997  5 0 1 1 . . 39 39 .  . .  .
"0190037546300204" 1997  6 0 1 1 . . 39 39 .  . .  .
"0190037546300204" 1997  7 0 1 1 . . 39 39 .  . .  .
"0190037546300204" 1997  8 0 1 1 . . 39 39 .  . .  .
"0190037546300204" 1997  9 0 1 1 . . 39 39 .  . .  .
"0190037546300204" 1997 10 0 1 1 . . 39 39 .  . .  .
"0190037546300204" 1997 11 0 1 1 . . 39 39 .  . .  .
"0190037546300204" 1997 12 0 1 1 . . 39 39 .  . .  .
"0190037546300204" 1998  1 0 1 1 . . 39 39 .  . .  .
"0190037546300204" 1998  2 0 1 1 . . 39 39 .  . .  .
"0190037546300204" 1998  3 0 1 1 . . 39 39 .  . .  .
end
label values month rhcalmn
label def rhcalmn 1 "January", modify
label def rhcalmn 2 "February", modify
label def rhcalmn 3 "March", modify
label def rhcalmn 4 "April", modify
label def rhcalmn 5 "May", modify
label def rhcalmn 6 "June", modify
label def rhcalmn 7 "July", modify
label def rhcalmn 8 "August", modify
label def rhcalmn 9 "September", modify
label def rhcalmn 10 "October", modify
label def rhcalmn 11 "November", modify
label def rhcalmn 12 "December", modify
The variables were generated according to the following code

Code:
*Compute a variable to compute the beginning of a new spell
by ssuid eentaid epppnum: gen byte begin = jobesr != jobesr[_n-1]
*Removing those who enter the sample with a certain spell.
by ssuid eentaid epppnum: replace begin=0 if _n==1 

*Identify distinct spells 
by ssuid eentaid epppnum: gen spell= sum(begin)
by ssuid eentaid epppnum: gen spellemp = sum(begin) if jobesr==1
by ssuid eentaid epppnum: gen spellue = sum(begin) if jobesr==2
by ssuid eentaid epppnum: gen spellnp = sum(begin) if jobesr==3

*Non-employment spell
by ssuid eentaid epppnum: gen spellnonemp = sum(begin) if jobesr==2 | jobesr==3

*Generate the duration of each spell
sort ssuid eentaid epppnum spell year month
by ssuid eentaid epppnum spell: gen duration = _N
by ssuid eentaid epppnum spell: gen durationemp = duration if jobesr==1
by ssuid eentaid epppnum spell: gen durationue = duration if jobesr==2
by ssuid eentaid epppnum spell: gen durationnp = duration if jobesr==3

*Non-employment spell
by ssuid eentaid epppnum spell: gen durationnonemp = duration if jobesr==2 | jobesr==3
Here the variable JOBESR is the variable which describes whether you are employed (jobesr==1), unemployed(jobesr==2) or not participating (jobesr==3), in the labour market. And the variables SSUID EENTAID and EPPPNUM are used to identify the individual in the dataset. The variable BEGIN computes any change in the labour market status. SPELL computes the number of spells of each type for labour market status and DURATION computes the duration of each labour market spell.

The variable DURATIONNONEMP currently computes the duration of each spell of non-employment (unemployment and non-participation) spell. However, I would like that the variable gives me the answer 26 for individual ID "0190037546300203" instead of 4, 1, 19. Since that individual has consecutive unemployment and non-participation spells for which I require the duration.

Any help on this would be great.

Thank you very much.

Mridula

Viewing all articles
Browse latest Browse all 65561

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>