Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Re: Re: how to calculate employment history - panel data


From   "Martin Weiss" <martin.weiss1@gmx.de>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: Re: Re: how to calculate employment history - panel data
Date   Thu, 28 May 2009 00:40:51 +0200

<>

I owe all this stuf to Nick (the usual disclaimer applies...)

http://www.stata-journal.com/sjpdf.html?articlenum=pr0004
http://www.stata-journal.com/sjpdf.html?articlenum=pr0007
http://www.stata.com/support/faqs/data/


HTH
Martin
_______________________
----- Original Message ----- From: "Martin Weiss" <martin.weiss1@gmx.de>
To: <statalist@hsphsun2.harvard.edu>
Sent: Thursday, May 28, 2009 12:32 AM
Subject: st: Re: how to calculate employment history - panel data


<>

-egen- happily accepts expressions for some of its functions, so let`s try and use that...

***

clear*

input Id   spell  begin  end     status:mylabel , auto
1    1       12        14       empl
1    2       15         46      unempl
1    3       47         52      sick
1    4       59         66      unempl
1    5       70         80      empl
1    6       81         88      unempl
1    7       89        105     empl
2    1       14         21      unempl
2    2       55         59      sick
2    3       61        109     empl
2    4      110       115     unempl
2    5      116       200     empl
end
compress

bys Id: gen byte newspell=sum((status[_n-1]==1)*(_n!=1))
bys Id newsp: egen window=total((begin-6)*(_n==_N)*(_n!=1))
bys Id newsp: /*
*/egen weeks=total((status==2)*/*
*/(begin<=window)*(end>=window)*/*
*/(end-window))
l, sepby(Id news)
***


HTH
Martin
_______________________
----- Original Message ----- From: <go.diva@web.de>
To: <statalist@hsphsun2.harvard.edu>
Sent: Wednesday, May 27, 2009 11:22 PM
Subject: st: how to calculate employment history - panel data



I have the following panel dataset:

Id   spell  begin  end            status
1    1       12        14              empl
1    2       15         46             unempl
1    3       47         52             sick
1    4       59         66             unempl
1    5       70         80             empl
1    6       81         88             unempl
1    7       89        105            empl
2    1       14         21             unempl
2    2       55         59             sick
2    3       61        109            empl
2    4      110       115            unempl
2    5      116       200            empl


I want now to calculate for each spell and person how many weeks the person has been e.g. unemployed during the past 31 weeks (6 month) when he/she enters employment.

The problem is not to calculate the entire weeks spent in unemployment but only the number of weeks during a fixed period of time.

Any help or hint would be welcome.

Thanks



____________________________________________________________________
Neu: WEB.DE FreeDSL Komplettanschluss mit DSL 6.000 Flatrate und
Telefonanschluss für 17,95 Euro/mtl.!* http://produkte.web.de/go/02/


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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