Collection of Employment Data. The employment sections of the NLSY97 questionnaire are somewhat complex. Before beginning analysis, researchers must understand the structure of each round's questionnaire, particularly the way in which jobs are classified as employee, freelance, or self-employment. It is important to note that this classification depends in part on the survey round and the respondent's age. In rounds 1 and 2, employee jobs were recorded in the first part of the YEMP section, administered only to respondents age 14 or older as of the interview date. The second part of the YEMP section collected information about freelance jobs of respondents age 14 and older and all jobs of respondents age 12 or 13 (the implicit assumption being that respondents younger than 14 are not likely to hold employee jobs). If the respondent was at least 16 years old and made at least $200/week in a freelance job, the job was classified as self-employment and an extra series of questions was asked during the freelance section.
In round 3, all respondents were at least age 14 by the interview date, so the age restriction for employee jobs was no longer necessary. The structure of the section remained largely the same, with a division between employee and freelance jobs. Self-employment was classified in the same way as in the earlier rounds.
In round 4 the section was redesigned. Respondents born in 1980-82 (who were mostly age 18 and older when the round 4 field period began) were asked about employee jobs and self-employment at the same time. In addition, the minimum income requirement from the freelance section no longer applied; jobs could be classified as self-employment regardless of earnings. However, respondents born in 1983-84 (who were mostly age 16 or 17 when the round 4 field period began) continued to describe employee and freelance jobs separately. Data on self-employment jobs were still collected in the freelance section, and freelance jobs still had to meet the income criteria to qualify as self-employment. The same pattern was used in round 5.
The redesign of the employment section has important implications for created employment variables. In rounds 1-3, all of the created employment variables were based only on employee-type jobs. So, for example, the variable "Weeks Worked during Calendar Year 1999" counted only the weeks worked by a respondent at a regular employee-type job. If the respondent also reported self-employment in a lawn care business, the weeks spent working at that job were not counted in the created variable.
In round 4, when older respondents reported both employee-type and self-employed jobs in the same series of variables, this approach was reconsidered. For rounds 4 and 5, older respondents now have three versions of most created variables. The first version, identified by the suffix "ET" in the question name, includes only employee-type jobs. The second version, the "SE" variables, includes only self-employed jobs reported by respondents born in 1980-83 in the regular employment section during round 5 (and similarly for respondents born in 1980-82 in round 4). These variables do not include freelance jobs or self-employment reported by younger respondents in the freelance jobs section in rounds 4 and 5, and they do not include freelance jobs or self-employment reported in rounds 1-3 by any respondent regardless of age. Finally, the variables for all jobs include both employee-type jobs and self-employment reported during round 5 for respondents born in 1980-83 but only include employee-type jobs for respondents born in 1984 (similarly, in round 4, these variables reported all jobs for respondents born in 1980-82 and only employee-type jobs for respondents born in 1983-84). These last variables are identified with the suffix "ALL" in the question name.
Respondents' ages varied widely in round 4, when self-employed jobs were first recorded as part of the regular employment section, and some respondents reported employment over several years if they missed a round of interviewing. To simplify the creation of the employment variables, survey staff included only the self-employment job information starting on January 1 of the year the respondent turned 18. For example, consider a respondent who was 20 years old on his round 4 interview date in April 2001 and had not been interviewed since round 1. He reports self-employment in a computer repair business beginning on his 17th birthday in March 1998 and continuous employment at a fast-food restaurant since his round 1 interview in 1997. The round 4 created employment variables would include information about the employee-type fast food job dating all the way back to 1997. However, the computer repair business would not be considered until January 1, 1999 (the first day of the year he turned 18). In other words, the variable "Weeks Worked in Calendar Year 1998" would count only the fast food job and the variable "Weeks Worked Any Job in Calendar Year 1999" would count both the fast food job and the repair business. Similarly, the new variable "Weeks R Was Self-Employed Year 1998" would have a value of -4, or valid skip (because the respondent was not yet 18), but the variable "Weeks R Was Self-Employed Year 1999" would report the weeks the respondent worked at the computer repair business in 1999. This approach, continued in round 5, will permit users to compare the employment variables across respondents in different rounds with confidence that the job types included are the same for all respondents of a given age.
"Backreporters." Occasionally respondents report a job in the current interview that started before the date of their last interview and should have been reported at that time. Appendix 6 in this document contains a more complete description of the implications of these reports for the created employment event history variables. There are also a number of created employment variables detailed in this appendix. Nearly all of these variables use the information provided about employment previous to the date of last interview. The only exception is the set of CV_WKSWK_DLI variables, which reports the weeks worked since the previous interview date. The current round's variables would not include the backreported information in any case; the previous round's variables are not re-created to incorporate this new information.
For example, assume that Jane was interviewed in round 3 on April 15, 2000, and in round 4 on April 15, 2001. In the round 4 interview, she reports for the first time a job that started on April 1, 2000. The 2 weeks worked at that job before April 15, 2000, would not be reflected in any round's CV_WKSWK_DLI variables. However, those weeks would be counted in other variables. For example, CV_WKSWK_YR.00 would count all the weeks worked at any job in 2000, regardless of whether those weeks were reported in the round 3 or round 4 interview.
Creation of Employment Variables. A number of the created employment variables use the same program as input. The program in this section is referred to throughout the employment variables. For example, to create the "Weeks Worked at Employee Job #x during 19xx" variables, survey staff first run the program below titled "emp_begin.sas" and then run the program included in the weeks worked section of this appendix.
This program calculates total weeks worked at each job for each respondent. It converts start and stop dates for jobs and within-job gaps to continuous week numbers, subtracts within-job gaps, and finally counts the total weeks worked. The variables listed here are those employed in any program that uses emp_begin.sas as input; they may not be used in this initial program.
|
Name in Program |
Question Name on CD |
Name in Program |
Question Name on CD |
| r1int_d | YINF-900_D | e381031 | YEMP-38103.01 |
| r1int_m | YINF-900_M | e381032 | YEMP-38103.02 |
| r1int_y | YINF-900_Y | e381033 | YEMP-38103.03 |
| birthdy | KEY!BDATE_D | e381051 | YEMP-38105.01 |
| birthmo | KEY!BDATE_M | e381052 | YEMP-38105.02 |
| birthyr | KEY!BDATE_Y | e381053 | YEMP-38105.03 |
| norcid | YNORCID | e599011 | YEMP-59901.01 |
| r2int_d | YINTDATE~D | e599012 | YEMP-59901.02 |
| r2int_m | YINTDATE~M | e599013 | YEMP-59901.03 |
| r2int_y | YINTDATE~Y | e599014 | YEMP-59901.04 |
| r3int_d | YINTDATE~D | e599015 | YEMP-59901.05 |
| r3int_m | YINTDATE~M | e599016 | YEMP-59901.06 |
| r3int_y | YINTDATE~Y | e599017 | YEMP-59901.07 |
| r4int_d | YINTDATE~D | e599018 | YEMP-59901.08 |
| r4int_m | YINTDATE~M | e880001 | YEMP-88000.01 |
| r4int_y | YINTDATE~Y | e880002 | YEMP-88000.02 |
| milflag1 | YEMP_MILFLAG.01 | e880003 | YEMP-88000.03 |
| milflag2 | YEMP_MILFLAG.02 | e880004 | YEMP-88000.04 |
| milflag3 | YEMP_MILFLAG.03 | e880005 | YEMP-88000.05 |
| milflag4 | YEMP_MILFLAG.04 | e880006 | YEMP-88000.06 |
| milflag5 | YEMP_MILFLAG.05 | e880007 | YEMP-88000.07 |
| milflag6 | YEMP_MILFLAG.06 | e885011 | YEMP-88501.01 |
| milflag7 | YEMP_MILFLAG.07 | e885012 | YEMP-88501.02 |
| milflag8 | YEMP_MILFLAG.08 | e885013 | YEMP-88501.03 |
| self1 | YEMP_SELFEMP.01 | e885014 | YEMP-88501.04 |
| self2 | YEMP_SELFEMP.02 | e885015 | YEMP-88501.05 |
| self3 | YEMP_SELFEMP.03 | e885016 | YEMP-88501.06 |
| self4 | YEMP_SELFEMP.04 | e984021 | YEMP-98402.01 |
| self5 | YEMP_SELFEMP.05 | e984022 | YEMP-98402.02 |
| self6 | YEMP_SELFEMP.06 | e984023 | YEMP-98402.03 |
| self7 | YEMP_SELFEMP.07 | e984024 | YEMP-98402.04 |
| self8 | YEMP_SELFEMP.08 | e984025 | YEMP-98402.05 |
| stardy1 | YEMP_STARTDATE.01~D | e984026 | YEMP-98402.06 |
| starmo1 | YEMP_STARTDATE.01~M | e984031 | YEMP-98403.01 |
| staryr1 | YEMP_STARTDATE.01~Y | e984032 | YEMP-98403.02 |
| stardy2 | YEMP_STARTDATE.02~D | e984033 | YEMP-98403.03 |
| starmo2 | YEMP_STARTDATE.02~M | e984291 | YEMP-98429.01 |
| staryr2 | YEMP_STARTDATE.02~Y | e984292 | YEMP-98429.02 |
| stardy3 | YEMP_STARTDATE.03~D | e984293 | YEMP-98429.03 |
| starmo3 | YEMP_STARTDATE.03~M | e1002311 | YEMP-100231.01.02 |
| staryr3 | YEMP_STARTDATE.03~Y | e1002312 | YEMP-100231.02.02 |
| stardy4 | YEMP_STARTDATE.04~D | e1002321 | YEMP-100232.01.03 |
| starmo4 | YEMP_STARTDATE.04~M | e1002322 | YEMP-100232.02.03 |
| staryr4 | YEMP_STARTDATE.04~Y | GAP1 | YEMP-101500.01 |
| stardy5 | YEMP_STARTDATE.05~D | GAP2 | YEMP-101500.02 |
| starmo5 | YEMP_STARTDATE.05~M | GAP3 | YEMP-101500.03 |
| staryr5 | YEMP_STARTDATE.05~Y | GAP4 | YEMP-101500.04 |
| stardy6 | YEMP_STARTDATE.06~D | GAP5 | YEMP-101500.05 |
| starmo6 | YEMP_STARTDATE.06~M | GAP6 | YEMP-101500.06 |
| staryr6 | YEMP_STARTDATE.06~Y | GAP7 | YEMP-101500.07 |
| stardy7 | YEMP_STARTDATE.07~D | GAP8 | YEMP-101500.08 |
| starmo7 | YEMP_STARTDATE.07~M | BGDY1_1 | YEMP-102200.01.01~D |
| staryr7 | YEMP_STARTDATE.07~Y | BGMO1_1 | YEMP-102200.01.01~M |
| stardy8 | YEMP_STARTDATE.08~D | BGYR1_1 | YEMP-102200.01.01~Y |
| starmo8 | YEMP_STARTDATE.08~M | BGDY2_1 | YEMP-102200.02.01~D |
| staryr8 | YEMP_STARTDATE.08~Y | BGMO2_1 | YEMP-102200.02.01~M |
| stopdy1 | YEMP_STOPDATE.01~D | BGYR2_1 | YEMP-102200.02.01~Y |
| stopmo1 | YEMP_STOPDATE.01~M | BGDY3_1 | YEMP-102200.03.01~D |
| stopyr1 | YEMP_STOPDATE.01~Y | BGMO3_1 | YEMP-102200.03.01~M |
| stopdy2 | YEMP_STOPDATE.02~D | BGYR3_1 | YEMP-102200.03.01~Y |
| stopmo2 | YEMP_STOPDATE.02~M | BGDY4_1 | YEMP-102200.04.01~D |
| stopyr2 | YEMP_STOPDATE.02~Y | BGMO4_1 | YEMP-102200.04.01~M |
| stopdy3 | YEMP_STOPDATE.03~D | BGYR4_1 | YEMP-102200.04.01~Y |
| stopmo3 | YEMP_STOPDATE.03~M | BGDY5_1 | YEMP-102200.05.01~D |
| stopyr3 | YEMP_STOPDATE.03~Y | BGMO5_1 | YEMP-102200.05.01~M |
| stopdy4 | YEMP_STOPDATE.04~D | BGYR5_1 | YEMP-102200.05.01~Y |
| stopmo4 | YEMP_STOPDATE.04~M | BGDY1_2 | YEMP-102400.01.02~D |
| stopyr4 | YEMP_STOPDATE.04~Y | BGMO1_2 | YEMP-102400.01.02~M |
| stopdy5 | YEMP_STOPDATE.05~D | BGYR1_2 | YEMP-102400.01.02~Y |
| stopmo5 | YEMP_STOPDATE.05~M | BGDY1_3 | YEMP-102400.01.03~D |
| stopyr5 | YEMP_STOPDATE.05~Y | BGMO1_3 | YEMP-102400.01.03~M |
| stopdy6 | YEMP_STOPDATE.06~D | BGYR1_3 | YEMP-102400.01.03~Y |
| stopmo6 | YEMP_STOPDATE.06~M | BGDY1_4 | YEMP-102400.01.04~D |
| stopyr6 | YEMP_STOPDATE.06~Y | BGMO1_4 | YEMP-102400.01.04~M |
| stopdy7 | YEMP_STOPDATE.07~D | BGYR1_4 | YEMP-102400.01.04~Y |
| stopmo7 | YEMP_STOPDATE.07~M | BGDY1_5 | YEMP-102400.01.05~D |
| stopyr7 | YEMP_STOPDATE.07~Y | BGMO1_5 | YEMP-102400.01.05~M |
| stopdy8 | YEMP_STOPDATE.08~D | BGYR1_5 | YEMP-102400.01.05~Y |
| stopmo8 | YEMP_STOPDATE.08~M | BGDY1_6 | YEMP-102400.01.06~D |
| stopyr8 | YEMP_STOPDATE.08~Y | BGMO1_6 | YEMP-102400.01.06~M |
| uid1 | YEMP_UID.01 | BGYR1_6 | YEMP-102400.01.06~Y |
| uid2 | YEMP_UID.02 | BGDY2_2 | YEMP-102400.02.02~D |
| uid3 | YEMP_UID.03 | BGMO2_2 | YEMP-102400.02.02~M |
| uid4 | YEMP_UID.04 | BGYR2_2 | YEMP-102400.02.02~Y |
| uid5 | YEMP_UID.05 | BGDY2_3 | YEMP-102400.02.03~D |
| uid6 | YEMP_UID.06 | BGMO2_3 | YEMP-102400.02.03~M |
| uid7 | YEMP_UID.07 | BGYR2_3 | YEMP-102400.02.03~Y |
| uid8 | YEMP_UID.08 | BGDY3_2 | YEMP-102400.03.02~D |
| r5int_d | YINTDATE~D | BGMO3_2 | YEMP-102400.03.02~M |
| r5int_m | YINTDATE~M | BGYR3_2 | YEMP-102400.03.02~Y |
| r5int_y | YINTDATE~Y | BGDY3_3 | YEMP-102400.03.03~D |
| e200 | YEMP-200A | BGMO3_3 | YEMP-102400.03.03~M |
| e303_1 | YEMP-303.01 | BGYR3_3 | YEMP-102400.03.03~Y |
| e303_2 | YEMP-303.02 | BGDY4_2 | YEMP-102400.04.02~D |
| e303_3 | YEMP-303.03 | BGMO4_2 | YEMP-102400.04.02~M |
| e303_4 | YEMP-303.04 | BGYR4_2 | YEMP-102400.04.02~Y |
| e239011 | YEMP-23901.01 | EGDY1_1 | YEMP-102700.01.01~D |
| e239012 | YEMP-23901.02 | EGMO1_1 | YEMP-102700.01.01~M |
| e239013 | YEMP-23901.03 | EGYR1_1 | YEMP-102700.01.01~Y |
| e239014 | YEMP-23901.04 | EGDY1_2 | YEMP-102700.01.02~D |
| e239015 | YEMP-23901.05 | EGMO1_2 | YEMP-102700.01.02~M |
| e239016 | YEMP-23901.06 | EGYR1_2 | YEMP-102700.01.02~Y |
| e239017 | YEMP-23901.07 | EGDY1_3 | YEMP-102700.01.03~D |
| e245011 | YEMP-24501.01 | EGMO1_3 | YEMP-102700.01.03~M |
| e245012 | YEMP-24501.02 | EGYR1_3 | YEMP-102700.01.03~Y |
| e245013 | YEMP-24501.03 | EGDY1_4 | YEMP-102700.01.04~D |
| e245014 | YEMP-24501.04 | EGMO1_4 | YEMP-102700.01.04~M |
| e245015 | YEMP-24501.05 | EGYR1_4 | YEMP-102700.01.04~Y |
| e245016 | YEMP-24501.06 | EGDY1_5 | YEMP-102700.01.05~D |
| e344021 | YEMP-34402.01 | EGMO1_5 | YEMP-102700.01.05~M |
| e344022 | YEMP-34402.02 | EGYR1_5 | YEMP-102700.01.05~Y |
| e344023 | YEMP-34402.03 | EGDY1_6 | YEMP-102700.01.06~D |
| e344024 | YEMP-34402.04 | EGMO1_6 | YEMP-102700.01.06~M |
| e344025 | YEMP-34402.05 | EGYR1_6 | YEMP-102700.01.06~Y |
| e344026 | YEMP-34402.06 | EGDY2_1 | YEMP-102700.02.01~D |
| e344031 | YEMP-34403.01 | EGMO2_1 | YEMP-102700.02.01~M |
| e344032 | YEMP-34403.02 | EGYR2_1 | YEMP-102700.02.01~Y |
| e344033 | YEMP-34403.03 | EGDY2_2 | YEMP-102700.02.02~D |
| e344281 | YEMP-34428.01 | EGMO2_2 | YEMP-102700.02.02~M |
| e344282 | YEMP-34428.02 | EGYR2_2 | YEMP-102700.02.02~Y |
| e344283 | YEMP-34428.03 | EGDY2_3 | YEMP-102700.02.03~D |
| e226101 | YEMP-22610.01.02 | EGMO2_3 | YEMP-102700.02.03~M |
| e226102 | YEMP-22610.02.02 | EGYR2_3 | YEMP-102700.02.03~Y |
| e226103 | YEMP-22610.03.02 | EGDY3_1 | YEMP-102700.03.01~D |
| e226111 | YEMP-22611.01.03 | EGMO3_1 | YEMP-102700.03.01~M |
| e226112 | YEMP-22611.02.03 | EGYR3_1 | YEMP-102700.03.01~Y |
| e226113 | YEMP-22611.03.03 | EGDY3_2 | YEMP-102700.03.02~D |
| e379021 | YEMP-37902.01 | EGMO3_2 | YEMP-102700.03.02~M |
| e379022 | YEMP-37902.02 | EGYR3_2 | YEMP-102700.03.02~Y |
| e379023 | YEMP-37902.03 | EGDY3_3 | YEMP-102700.03.03~D |
| e379024 | YEMP-37902.04 | EGMO3_3 | YEMP-102700.03.03~M |
| e379025 | YEMP-37902.05 | EGYR3_3 | YEMP-102700.03.03~Y |
| e379026 | YEMP-37902.06 | EGDY4_1 | YEMP-102700.04.01~D |
| e379027 | YEMP-37902.07 | EGMO4_1 | YEMP-102700.04.01~M |
| e379041 | YEMP-37904.01 | EGYR4_1 | YEMP-102700.04.01~Y |
| e379042 | YEMP-37904.02 | EGDY4_2 | YEMP-102700.04.02~D |
| e379043 | YEMP-37904.03 | EGMO4_2 | YEMP-102700.04.02~M |
| e379044 | YEMP-37904.04 | EGYR4_2 | YEMP-102700.04.02~Y |
| e379046 | YEMP-37904.06 | EGDY5_1 | YEMP-102700.05.01~D |
| e380001 | YEMP-38000.01 | EGMO5_1 | YEMP-102700.05.01~M |
| e380002 | YEMP-38000.02 | EGYR5_1 | YEMP-102700.05.01~Y |
| e380003 | YEMP-38000.03 | NUMGAP1 | YEMP-103200.01 |
| e380004 | YEMP-38000.04 | NUMGAP2 | YEMP-103200.02 |
| e380005 | YEMP-38000.05 | NUMGAP3 | YEMP-103200.03 |
| e380006 | YEMP-38000.06 | NUMGAP4 | YEMP-103200.04 |
| e38000F1 | YEMP-38000F.01 | NUMGAP5 | YEMP-103200.05 |
| e38000F2 | YEMP-38000F.02 | ||
| e38000F3 | YEMP-38000F.03 | ||
| e38000F4 | YEMP-38000F.04 | ||
| e38000F5 | YEMP-38000F.05 |
/***************** SECTION 1: Convert birth week, week turned age 14, week turned age 20, ****************
****************** and week of interview date into continuous weeks *****************************************/
** Calulate Age 14 year **
AGE14YR=birthyr+14;
** Convert Age 14 Birthdate to week number **
***Convert age14 month and day to total days (bbdays);
if birthmo>0 and birthdy>0 then do;
if birthmo=1 then bbdays=birthdy;
if birthmo=2 then bbdays=birthdy+31;
if birthmo=3 then bbdays=birthdy+59;
if birthmo=4 then bbdays=birthdy+90;
if birthmo=5 then bbdays=birthdy+120;
if birthmo=6 then bbdays=birthdy+151;
if birthmo=7 then bbdays=birthdy+181;
if birthmo=8 then bbdays=birthdy+212;
if birthmo=9 then bbdays=birthdy+243;
if birthmo=10 then bbdays=birthdy+273;
if birthmo=11 then bbdays=birthdy+304;
if birthmo=12 then bbdays=birthdy+334;
end;
***Account for leap years;
if age14yr=1980 or age14yr=1984 or age14yr=1988 or age14yr=1992 or age14yr=1996 or age18yr=2000 then do;
if birthmo>0 and birthdy>0 then do;
if birthmo=1 then bbdays=birthdy;
if birthmo=2 then bbdays=birthdy+31;
if birthmo=3 then bbdays=birthdy+60;
if birthmo=4 then bbdays=birthdy+91;
if birthmo=5 then bbdays=birthdy+121;
if birthmo=6 then bbdays=birthdy+152;
if birthmo=7 then bbdays=birthdy+182;
if birthmo=8 then bbdays=birthdy+213;
if birthmo=9 then bbdays=birthdy+244;
if birthmo=10 then bbdays=birthdy+274;
if birthmo=11 then bbdays=birthdy+305;
if birthmo=12 then bbdays=birthdy+335;
end;
end;
***Convert days into week numbers;
** Basic Formula: used throughout this program **
** weekno=endweek{specific year}+ceil[(totdays+{# of days remaining in DEC})/7] **
/* Default age 14 week = 9999 */
age14wk=9999;
if age14yr>0 and bbdays>0 then do;
if age14yr=1993 then do; age14wk=678+ceil((bbdays+5)/7); end;
if age14yr=1994 then do; age14wk=730+ceil((bbdays+6)/7); end;
if age14yr=1995 then do; age14wk=783+ceil((bbdays)/7); end;
if age14yr=1996 then do; age14wk=835+ceil((bbdays+1)/7); end;
if age14yr=1997 then do; age14wk=887+ceil((bbdays+3)/7); end;
if age14yr=1998 then do; age14wk=939+ceil((bbdays+4)/7); end;
if age14yr=1999 then do; age14wk=991+ceil((bbdays+5)/7); end;
if age14yr=2000 then do; age14wk=1043+ceil((bbdays+6)/7); end;
end;
** Calulate Age 18 year **
AGE18YR=birthyr+18;
** Convert Age 18 Birthdate to week number **
***Convert age18 month and day to total days (bbdays);
if birthmo>0 and birthdy>0 then do;
if birthmo=1 then bbdays=birthdy;
if birthmo=2 then bbdays=birthdy+31;
if birthmo=3 then bbdays=birthdy+59;
if birthmo=4 then bbdays=birthdy+90;
if birthmo=5 then bbdays=birthdy+120;
if birthmo=6 then bbdays=birthdy+151;
if birthmo=7 then bbdays=birthdy+181;
if birthmo=8 then bbdays=birthdy+212;
if birthmo=9 then bbdays=birthdy+243;
if birthmo=10 then bbdays=birthdy+273;
if birthmo=11 then bbdays=birthdy+304;
if birthmo=12 then bbdays=birthdy+334;
end;
***Account for leap years;
if age18yr=1980 or age18yr=1984 or age18yr=1988 or age18yr=1992 or age18yr=1996 or age18yr=2000 then do;
if birthmo>0 and birthdy>0 then do;
if birthmo=1 then bbdays=birthdy;
if birthmo=2 then bbdays=birthdy+31;
if birthmo=3 then bbdays=birthdy+60;
if birthmo=4 then bbdays=birthdy+91;
if birthmo=5 then bbdays=birthdy+121;
if birthmo=6 then bbdays=birthdy+152;
if birthmo=7 then bbdays=birthdy+182;
if birthmo=8 then bbdays=birthdy+213;
if birthmo=9 then bbdays=birthdy+244;
if birthmo=10 then bbdays=birthdy+274;
if birthmo=11 then bbdays=birthdy+305;
if birthmo=12 then bbdays=birthdy+335;
end;
end;
***Convert days into week numbers;
/* Default age 14 week = 9999 */
age18wk=9999;
if age18yr>0 and bbdays>0 then do;
if age18yr=1997 then do; age18wk=887+ceil((bbdays+3)/7); ag18jan=888; end;
if age18yr=1998 then do; age18wk=939+ceil((bbdays+4)/7); ag18jan=940; end;
if age18yr=1999 then do; age18wk=991+ceil((bbdays+5)/7); ag18jan=992; end;
if age18yr=2000 then do; age18wk=1043+ceil((bbdays+6)/7); ag18jan=1044; end;
if age18yr=2001 then do; age18wk=1096+ceil((bbdays+1)/7); ag18jan=1097; end;
if age18yr=2002 then do; age18wk=1148+ceil((bbdays+2)/7); ag18jan=1149; end;
end;
** Calulate Age 20 week **
AGE20YR=birthyr+20;
** Convert Age 20 Birthdate to week number **
***Convert age20 month and day to total days (bbdays);
if birthmo>0 and birthdy>0 then do;
if birthmo=1 then bbdays=birthdy;
if birthmo=2 then bbdays=birthdy+31;
if birthmo=3 then bbdays=birthdy+59;
if birthmo=4 then bbdays=birthdy+90;
if birthmo=5 then bbdays=birthdy+120;
if birthmo=6 then bbdays=birthdy+151;
if birthmo=7 then bbdays=birthdy+181;
if birthmo=8 then bbdays=birthdy+212;
if birthmo=9 then bbdays=birthdy+243;
if birthmo=10 then bbdays=birthdy+273;
if birthmo=11 then bbdays=birthdy+304;
if birthmo=12 then bbdays=birthdy+334;
end;
***Account for leap years;
if age18yr=1980 or age18yr=1984 or age18yr=1988 or age18yr=1992 or age18yr=1996 or age18yr=2000 then do;
if birthmo>0 and birthdy>0 then do;
if birthmo=1 then bbdays=birthdy;
if birthmo=2 then bbdays=birthdy+31;
if birthmo=3 then bbdays=birthdy+60;
if birthmo=4 then bbdays=birthdy+91;
if birthmo=5 then bbdays=birthdy+121;
if birthmo=6 then bbdays=birthdy+152;
if birthmo=7 then bbdays=birthdy+182;
if birthmo=8 then bbdays=birthdy+213;
if birthmo=9 then bbdays=birthdy+244;
if birthmo=10 then bbdays=birthdy+274;
if birthmo=11 then bbdays=birthdy+305;
if birthmo=12 then bbdays=birthdy+335;
end;
end;
***Convert days into week numbers;
/* Default age 20 week = 9999 */
age20wk=9999;
if age20yr>0 and bbdays>0 then do;
if age20yr=1999 then do; age20wk=991+ceil((bbdays+5)/7); end;
if age20yr=2000 then do; age20wk=1043+ceil((bbdays+6)/7); end;
if age20yr=2001 then do; age20wk=1096+ceil((bbdays+1)/7); end;
if age20yr=2002 then do; age20wk=1148+ceil((bbdays+2)/7); end;
if age20yr=2003 then do; age20wk=1200+ceil((bbdays+3)/7); end;
if age20yr=2004 then do; age20wk=1252+ceil((bbdays+4)/7); end;
end;
** Convert Birthdate to week number **
/* Default birthdate week=0 if birthdate < 12/30/79 */
birthwk=0;
if birthyr>0 and bbdays>0 then do;
if birthyr=1980 then do; birthwk=ceil((bbdays+2)/7); end;
if birthyr=1981 then do; birthwk=52+ceil((bbdays+4)/7); end;
if birthyr=1982 then do; birthwk=104+ceil((bbdays+5)/7); end;
if birthyr=1983 then do; birthwk=156+ceil((bbdays+6)/7); end;
if birthyr=1984 then do; birthwk=209+ceil((bbdays)/7); end;
if birthyr=1985 then do; birthwk=261+ceil((bbdays+2)/7); end;
end;
** Convert Round 5 Interview Date to week number **;
***Convert interview month and day to total days (intdays);
if r5INT_M>0 and r5INT_D>0 then do;
if r5INT_M=1 then intdays=r5INT_D;
if r5INT_M=2 then intdays=r5INT_D+31;
if r5INT_M=3 then intdays=r5INT_D+59;
if r5INT_M=4 then intdays=r5INT_D+90;
if r5INT_M=5 then intdays=r5INT_D+120;
if r5INT_M=6 then intdays=r5INT_D+151;
if r5INT_M=7 then intdays=r5INT_D+181;
if r5INT_M=8 then intdays=r5INT_D+212;
if r5INT_M=9 then intdays=r5INT_D+243;
if r5INT_M=10 then intdays=r5INT_D+273;
if r5INT_M=11 then intdays=r5INT_D+304;
if r5INT_M=12 then intdays=r5INT_D+334;
end;
***Convert days into week numbers;
/* Default interview week = 9999 */
intwk=9999;
if r5INT_Y>0 and intdays>0 then do;
if r5INT_Y=2001 then do; INTWK=1096+ceil((intdays+1)/7); end;
if r5INT_y=2002 then do; intwk=1148+ceil((intdays+2)/7); end;
end;
** Convert Round 4 Interview Date to week number **;
***Convert interview month and day to total days (r4days);
if R4INT_M>0 and R4INT_D>0 then do;
if R4INT_M=1 then r4days=R4INT_D;
if R4INT_M=2 then r4days=R4INT_D+31;
if R4INT_M=3 then r4days=R4INT_D+59;
if R4INT_M=4 then r4days=R4INT_D+90;
if R4INT_M=5 then r4days=R4INT_D+120;
if R4INT_M=6 then r4days=R4INT_D+151;
if R4INT_M=7 then r4days=R4INT_D+181;
if R4INT_M=8 then r4days=R4INT_D+212;
if R4INT_M=9 then r4days=R4INT_D+243;
if R4INT_M=10 then r4days=R4INT_D+273;
if R4INT_M=11 then r4days=R4INT_D+304;
if R4INT_M=12 then r4days=R4INT_D+334;
end;
***Account for leap year 2000;
if R4INT_M>0 and R4INT_D>0 and R4INT_Y=2000 then do;
if R4INT_M=1 then r4days=R4INT_D;
if R4INT_M=2 then r4days=R4INT_D+31;
if R4INT_M=3 then r4days=R4INT_D+60;
if R4INT_M=4 then r4days=R4INT_D+91;
if R4INT_M=5 then r4days=R4INT_D+121;
if R4INT_M=6 then r4days=R4INT_D+152;
if R4INT_M=7 then r4days=R4INT_D+182;
if R4INT_M=8 then r4days=R4INT_D+213;
if R4INT_M=9 then r4days=R4INT_D+244;
if R4INT_M=10 then r4days=R4INT_D+274;
if R4INT_M=11 then r4days=R4INT_D+305;
if R4INT_M=12 then r4days=R4INT_D+335;
end;
***Convert days into week numbers;
/* Default interview week = 9999 */
r4int=9999;
if R4INT_Y>0 and r4days>0 then do;
if R4INT_Y=2000 then do; r4INT=1043+ceil((r4days+6)/7); end;
if R4INT_y=2001 then do; r4int=1096+ceil((r4days+1)/7); end;
end;
** Convert Round 3 Interview Date to week number **;
***Convert interview month and day to total days (r3days);
if R3INT_M>0 and R3INT_D>0 then do;
if R3INT_M=1 then r3days=R3INT_D;
if R3INT_M=2 then r3days=R3INT_D+31;
if R3INT_M=3 then r3days=R3INT_D+59;
if R3INT_M=4 then r3days=R3INT_D+90;
if R3INT_M=5 then r3days=R3INT_D+120;
if R3INT_M=6 then r3days=R3INT_D+151;
if R3INT_M=7 then r3days=R3INT_D+181;
if R3INT_M=8 then r3days=R3INT_D+212;
if R3INT_M=9 then r3days=R3INT_D+243;
if R3INT_M=10 then r3days=R3INT_D+273;
if R3INT_M=11 then r3days=R3INT_D+304;
if R3INT_M=12 then r3days=R3INT_D+334;
end;
***Account for leap year 2000;
if R3INT_M>0 and R3INT_D>0 and R3INT_Y=2000 then do;
if R3INT_M=1 then r3days=R3INT_D;
if R3INT_M=2 then r3days=R3INT_D+31;
if R3INT_M=3 then r3days=R3INT_D+60;
if R3INT_M=4 then r3days=R3INT_D+91;
if R3INT_M=5 then r3days=R3INT_D+121;
if R3INT_M=6 then r3days=R3INT_D+152;
if R3INT_M=7 then r3days=R3INT_D+182;
if R3INT_M=8 then r3days=R3INT_D+213;
if R3INT_M=9 then r3days=R3INT_D+244;
if R3INT_M=10 then r3days=R3INT_D+274;
if R3INT_M=11 then r3days=R3INT_D+305;
if R3INT_M=12 then r3days=R3INT_D+335;
end;
***Convert days into week numbers;
/* Default interview week = 9999 */
r3int=9999;
if R3INT_Y>0 and r3days>0 then do;
if R3INT_Y=1999 then do; r3INT=991+ceil((r3days+5)/7); end;
if R3INT_y=2000 then do; r3int=1043+ceil((r3days+6)/7); end;
end;
** Convert Date of Round 2 interview to week number **
***Convert interview month and day to total days (rd2days);
if R2INT_M>0 and R2INT_D>0 then do;
if R2INT_M=1 then rd2days=R2INT_D;
if R2INT_M=2 then rd2days=R2INT_D+31;
if R2INT_M=3 then rd2days=R2INT_D+59;
if R2INT_M=4 then rd2days=R2INT_D+90;
if R2INT_M=5 then rd2days=R2INT_D+120;
if R2INT_M=6 then rd2days=R2INT_D+151;
if R2INT_M=7 then rd2days=R2INT_D+181;
if R2INT_M=8 then rd2days=R2INT_D+212;
if R2INT_M=9 then rd2days=R2INT_D+243;
if R2INT_M=10 then rd2days=R2INT_D+273;
if R2INT_M=11 then rd2days=R2INT_D+304;
if R2INT_M=12 then rd2days=R2INT_D+334;
end;
***Convert days into week numbers;
/* Default interview week = 9999 */
R2INT=9999;
if R2INT_Y>0 and rd2days>0 then do;
if R2INT_Y=1998 then do; R2INT=939+ceil((rd2days+4)/7); end;
end;
if R2INT_Y>0 and rd2days>0 then do;
if R2INT_Y=1999 then do; R2INT=991+ceil((rd2days+5)/7); end;
end;
** Convert Date of First Interview (Round 1) to week number **
***Convert interview month and day to total days (rd1days);
if R1INT_M>0 and R1INT_D>0 then do;
if R1INT_M=1 then rd1days=R1INT_D;
if R1INT_M=2 then rd1days=R1INT_D+31;
if R1INT_M=3 then rd1days=R1INT_D+59;
if R1INT_M=4 then rd1days=R1INT_D+90;
if R1INT_M=5 then rd1days=R1INT_D+120;
if R1INT_M=6 then rd1days=R1INT_D+151;
if R1INT_M=7 then rd1days=R1INT_D+181;
if R1INT_M=8 then rd1days=R1INT_D+212;
if R1INT_M=9 then rd1days=R1INT_D+243;
if R1INT_M=10 then rd1days=R1INT_D+273;
if R1INT_M=11 then rd1days=R1INT_D+304;
if R1INT_M=12 then rd1days=R1INT_D+334;
end;
***Convert days into week numbers;
/* Hand edits carried over from Round 2 */
if (pubid= 2 or pubid=5615 or pubid=5902) then do; r1int_y=1997; end;
/* Default interview week = 9999 */
R1INT=9999;
if R1INT_Y>0 and rd1days>0 then do;
if R1INT_Y=1997 then do; R1INT=887+ceil((rd1days+3)/7); end;
end;
if R1INT_Y>0 and rd1days>0 then do;
if R1INT_Y=1998 then do; R1INT=939+ceil((rd1days+4)/7); end;
end;
/* Hand edits carried over from Round 2 interview program */
if pubid in (471,476) then do; r2int=990; r2int_y=1998; end;
if pubid=7315 then do; r1int=919; r1int_y=1997; end;
/* Done to create a seamless flow between rounds */
intwk=intwk-1;
/* Round 2 non-interview case */ if r2int_d=-5 then r2int=-5;
/* Round 3 non-interview case */ if r3int_d=-5 then r3int=-5;
/* Round 4 non-interview case */ if r4int_d=-5 then r4int=-5;
/* Round 5 non-interview case */ if e200=-5 then intwk=-5;
/**************** Section 3: Convert Start/Stop dates into NLSY97 week numbers ****************/
/* This section reads in raw start and stop dates for each job (max=9) and converts them into NLSY97
week numbers. Some start/stop DAYS and MONTHS have been imputed if missing. */
/* ostartm represents the "old" start dates, used when start dates are updated to interview dates. */
array ostartm (i) ostarmo1-ostarmo8;
array ostartd (i) ostardy1-ostardy8;
array ostarty (i) ostaryr1-ostaryr8;
array ostopm (i) ostopmo1-ostopmo8;
array ostopd (i) ostopdy1-ostopdy8;
array ostopy (i) ostopyr1-ostopyr8;
array startm (i) starmo1-starmo8;
array startd (i) stardy1-stardy8;
array starty (i) staryr1-staryr8;
array stopm (i) stopmo1-stopmo8;
array stopd (i) stopdy1-stopdy8;
array stopy (i) stopyr1-stopyr8;
array UID (i) UID1-UID8;
array sttdays (i) sttday1-sttday8; /* total days in that year from startdate (to Jan 1) */
array stpdays (i) stpday1-stpday8; /* total days in that year from stopdate (to Jan 1) */
array startwk (i) starw1-starw8;
array stopwk (i) stopw1-stopw8;
array srflag (i) srflg1-srflg8;
array spflag (i) spflg1-spflg8;
array uflag (i) uflag1-uflag8; /* uflag=1 when job startdate is updated */
array smofl (i) smofl1-smofl8; /* dummy equals 1 when a start month is imputed */
array emofl (i) emofl1-emofl8; /* dummy equals 1 when a stop month is imputed */
array self (i) self1-self8;
/* Establish dli interview round */
if r4int_y>0 then do;
dli_y=r4int_y;
dli_m=r4int_m;
dli_d=r4int_d;
dliwk=r4int;
r4dli=1;
end;
if r4int_y=-5 and r3int_y>0 then do;
dli_y=r3int_y;
dli_m=r3int_m;
dli_d=r3int_d;
dliwk=r3int;
r3dli=1;
end;
if r4int_y=-5 and r3int_y=-5 and r2int_y>0 then do;
dli_y=r2int_y;
dli_m=r2int_m;
dli_d=r2int_d;
dliwk=r2int;
r2dli=1;
end;
if r4int_y=-5 and r3int_y=-5 and r2int_y=-5 and r1int_y>0 then do;
dli_y=r1int_y;
dli_m=r1int_m;
dli_d=r1int_d;
dliwk=r1int;
r1dli=1;
end;
/* Initialize smofl and emofl */
do i=1 to 8;
smofl=0; emofl=0;
end;
/* Define old start and stop dates */
do i=1 to 8;
ostartm=startm;
ostartd=startd;
ostarty=starty;
ostopm=stopm;
ostopd=stopd;
ostopy=stopy;
end;
***Fill-in start/stop day for those missing;
/* flag1 = impute start day (valid month)
flag2 = impute start month (valid day)
flag3 = impute start day and month
flag4 = impute stop day (valid month)
flag5 = impute stop month (valid day)
flag6 = impute stop day and month */
array flag1 (i) flag11-flag18;
array flag2 (i) flag21-flag28;
array flag3 (i) flag31-flag38;
array flag4 (i) flag41-flag48;
array flag5 (i) flag51-flag58;
array flag6 (i) flag61-flag68;
do i=1 to 8;
flag1=-4;
flag2=-4;
flag3=-4;
flag4=-4;
flag5=-4;
flag6=-4;
end;
/* We are now inputing missing start days to 1, missing stop days to 28, missing start months to 1 (Jan.) and missing stop months to 12 (Dec.). */
/* Reset flag(1-3) to zero when the start year is valid */
do over starty;
if starty>0 then do;
flag1=0; flag2=0; flag3=0;
if startm>0 and startd<=0 then do;
startd=1;
flag1=1;
srflag=1;
end;
if startm<=0 and startd>0 then do;
startm=1;
flag2=1;
srflag=1;
smofl=1;
end;
if startm<=0 and startd<=0 then do;
startm=1;
startd=1;
flag3=1;
srflag=1;
smofl=1;
end;
end;
end;
do over stopy;
if stopy>0 then do;
flag4=0; flag5=0; flag6=0;
if stopm>0 and stopd<=0 then do;
stopd=28;
flag4=1;
spflag=1;
end;
if stopm<=0 and stopd>0 then do;
stopm=12;
flag5=1;
spflag=1;
emofl=1;
end;
if stopm<=0 and stopd<=0 then do;
stopm=12;
stopd=28;
flag6=1;
spflag=1;
emofl=1;
end;
/* The following lines prevent imputed values for stop months and days to exceed the Round 5 interview date. */
if stopy=r5int_y and stopm=r5int_m and stopd>r5int_d and spflag=1 then do;
stopd=r5int_d;
end;
if stopy=r5int_y and stopm>r5int_m then do;
stopm=r5int_m;
stopd=r5int_d;
end;
end;
end;
array backr (i) backr1-backr9;
do i=1 to 8;
backr=0;
end;
/* This respondent reports a previous job that begins and ends before the dli. For the Round 5 c.v.'s, this job is irrelevant. */
if pubid=3923 then do;
stardy1=-4; starmo1=-4; staryr1=-4; uid1=-4;
stopdy1=-4; stopmo1=-4; stopyr1=-4;
end;
/* The following lines of code account for the cases where the respondent has a start date for a job reported in an earlier round that comes before the dli interview date. The idea is to only count the weeks employed from dli to today. Then, the activity from previous rounds will be added to the Round 5 activity to get the full history. To achieve this, all jobs reported in earlier rounds (UID's begin with 97,98,1999, or 2000) will have their startdates updated to the dli interview date. The start week and stop week for these jobs will be counted the same. */
/* Changed "uid>0" condition to "uid>-5," since there is one respondent with UID=-3. This has not been programmed in previous rounds since no UID's in previous rounds equaled -2 or -3. */
do i=1 to 8;
uflag=0; /* Initialize uflag */
if -5<uid<200100 and startd>-4 and backr=0 then do;
if starty=dli_y and startm=dli_m and startd<dli_d and starty>0 then do;
startd=dli_d;
uflag=1;
end;
if starty=dli_y and startm<dli_m and starty>0 then do;
startm=dli_m;
startd=dli_d;
uflag=1;
end;
if starty<dli_y and starty>0 then do;
starty=dli_y;
startm=dli_m;
startd=dli_d;
uflag=1;
end;
end;
end;
***Convert START month and day to total days;
do over startm;
if startm>0 and startd>0 then do;
if startm=1 then sttdays=startd;
if startm=2 then sttdays=startd+31;
if startm=3 then sttdays=startd+59;
if startm=4 then sttdays=startd+90;
if startm=5 then sttdays=startd+120;
if startm=6 then sttdays=startd+151;
if startm=7 then sttdays=startd+181;
if startm=8 then sttdays=startd+212;
if startm=9 then sttdays=startd+243;
if startm=10 then sttdays=startd+273;
if startm=11 then sttdays=startd+304;
if startm=12 then sttdays=startd+334;
end;
end;
***Account for leap years;
do over starty;
if starty=1980 or starty=1984 or starty=1988 or starty=1992 or starty=1996 or starty=2000 then do;
if startm>0 and startd>0 then do;
if startm=1 then sttdays=startd;
if startm=2 then sttdays=startd+31;
if startm=3 then sttdays=startd+60;
if startm=4 then sttdays=startd+91;
if startm=5 then sttdays=startd+121;
if startm=6 then sttdays=startd+152;
if startm=7 then sttdays=startd+182;
if startm=8 then sttdays=startd+213;
if startm=9 then sttdays=startd+244;
if startm=10 then sttdays=startd+274;
if startm=11 then sttdays=startd+305;
if startm=12 then sttdays=startd+335;
end;
end;
end;
***Convert STOP month and day to total days;
do over stopm;
if stopm>0 and stopd>0 then do;
if stopm=1 then stpdays=stopd;
if stopm=2 then stpdays=stopd+31;
if stopm=3 then stpdays=stopd+59;
if stopm=4 then stpdays=stopd+90;
if stopm=5 then stpdays=stopd+120;
if stopm=6 then stpdays=stopd+151;
if stopm=7 then stpdays=stopd+181;
if stopm=8 then stpdays=stopd+212;
if stopm=9 then stpdays=stopd+243;
if stopm=10 then stpdays=stopd+273;
if stopm=11 then stpdays=stopd+304;
if stopm=12 then stpdays=stopd+334;
end;
end;
***Account for leap years;
do over stopy;
if stopy=1980 or stopy=1984 or stopy=1988 or stopy=1992 or stopy=1996 or stopy=2000 then do;
if stopm>0 and stopd>0 then do;
if stopm=1 then stpdays=stopd;
if stopm=2 then stpdays=stopd+31;
if stopm=3 then stpdays=stopd+60;
if stopm=4 then stpdays=stopd+91;
if stopm=5 then stpdays=stopd+121;
if stopm=6 then stpdays=stopd+152;
if stopm=7 then stpdays=stopd+182;
if stopm=8 then stpdays=stopd+213;
if stopm=9 then stpdays=stopd+244;
if stopm=10 then stpdays=stopd+274;
if stopm=11 then stpdays=stopd+305;
if stopm=12 then stpdays=stopd+335;
end;
end;
end;
***Convert days into week numbers;
/* Create year flag variable */
array byear (i) byear1-byear9;
array eyear (i) eyear1-eyear9;
do over starty;
if starty>0 and sttdays>0 then do;
if starty=1980 then do; startwk=ceil((sttdays+2)/7); end;
if starty=1981 then do; startwk=52+ceil((sttdays+4)/7); end;
if starty=1982 then do; startwk=104+ceil((sttdays+5)/7); end;
if starty=1983 then do; startwk=156+ceil((sttdays+6)/7); end;
if starty=1984 then do; startwk=209+ceil((sttdays)/7); end;
if starty=1985 then do; startwk=261+ceil((sttdays+2)/7); end;
if starty=1986 then do; startwk=313+ceil((sttdays+3)/7); end;
if starty=1987 then do; startwk=365+ceil((sttdays+4)/7); end;
if starty=1988 then do; startwk=417+ceil((sttdays+5)/7); end;
if starty=1989 then do; startwk=470+ceil((sttdays)/7); end;
if starty=1990 then do; startwk=522+ceil((sttdays+1)/7); end;
if starty=1991 then do; startwk=574+ceil((sttdays+2)/7); end;
if starty=1992 then do; startwk=626+ceil((sttdays+3)/7); end;
if starty=1993 then do; startwk=678+ceil((sttdays+5)/7); end;
if starty=1994 then do; startwk=730+ceil((sttdays+6)/7); end;
if starty=1995 then do; startwk=783+ceil((sttdays)/7); end;
if starty=1996 then do; startwk=835+ceil((sttdays+1)/7); end;
if starty=1997 then do; startwk=887+ceil((sttdays+3)/7); end;
if starty=1998 then do; startwk=939+ceil((sttdays+4)/7); end;
if starty=1999 then do; startwk=991+ceil((sttdays+5)/7); end;
if starty=2000 then do; startwk=1043+ceil((sttdays+6)/7); end;
if starty=2001 then do; startwk=1096+ceil((sttdays+1)/7); end;
if starty=2002 then do; startwk=1148+ceil((sttdays+2)/7); end;
end;
if starty<0 and starty>-4 then do;
startwk=-3;
end;
if -4<ostarty<0 then byear=1;
end;
do over stopy;
if stopy>0 and stpdays>0 then do;
if stopy=1980 then do; stopwk=ceil((stpdays+2)/7); end;
if stopy=1981 then do; stopwk=52+ceil((stpdays+4)/7); end;
if stopy=1982 then do; stopwk=104+ceil((stpdays+5)/7); end;
if stopy=1983 then do; stopwk=156+ceil((stpdays+6)/7); end;
if stopy=1984 then do; stopwk=209+ceil((stpdays)/7); end;
if stopy=1985 then do; stopwk=261+ceil((stpdays+2)/7); end;
if stopy=1986 then do; stopwk=313+ceil((stpdays+3)/7); end;
if stopy=1987 then do; stopwk=365+ceil((stpdays+4)/7); end;
if stopy=1988 then do; stopwk=417+ceil((stpdays+5)/7); end;
if stopy=1989 then do; stopwk=470+ceil((stpdays)/7); end;
if stopy=1990 then do; stopwk=522+ceil((stpdays+1)/7); end;
if stopy=1991 then do; stopwk=574+ceil((stpdays+2)/7); end;
if stopy=1992 then do; stopwk=626+ceil((stpdays+3)/7); end;
if stopy=1993 then do; stopwk=678+ceil((stpdays+5)/7); end;
if stopy=1994 then do; stopwk=730+ceil((stpdays+6)/7); end;
if stopy=1995 then do; stopwk=783+ceil((stpdays)/7); end;
if stopy=1996 then do; stopwk=835+ceil((stpdays+1)/7); end;
if stopy=1997 then do; stopwk=887+ceil((stpdays+3)/7); end;
if stopy=1998 then do; stopwk=939+ceil((stpdays+4)/7); end;
if stopy=1999 then do; stopwk=991+ceil((stpdays+5)/7); end;
if stopy=2000 then do; stopwk=1043+ceil((stpdays+6)/7); end;
if stopy=2001 then do; stopwk=1096+ceil((stpdays+1)/7); end;
if stopy=2002 then do; stopwk=1148+ceil((stpdays+2)/7); end;
end;
if stopy<0 and stopy>-4 then do;
stopwk=-3;
end;
if -4<ostarty<0 then eyear=1;
end;
/* To create a seamless list of information from dli Round to Round 5, the following lines of code are included. By decreasing the Round 5 interview date by one, (which was done in emp_interview_r5.sas) jobs that are worked up to the interview date are also decreased by one. This is done so that the Round 5 interview week will not be counted twice for respondents with a job during that time. The same procedure is used in the previous rounds. */
do over stopwk;
if stopwk>0 and UID>0 then do;
if stopwk>intwk then do;
stopwk=intwk;
end;
end;
end;
/* The following lines considers jobs that begin the same week as the Round 5 interview date. Since we are updating
the Round 5 interview week by -1, we need to account for jobs that start in the same week or tenures of -1 will
result. */
do over startwk;
if startwk>0 and UID>0 then do;
if startwk>intwk then do;
startwk=intwk;
end;
end;
end;
/* The job start date will be cut off at the week of Jan.1 of the respondent's 18th birthday for self-employed jobs. This is done so every starts the self-employed jobs at the same point. The 18th birthday week was not chosen because too many jobs were completely eliminated using the actual 18th birthday. This method cuts off 2 jobs entirely (both the start and stop week are before Jan. 1 of the 18th birthday), and shortens 26 other jobs. */
array bself (i) bself1-bself9;
array eself (i) eself1-eself9;
do over startwk;
if self=1 and 0<startwk<=(ag18jan-1) then do;
bself=1;
bcheck=1;
end;
if self=1 and 0<startwk<=(ag18jan-1) and 0<stopwk<=(ag18jan-1) then do;
eself=1;
echeck=1;
end;
end;
do over startwk;
if bself=1 then do;
startwk=ag18jan;
end;
if eself=1 then do;
startwk=.;
stopwk=.;
end;
end;
/* To account for Round 4 non-interview cases */
if starmo1=-5 then do;
do over startwk;
startwk=-5;
stopwk=-5;
end;
end;
/* Correcting for imputed values that resulted in the start date being later than the stop date. In these cases, the imputed date will be updated to the good date. */
do i=1 to 8;
if startwk>stopwk and (flag1=1 or flag2=1 or flag3=1) then do;
startwk=stopwk;
end;
if startwk>stopwk and (flag4=1 or flag5=1 or flag6=1) then do;
stopwk=startwk;
end;
end;
/* Check for back-reporters, i.e. people that report a new job (UID>200000) that begins before the last interview date. */
do over UID;
if startwk<r4int and startwk>0 and r4int>0 then do;
back4=1;
back=1;
end;
if startwk<r3int and startwk>0 and r4int=-5 and r3int>0 then do;
back3=1;
back=1;
end;
if startwk<r2int and startwk>0 and r4int=-5 and r2int>0 and r3int=-5 then do;
back2=1;
back=1;
end;
if startwk<r1int and startwk>0 and r4int=-5 and r1int>0 and r2int=-5 and r3int=-5 then do;
back1=1;
back=1;
end;
end;
array br (i) br1-br9;
do over UID;
if startwk<dliwk and startwk>0 and dliwk>0 then do;
back=1;
br=1;
end;
end;
do over UID;
if startwk<r4int and self=1 and startwk>0 and r4int>0 then do;
back4=1;
br=1;
end;
if startwk<r3int and self=1 and startwk>0 and r4int=-5 and r3int>0 then do;
back3=1;
br=1;
end;
if startwk<r2int and self=1 and startwk>0 and r4int=-5 and r3int=-5 then do;
back2=1;
br=1;
end;
if startwk<r1int and self=1 and startwk>0 and r4int=-5 and r2int=-5 and r3int=-5 then do;
back1=1;
br=1;
end;
end;
/* The following 3 people have bad month startdates and new job UID's (e.g., 200101). The imputations set these bad start months to January, which predates their dli. */
if pubid=1648 then starw2=1050;
if pubid=8366 then starw2=1047;
if pubid=8696 then starw2=1039;
/************** Section 4: Convert dates of within-job gaps into NLSY97 week numbers. *************/
** JOB 1 GAPS **;
/* These variables are read as follows:
BGDY1_1 = Begin day of within-job gap 1 on job 1
EGMO1_5 = End month of within-job gap 5 on job 1
BGAP1_3 = Begin week of within-job gap 3 on job 1 [CREATED] */
array bgdy (i) BGDY1_1-BGDY1_6;
array bgmo (i) BGMO1_1-BGMO1_6;
array bgyr (i) BGYR1_1-BGYR1_6;
array egdy (i) EGDY1_1-EGDY1_6;
array egmo (i) EGMO1_1-EGMO1_6;
array egyr (i) EGYR1_1-EGYR1_6;
array bdays (i) bday1_1-bday1_6;
array edays (i) eday1_1-eday1_6;
array bweek (i) bgap1_1-bgap1_6;
array eweek (i) egap1_1-egap1_6;
array bflag (i) bflg1_1-bflg1_6;
array eflag (i) eflg1_1-eflg1_6;
array bgfl (i) bgfl1_1-bgfl1_6;
array egfl (i) egfl1_1-egfl1_6;
/* ONLY IMPUTE START/STOP DATES IF DAY IS MISSING */
/* Fill-in start day for those missing */
/* Missing gap days (start and stop) are now imputed to 1. Repeated without comment at each job. */
do over bgyr;
if bgyr>0 then do;
if bgmo>0 and bgdy<=0 then do;
bgdy=1;
bflag=1;
end;
if bgyr=staryr1 and bgmo=starmo1 and bgdy<stardy1 and bflag=1 then do; /* This accounts for beginning gap dates before job */
bgdy=stardy1; &nbs