I am currently working on data that shows if respondents of a survey worked part time while they were in school between the age of 15 and 19 years. With some help I was able to create the variable that shows if a person did both part time and school work which is called overlap:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input int ID str10 occupation byte(agebegin ageend overlap) 1546 "school" 16 19 1 1546 "part time " 16 16 0 1546 "part time " 18 18 0 1672 "school " 15 19 1 1672 "part time " 19 19 0 1733 "school" 16 19 1 1733 "part time " 16 16 0 1733 "part time " 18 19 0 1989 "school" 15 17 1 1989 "school" 19 19 1 1989 "part time " 17 17 0 1989 "part time " 19 19 0 1368 "school" 15 19 1 1368 "part time " 16 16 0 1368 "part time " 18 19 0 1121 "school" 15 16 1 1121 "school" 18 18 1 1121 "part time " 16 18 0 end
Is it somehow possible to create overlapy which should only appear if overlap==1. Later I would like to have one line per ID only if overlap ==1 and therefore overlapy >=1 shows how many years of part time work a person did at schooling age.
Any idea how to approach this?
Thanks a lot!
0 Response to Creating a variable that identifies and calculates overlapping time periods
Post a Comment