On Tue, 04 Feb 2003 16:08:10 -0500 Jean-Fran=?ISO-8859-1?B?5w==?=ois
Godin <[email protected]> wrote:
> Hi,
>
> I�m a new user of stata. I have a dataset giving the beginning and the end
> of jobs held by some respondents. For my research I need to use xtlogit.
> Has I understand, it is necessary that I build a dataset indicating if the
> individual were in employment for each week. Here, the weeks are virtual,
> i.e. they represent the number of weeks passed since a certain event.
>
>
>
> Id Job_Rank job_beg job_end
>
> 23 1 6 19
> 23 2 26 57
> 27 1 3 24
> 27 2 28 32
> 27 3 36 68
>
>
> In SAS with the commands arrays, it is relatively simple to build line
> vectors indicating by 0/1 if the respondent had a job during the observed
> period (104 weeks). I don�t think there is an equivalent command in Stata.
> In my case, I wish to build a column vector indicating yes/no (0/1) the
> individual was in employment on the period observed. Which command do I need
> to use in my case and how can I build this type of dataset?
There is a FAQ at the Stata website about the Stata equivalent of
creating SAS arrays. It was written in the age of Stata 6 and refers to
the -while- command, I recall, though in Stata 7 and 8 you are more
likely to use instead -foreach- or -forvalues-.
But, actually, I don't think you need that at all. I suspect that what
you really want is a data set in what Stata calls long format. (This is
Stata's forte for longitudinal data and well worth reading about.)
In essence you want to "episode split" your spells so that there is one
observation for each week that each person is at risk of losing a job.
That can be accomplished very easily using -expand- (or, even though
you want a discrete time hazard model, with the continuous time
survival data utility -stsplit-). More info on episode splitting in one
of the Lessons at
http://www.iser.essex.ac.uk/teaching/stephenj/ec968/index.php
Stephen
----------------------
Professor Stephen P. Jenkins <[email protected]>
Institute for Social and Economic Research (ISER)
University of Essex, Colchester, CO4 3SQ, UK
Tel: +44 (0)1206 873374. Fax: +44 (0)1206 873151.
http://www.iser.essex.ac.uk
*
* 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/