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]
st: how to calculate the accumulative work experience for panel data
From
Hey Sky <[email protected]>
To
statalist <[email protected]>
Subject
st: how to calculate the accumulative work experience for panel data
Date
Thu, 17 Feb 2011 06:47:17 -0800 (PST)
Dear Statalisters
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/