Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Counting shifts (and duration) in labor market status


From   Nick Cox <[email protected]>
To   [email protected]
Subject   Re: st: Counting shifts (and duration) in labor market status
Date   Tue, 29 Apr 2003 22:09:52 +0100

Thomas 

I have monthly labor market status observations: i.e each person is
observed
through 12 months with the following information: 1 employed, 2
unemployed, 3
out of labor force.
ex:

obs   Jan   Feb   Mar   Apr ................
1     2     2     1     1
2     1     1     1     2
3     1     2     2     3


I am now looking for a smart way of counting number of times each
person fell
into unemployment, i.e. a shift from 1 to 2 (or maybe even 3 to 2).
Also how to
count the duration of each unemployment spell i.e. how many months
does every
spell last.

I assume that many have encountered this issue before me and thought
of a smart
way to do it.

>>> 

1. -reshape-
============

You need first to -reshape- to long. Your data structure problem is
described at 

http://www.stata.com/support/faqs/data/reshape3.html

but you need, before that even, to -rename- those month 
variables: 

(Stata 8) 

local i = 1 
foreach v of var Jan-Dec { 
        rename `v' m`i++' 
} 

OR 

(Stata 7) 

for var Jan-Dec \ new m1-m12 : rename X Y 

OR

(-renvars-, STB-60) 

renvars Jan-Dec \ m1-m12  

Now you 

reshape long m , i(obs) j(time) 

2. -tsset- 
==========

Then you can 

tsset obs time 

3. -tsspell-
=============

and download -tsspell- from SSC 

(Stata 8 or updated Stata 7) 

ssc inst tsspell

then 

tsspell, fcond(m == 2 & L.m != 2) 

or 

tsspell m 

and look at the resulting variables. The help file for -tsspell- 
gives several examples. 

Nick
[email protected]
*
*   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