Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

Re: st: RE: how to calculate the accumulative work experience for panel data


From   Nick Cox <njcoxstata@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: RE: how to calculate the accumulative work experience for panel data
Date   Thu, 17 Feb 2011 19:32:30 +0000

I already explained: that is the number of jobs currently held.

See also

the help for -sum()-

FAQ     . . . . . . . . . . . . . . . . . . . . . . .  True and false in Stata
        . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  N. J. Cox
        2/03    What is true and false in Stata?
                http://www.stata.com/support/faqs/data/trueorfalse.html

SJ-2-1  pr0004  . . . . . . . . . . Speaking Stata:  How to move step by: step
        . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  N. J. Cox
        Q1/02   SJ 2(1):86--102                                  (no commands)
        explains the use of the by varlist : construct to tackle
        a variety of problems with group structure, ranging from
        simple calculations for each of several groups to more
        advanced manipulations that use the built-in _n and _N


On Thu, Feb 17, 2011 at 7:25 PM, Hey Sky <heyskywalker@yahoo.com> wrote:
> hey Nick
>
> thanks for your reply.
>
> sorry I am not familiar with the following command you suggested. could you plz
> explain what is the meaning and what can get from this?
>
> bysort id (j_) : gen nojobs = sum((_j == "sta") - (_j == "sto"))
> especially this part: sum((_j == "sta") - (_j == "sto"))
>
> and any hint for the next step--subtract off the gaps when there was no job from
> the total length of employment? I cannot imagine how to do it due to not
> understanding the upper code.  thanks for your time and kind reply in advance.
>
> Nan
> from Montreal
>
>
>
>
>
>
> ----- Original Message ----
> From: Nick Cox <njcoxstata@gmail.com>
> To: statalist@hsphsun2.harvard.edu
> Sent: Thu, February 17, 2011 1:49:46 PM
> Subject: Re: st: RE: how to calculate the accumulative work experience for panel
> data
>
> OK. Here's a start.
>
> I note first that in your sample data you have two observations with
> id == 7, jobid == 1.
> First I drop one
>
> drop in 20
>
> Then I -reshape long-
>
> reshape long j_, i(id jobid) string
>
> The number of jobs currently held is
>
> bysort id (j_) : gen nojobs = sum((_j == "sta") - (_j == "sto"))
>
> You now need to subtract off the gaps when there was no job from the
> total length of employment.
>
> On Thu, Feb 17, 2011 at 5:11 PM, Hey Sky <heyskywalker@yahoo.com> wrote:
>
>> for the cumulative work exp, no matter how many jobs they hold simutaneously,
> I
>> only count them served in employment. that is, only count the overlapping time
>> once.
>>
>> From: Nick Cox <n.j.cox@durham.ac.uk>
>>
>> I think we need -- correction, I need -- your definition of accumulated or
>> cumulative work experience. (By the way, I suggest either word, not
>> accumulative.)
>>
>> Do you or do you not count time served simultaneously in two or more jobs with
>> that much weight or you just count time served in employment?
>
> Hey Sky
>
>> yesterday I post a question on how to calculate the mean wage under  panel
>>data.
>>
>> thanks for David valuable suggestions. the tested code are  as above.
>>
>> now I have another question about panel data: how to calculate the
>>accumulative
>>
>> work experience while getting rid off the overlapping  period?
>>
>>
>> example data as follows, the j_sta/j_sto represents job starting/stoping  time
>> and id, as before, represents the people who participates in  survey.
>>
>>
>> as you can see, the various overlapping situation make it hard to  entangle
> and
>> get the right work experience. for id=1, a perfect  situation that he start
> his
>> 2nd job after finished his 1st one. for  id=2, even there is an overlapping
>> period between his 1st and 2nd job,  it is not hard to get accumulative exp
>> right.
>>
>>
>> now consider a little more complicated case for 3 or more jobs. such as  id=3,
>> overlapping between 1st and 2nd but not 3rd job. for id=7, his  all 3 jobs are
>> overlapped. now take a look at id=5, though there is no  overlapping between
>>his
>>
>> 1st and 3rd job, his 2nd job are totally covered  by his 3rd job. id=6 is in a
>> similar situation with overlapping  between 1st and 3rd job.
>>
>> any suggestions are appreciated.
>>
>>
>>
>> **** Tested code to get mean wage under panel data ****
>> clear
>> input id jobid wage1 wage2 wage3 j_sta j_sto
>> 1 1 1 2 . 1000 1050
>> 1 2 . 3 . 1055 1260
>> 2 1 1 . . 1000 1050
>> 2 2 . 2 2 1022 1240
>>
>> 3 1 1 2 . 1000 1050
>> 3 2 . 3 . 1030 1150
>> 3 3 . . 4 1155 1280
>>
>> 4 1 2 . . 1000 1050
>> 4 2 . 3 4 1070 1150
>> 4 3 . . 5 1160 1240
>>
>> 5 1 1 . . 1000 1050
>> 5 2 . 2 3 1080 1100
>> 5 3 . . 5 1040 1290
>>
>> 6 1 1 . . 1000 1050
>> 6 2 . 2 3 1080 1100
>> 6 3 . . 5 1060 1290
>>
>> 7 1 2 2 . 1000 1050
>> 7 2 . 2 3 1040 1110
>> 7 3 . . 5 1100 1250
>>
>> 7 1 2 4 6 1020 1270
>> 8 1 2 3 . 1001 1210
>> 9 1 2 . 4 1033 1244
>>
>> end
>>
>>
>> format  j_sta j_sto %td
>>
>> **** suggested by David  ****
>> reshape long wage, i(id jobid) j(wave)
>>
>> drop if mi(wage)
>> sort id wave jobid
>> by id wave (jobid): keep if _n==_N
>>
>> by id: egen meanwage = mean(wage)
>> ***************
>
> *
> *   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index