Return to Appendix 2 main file
*********************************************************************
** Number of weeks worked at any job during 19## **
*********************************************************************
** This variable is created for each individual for each year of **
** potential work activity (1980-2005). respondents not working **
** in a given year are given a default value of zero (0) weeks **
** worked. Otherwise, the variable is the actual cumulative weeks **
** worked on all jobs in that year. **
** **
** Variables created: r8wks80- r8wks05 **
** r8swks80-r8swks05 **
** r8ewks80-r8ewks05 **
*********************************************************************;
array job1wks (i) w1_1-w1_1335;
array job2wks (i) w2_1-w2_1335;
array job3wks (i) w3_1-w3_1335;
array job4wks (i) w4_1-w4_1335;
array job5wks (i) w5_1-w5_1335;
array job6wks (i) w6_1-w6_1335;
array job7wks (i) w7_1-w7_1335;
array alljobs (i) wks1-wks1335;
array selfjobs (i) swks1-swks1335;
array empjobs (i) ewks1-ewks1335;
array self &R8sel;
array jobwks job1wks job2wks job3wks job4wks job5wks job6wks job7wks;
*******************************************************
** Overlay multiple jobs over work weeks **
*******************************************************;
do i=1 to 1335;
alljobs=0; selfjobs=0; empjobs=0;
end;
do over self;
do i=1 to 1335;
if jobwks=1 then alljobs=jobwks;
if jobwks=1 and self=1 then selfjobs=jobwks;
if jobwks=1 and self=0 then empjobs=jobwks;
if jobwks=-3 and alljobs=0 then alljobs=jobwks;
if jobwks=-3 and selfjobs=0 and self=1 then selfjobs=jobwks;
if jobwks=-3 and empjobs=0 and self=0 then empjobs=jobwks;
end;
end;
**********************************************************
** Calculate cumulative weeks on all jobs for each year **
**********************************************************;
array r8wks r8wks80-r8wks99 r8wks00-r8wks05;
array r8swks r8swks80-r8swks99 r8swks00-r8swks05;
array r8ewks r8ewks80-r8ewks99 r8ewks00-r8ewks05;
/* Initialize each annual c.v. */
do over r8wks;
r8wks=0;
r8swks=0;
r8ewks=0;
end;
/*Note. No jobs for 2004 begin before 1997*/
/* 1997 */
do i=888 to 939;
if alljobs=1 then r8wks97=r8wks97+1;
if selfjobs=1 then r8swks97=r8swks97+1;
if empjobs=1 then r8ewks97=r8ewks97+1;
end;
do i=888 to 939;
if alljobs=-3 then r8wks97=-3;
if selfjobs=-3 then r8swks97=-3;
if empjobs=-3 then r8ewks97=-3;
end;
/* 1998 */
do i=940 to 991;
if alljobs=1 then r8wks98=r8wks98+1;
if selfjobs=1 then r8swks98=r8swks98+1;
if empjobs=1 then r8ewks98=r8ewks98+1;
end;
do i=940 to 991;
if alljobs=-3 then r8wks98=-3;
if selfjobs=-3 then r8swks98=-3;
if empjobs=-3 then r8ewks98=-3;
end;
/* 1999 */
do i=992 to 1043;
if alljobs=1 then r8wks99=r8wks99+1;
if selfjobs=1 then r8swks99=r8swks99+1;
if empjobs=1 then r8ewks99=r8ewks99+1;
end;
do i=992 to 1043;
if alljobs=-3 then r8wks99=-3;
if selfjobs=-3 then r8swks99=-3;
if empjobs=-3 then r8ewks99=-3;
end;
/* 2000 */
do i=1044 to 1096;
if alljobs=1 then r8wks00=r8wks00+1;
if selfjobs=1 then r8swks00=r8swks00+1;
if empjobs=1 then r8ewks00=r8ewks00+1;
end;
do i=1044 to 1096;
if alljobs=-3 then r8wks00=-3;
if selfjobs=-3 then r8swks00=-3;
if empjobs=-3 then r8ewks00=-3;
end;
/* 2001 */
do i=1097 to 1148;
if alljobs=1 then r8wks01=r8wks01+1;
if selfjobs=1 then r8swks01=r8swks01+1;
if empjobs=1 then r8ewks01=r8ewks01+1;
end;
do i=1097 to 1148;
if alljobs=-3 then r8wks01=-3;
if selfjobs=-3 then r8swks01=-3;
if empjobs=-3 then r8ewks01=-3;
end;
/* 2002 */
do i=1149 to 1200;
if alljobs=1 then r8wks02=r8wks02+1;
if selfjobs=1 then r8swks02=r8swks02+1;
if empjobs=1 then r8ewks02=r8ewks02+1;
end;
do i=1149 to 1200;
if alljobs=-3 then r8wks02=-3;
if selfjobs=-3 then r8swks02=-3;
if empjobs=-3 then r8ewks02=-3;
end;
/* 2003 */
do i=1201 to 1252;
if alljobs=1 then r8wks03=r8wks03+1;
if selfjobs=1 then r8swks03=r8swks03+1;
if empjobs=1 then r8ewks03=r8ewks03+1;
end;
do i=1201 to 1252;
if alljobs=-3 then r8wks03=-3;
if selfjobs=-3 then r8swks03=-3;
if empjobs=-3 then r8ewks03=-3;
end;
/* 2004 */
do i=1253 to 1305;
if alljobs=1 then r8wks04=r8wks04+1;
if selfjobs=1 then r8swks04=r8swks04+1;
if empjobs=1 then r8ewks04=r8ewks04+1;
end;
do i=1253 to 1305;
if alljobs=-3 then r8wks04=-3;
if selfjobs=-3 then r8swks04=-3;
if empjobs=-3 then r8ewks04=-3;
end;
/* 2005 */
do i=1306 to 1334;
if alljobs=1 then r8wks05=r8wks05+1;
if selfjobs=1 then r8swks05=r8swks05+1;
if empjobs=1 then r8ewks05=r8ewks05+1;
end;
do i=1306 to 1334;
if alljobs=-3 then r8wks05=-3;
if selfjobs=-3 then r8swks05=-3;
if empjobs=-3 then r8ewks05=-3;
end;
*********************************************************************************
** Number of weeks worked at any job since last interview
date **
** Variables created: allwks, empwks, selfwks **
*********************************************************************************;
array alljobs (i) wks1-wks1335;
array selfjobs (i) swks1-swks1335;
array empjobs (i) ewks1-ewks1335;
******************************************************
** Calculate cumulative weeks on all jobs since dli **
******************************************************;
allwks=0;
selfwks=0;
empwks=0;
if dliwk>0 then do;
if dliwk=>age14wk then do;
do i=dliwk to 1335;
if alljobs=1 then do;
allwks=allwks+1;
end;
if selfjobs=1 then do;
selfwks=selfwks+1;
end;
if empjobs=1 then do;
empwks=empwks+1;
end;
end;
do i=dliwk to 1335;
if alljobs=-3 then do;
allwks=-3;
end;
if selfjobs=-3 then do;
selfwks=-3;
end;
if empjobs=-3 then do;
empwks=-3;
end;
end;
end;
if age14wk>dliwk then do;
do i=age14wk to 1335;
if alljobs=1 then do;
allwks=allwks+1;
end;
if selfjobs=1 then do;
selfwks=selfwks+1;
end;
if empjobs=1 then do;
empwks=empwks+1;
end;
end;
do i=age14wk to 1335;
if alljobs=-3 then do;
allwks=-3;
end;
if selfjobs=-3 then do;
selfwks=-3;
end;
if empjobs=-3 then do;
empwks=-3;
end;
end;
end;
end;
************************************************************************************
** Number of weeks worked at job # during each year **
************************************************************************************
** This program creates yearly variables for each potential job relating **
** the number of weeks worked. A variable is created for each potential job **
** even if the respondent has worked no jobs in a given year with the default **
** value set to zero (0). **
** **
** Variables created: r8w80_1-r8w80_7 r8w81_1-r8w81_7 r8w82_1-r8w82_7 **
** r8w83_1-r8w83_7 r8w84_1-r8w84_7 r8w85_1-r8w85_7 **
** r8w86_1-r8w86_7 r8w87_1-r8w87_7 r8w88_1-r8w88_7 **
** r8w89_1-r8w89_7 r8w90_1-r8w90_7 r8w91_1-r8w91_7 **
** r8w92_1-r8w92_7 r8w93_1-r8w93_7 r8w94_1-r8w94_7 **
** r8w95_1-r8w95_7 r8w96_1-r8w96_7 r8w97_1-r8w97_7 **
** r8w98_1-r8w98_7 r8w99_1-r8w99_7 r8w00_1-r8w00_7 **
** r8w01_1-r8w01_7 r8w02_1-r8w02_7 r8w03_1-r8w03_7 **
** r8w04_1-r8w04_7 r8w05_1-r8w05_7 **
** For example: r8w93_3 gives the number of weeks worked in 1993 on (potential)
**
** job number 3. **
** **
************************************************************************************;
array job1wks (i) w1_1-w1_1335;
array job2wks (i) w2_1-w2_1335;
array job3wks (i) w3_1-w3_1335;
array job4wks (i) w4_1-w4_1335;
array job5wks (i) w5_1-w5_1335;
array job6wks (i) w6_1-w6_1335;
array job7wks (i) w7_1-w7_1335;
array r8wks80 r8w80_1-r8w80_7;
array r8wks81 r8w81_1-r8w81_7;
array r8wks82 r8w82_1-r8w82_7;
array r8wks83 r8w83_1-r8w83_7;
array r8wks84 r8w84_1-r8w84_7;
array r8wks85 r8w85_1-r8w85_7;
array r8wks86 r8w86_1-r8w86_7;
array r8wks87 r8w87_1-r8w87_7;
array r8wks88 r8w88_1-r8w88_7;
array r8wks89 r8w89_1-r8w89_7;
array r8wks90 r8w90_1-r8w90_7;
array r8wks91 r8w91_1-r8w91_7;
array r8wks92 r8w92_1-r8w92_7;
array r8wks93 r8w93_1-r8w93_7;
array r8wks94 r8w94_1-r8w94_7;
array r8wks95 r8w95_1-r8w95_7;
array r8wks96 r8w96_1-r8w96_7;
array r8wks97 r8w97_1-r8w97_7;
array r8wks98 r8w98_1-r8w98_7;
array r8wks99 r8w99_1-r8w99_7;
array r8wks00 r8w00_1-r8w00_7;
array r8wks01 r8w01_1-r8w01_7;
array r8wks02 r8w02_1-r8w02_7;
array r8wks03 r8w03_1-r8w03_7;
array r8wks04 r8w04_1-r8w04_7;
array r8wks05 r8w05_1-r8w05_7;
array jobwks job1wks job2wks job3wks job4wks job5wks job6wks job7wks;
*****************************************************************
** Calculate cumulative weeks on individual jobs for each year **
** No jobs in 2004 begin before 1997 **
*****************************************************************;
do over r8wks80; r8wks80=0; end;
do over r8wks81; r8wks81=0; end;
do over r8wks82; r8wks82=0; end;
do over r8wks83; r8wks83=0; end;
do over r8wks84; r8wks84=0; end;
do over r8wks85; r8wks85=0; end;
do over r8wks86; r8wks86=0; end;
do over r8wks87; r8wks87=0; end;
do over r8wks88; r8wks88=0; end;
do over r8wks89; r8wks89=0; end;
do over r8wks90; r8wks90=0; end;
do over r8wks91; r8wks91=0; end;
do over r8wks92; r8wks92=0; end;
do over r8wks93; r8wks93=0; end;
do over r8wks94; r8wks94=0; end;
do over r8wks95; r8wks95=0; end;
do over r8wks96; r8wks96=0; end;
/* 1997 */
do over r8wks97; r8wks97=0;
do i=888 to 939; if jobwks=1 then r8wks97=r8wks97+1; end;
do i=888 to 939; if jobwks=-3 then r8wks97=-3; end;
end;
/* 1998 */
do over r8wks98; r8wks98=0;
do i=940 to 991; if jobwks=1 then r8wks98=r8wks98+1; end;
do i=940 to 991; if jobwks=-3 then r8wks98=-3; end;
end;
/* 1999 */
do over r8wks99; r8wks99=0;
do i=992 to 1043; if jobwks=1 then r8wks99=r8wks99+1; end;
do i=992 to 1043; if jobwks=-3 then r8wks99=-3; end;
end;
/* 2000 */
do over r8wks00; r8wks00=0;
do i=1044 to 1096; if jobwks=1 then r8wks00=r8wks00+1; end;
do i=1044 to 1096; if jobwks=-3 then r8wks00=-3; end;
end;
/* 2001 */
do over r8wks01; r8wks01=0;
do i=1097 to 1148; if jobwks=1 then r8wks01=r8wks01+1; end;
do i=1097 to 1148; if jobwks=-3 then r8wks01=-3; end;
end;
/* 2002 */
do over r8wks02; r8wks02=0;
do i=1149 to 1200; if jobwks=1 then r8wks02=r8wks02+1; end;
do i=1149 to 1200; if jobwks=-3 then r8wks02=-3; end;
end;
/* 2003 */
do over r8wks03; r8wks03=0;
do i=1201 to 1252; if jobwks=1 then r8wks03=r8wks03+1; end;
do i=1201 to 1252; if jobwks=-3 then r8wks03=-3; end;
end;
/* 2004 */
do over r8wks04; r8wks04=0;
do i=1253 to 1305; if jobwks=1 then r8wks04=r8wks04+1; end;
do i=1253 to 1305; if jobwks=-3 then r8wks04=-3; end;
end;
/* 2005 */
do over r8wks05; r8wks05=0;
do i=1306 to 1334; if jobwks=1 then r8wks05=r8wks05+1; end;
do i=1306 to 1334; if jobwks=-3 then r8wks05=-3; end;
end;
/* This program is only used as an in-file for total_tenure.sas, which combines
the dli Round created variables
for number of weeks worked in a given year. */
**************************************************************************
** Total tenure at job # as of survey date **
**************************************************************************
** This program creates a variable for each potential job (7 ) relating**
** the total length of job tenure in weeks excluding within-job gaps. **
** The default value is set to zero for non-existent jobs. **
** Created variables: r8ten1-r8ten7
**************************************************************************;
array job1wks (i) w1_1-w1_1335;
array job2wks (i) w2_1-w2_1335;
array job3wks (i) w3_1-w3_1335;
array job4wks (i) w4_1-w4_1335;
array job5wks (i) w5_1-w5_1335;
array job6wks (i) w6_1-w6_1335;
array job7wks (i) w7_1-w7_1335;
*****************************************************************
** Calculate cumulative weeks on individual jobs for all years **
*****************************************************************;
array r8ten r8ten1-r8ten7;
array jobwks job1wks job2wks job3wks job4wks job5wks job6wks job7wks;
do over r8ten; r8ten=0;
do i=1 to 1335;
if jobwks=1 then r8ten=r8ten+1;
end;
end;
do over r8ten;
do i=1 to 1335;
if jobwks=-3 then r8ten=-3;
end;
end;
/* This program is only used as an in-file for total_anhours.sas, which combines
the dli Round created
variables for number of hours worked in a given year.
*/
************************************************************************************
** Total annual hours worked at employee-type jobs during
19## **
************************************************************************************
** This program creates yearly variables aggregated across jobs relating the **
** total number of hours worked. A variable is created for each respondent **
** even if the respondent has worked no jobs in a given year with the default **
** value set to zero (0). **
** **
** There are (potentially) four hours variables used to create this variable. **
** When both "starting hours" and "current hours" are reported, I use the **
** latter to construct the annual hours measure. **
** **
** Variables created: r8hrs80-r8hrs99 r8hrs00-r8hrs05 **
** r8shrs80-r8shrs99 r8shrs00-r8shrs05 **
** r8ehrs80-r8ehrs99 r8ehrs00-r8ehrs05 **
** **
** For example: r8hrs93 gives the total hours worked on all r8 jobs in 1993. **
** **
************************************************************************************;
*** Organize hours for each job;
array starw (k) starw01- starw07;
array stopw (k) stopw01- stopw07;
array rghrsb (k) rghrsb01- rghrsb07;
array rghrs (k) rghrs01- rghrs07;
array othrs (k) othrs01- othrs07;
array hours (k) hours01- hours07;
array e23901 (k) &E23901;
array e24501 (k) &E24501;
array e34402 (k) &E34402;
array e34403 (k) &E34403;
array e34428 (k) &E34428;
array e37904 (k) &E37904;
array e38000b (k) &E38000B;
array e38000f (k) &E38000F;
array e38002 (k) &E38002;
array e38102 (k) &E38102;
array e38103 (k) &E38103;
array e38105 (k) &E38105;
array e59901 (k) &E59901;
array e88000 (k) &E88000;
array e88501 (k) &E88501;
array e98402 (k) &E98402;
array e98403 (k) &E98403;
array e98429 (k) &E98429;
array e1002252 (k) &E1002252;
array e100231 (k) &E10023102;
array e1002253 (k) &E1002253;
array e100232 (k) &E10023203;
array e226042 (k) &E226042;
array e22610 (k) &E2261002;
array e226043 (k) &E226043;
array e22611 (k) &E2261103;
***** Initialize the number of hours per week to 0;
do k=1 to 7;
rghrsb=0;
rghrs=0;
othrs=0;
hours=0;
end;
***** Regular rghrs Per Week;
do k=1 to 7;
if e23901 not in (.,-4,-5) then rghrsb=e23901;
if e34402 not in (.,-4,-5) then rghrsb=e34402;
if e34428 not in (.,-4,-5) then rghrsb=e34428;
if e22610 not in (.,-4,-5) then rghrsb=e22610;
else if e226042 lt 0 and e226042 not in (.,-4,-5) then rghrsb=-3;
if e88000 not in (.,-4,-5) then rghrsb=e88000;
if e98402 not in (.,-4,-5) then rghrsb=e98402;
if e98429 not in (.,-4,-5) then rghrsb=e98429;
if e100231 not in (.,-4,-5) then rghrsb=e100231;
else if e1002252 lt 0 and e1002252 not in (.,-4,-5) then rghrsb=-3;
if e38000f not in (.,-4,-5) then rghrsb=e38000f;
if e38002 in (.,-4,0) then rghrs=rghrsb;
else if e38002 lt 0 and e38002 ne -5 then rghrs=-3;
else if e38002 gt 0 then do;
if rghrsb gt 0 then rghrs=rghrsb-e38002;
else rghrs=-3;
end;
if e38000b lt 0 and e38000b not in (-4,-5,.) then rghrs=-3;
if e38102 in (1,3) and e38103 not in (.,-4,-5) then rghrs=e38103;
if e38102 lt 0 and e38102 not in (-4,-5, .) then rghrs=-3;
if e37904 > -4 then rghrs=e37904;
if e59901 > -4 then rghrs=e59901;
end;
***** Overtime Hours Per Week;
do k=1 to 7;
if e24501 not in (.,-4,-5) then othrs=e24501;
if e34403 not in (.,-4,-5) then othrs=e34403;
if e22611 not in (.,-4,-5) then othrs=e22611;
else if e226043 lt 0 and e226043 not in (.,-4,-5) then othrs=-3;
if e88501 not in (.,-4,-5) then othrs=e88501;
if e98403 not in (.,-4,-5) then othrs=e98403;
if e100232 not in (.,-4,-5) then othrs=e100232;
else if e1002253 lt 0 and e1002253 not in (.,-4,-5) then othrs=-3;
if e38002 not in (.,-4,-5) then othrs=e38002;
if e38105 not in (.,-4,-5) then othrs=e38105;
else if e38102 lt 0 and e38102 not in (.,-4,-5) then othrs=-3;
end;
***** Total Hours Per Week;
do k=1 to 7;
if rghrs in (-1,-2,-3) or othrs in (-1,-2,-3) then hours=-3;
else if rghrs ge 0 and othrs ge 0 then hours=rghrs + othrs;
end;
*****************************************************************
** Calculate cumulative hours on individual jobs for each year **
** Note no weeks worked on Round 8 jobs before 1997
*****************************************************************;
array self (k) &R8sel;
* total hours worked in the year;
r8hrs80=0; r8shrs80=0; r8ehrs80=0;
r8hrs81=0; r8shrs81=0; r8ehrs81=0;
r8hrs82=0; r8shrs82=0; r8ehrs82=0;
r8hrs83=0; r8shrs83=0; r8ehrs83=0;
r8hrs84=0; r8shrs84=0; r8ehrs84=0;
r8hrs85=0; r8shrs85=0; r8ehrs85=0;
r8hrs86=0; r8shrs86=0; r8ehrs86=0;
r8hrs87=0; r8shrs87=0; r8ehrs87=0;
r8hrs88=0; r8shrs88=0; r8ehrs88=0;
r8hrs89=0; r8shrs89=0; r8ehrs89=0;
r8hrs90=0; r8shrs90=0; r8ehrs90=0;
r8hrs91=0; r8shrs91=0; r8ehrs91=0;
r8hrs92=0; r8shrs92=0; r8ehrs92=0;
r8hrs93=0; r8shrs93=0; r8ehrs93=0;
r8hrs94=0; r8shrs94=0; r8ehrs94=0;
r8hrs95=0; r8shrs95=0; r8ehrs95=0;
r8hrs96=0; r8shrs96=0; r8ehrs96=0;
/* 1997 */
* created no. of weeks worked on each job;
array wks97 (k) r8w97_1-r8w97_7;
* hours worked on each job;
array ah97 (k) ah97_1-ah97_7;
array sah97 (k) sah97_1-sah97_7;
array eah97 (k) eah97_1-eah97_7;
do k=1 to 7;
ah97=0;
sah97=0;
eah97=0;
end;
do k=1 to 7;
if hours ge 0 and wks97 ge 0 then ah97=hours*wks97;
else if wks97=-3 or (hours in (-1,-2,-3) and wks97 ne 0) then ah97=-3;
if self=1 then sah97=ah97;
if self=0 then eah97=ah97;
end;
* total hours worked in the year;
r8hrs97=0;
r8shrs97=0;
r8ehrs97=0;
do k=1 to 7;
if ah97 ge 0 then r8hrs97 = r8hrs97 + ah97;
if sah97 ge 0 then r8shrs97 = r8shrs97 + sah97;
if eah97 ge 0 then r8ehrs97 = r8ehrs97 + eah97;
end;
do k=1 to 7;
if ah97=-3 then r8hrs97 = -3;
if sah97=-3 then r8shrs97 = -3;
if eah97=-3 then r8ehrs97 = -3;
end;
/* 1998 */
* created no. of weeks worked on each job;
array wks98 (k) r8w98_1-r8w98_7;
* hours worked on each job;
array ah98 (k) ah98_1-ah98_7;
array sah98 (k) sah98_1-sah98_7;
array eah98 (k) eah98_1-eah98_7;
do k=1 to 7;
ah98=0;
sah98=0;
eah98=0;
end;
do k=1 to 7;
if hours ge 0 and wks98 ge 0 then ah98=hours*wks98;
else if wks98=-3 or (hours in (-1,-2,-3) and wks98 ne 0) then ah98=-3;
if self=1 then sah98=ah98;
if self=0 then eah98=ah98;
end;
* total hours worked in the year;
r8hrs98=0;
r8shrs98=0;
r8ehrs98=0;
do k=1 to 7;
if ah98 ge 0 then r8hrs98 = r8hrs98 + ah98;
if sah98 ge 0 then r8shrs98 = r8shrs98 + sah98;
if eah98 ge 0 then r8ehrs98 = r8ehrs98 + eah98;
end;
do k=1 to 7;
if ah98=-3 then r8hrs98 = -3;
if sah98=-3 then r8shrs98 = -3;
if eah98=-3 then r8ehrs98 = -3;
end;
/* 1999 */
* created no. of weeks worked on each job;
array wks99 (k) r8w99_1-r8w99_7;
* hours worked on each job;
array ah99 (k) ah99_1-ah99_7;
array sah99 (k) sah99_1-sah99_7;
array eah99 (k) eah99_1-eah99_7;
do k=1 to 7;
ah99=0;
sah99=0;
eah99=0;
end;
do k=1 to 7;
if hours ge 0 and wks99 ge 0 then ah99=hours*wks99;
else if wks99=-3 or (hours in (-1,-2,-3) and wks99 ne 0) then ah99=-3;
if self=1 then sah99=ah99;
if self=0 then eah99=ah99;
end;
* total hours worked in the year;
r8hrs99=0;
r8shrs99=0;
r8ehrs99=0;
do k=1 to 7;
if ah99 ge 0 then r8hrs99 = r8hrs99 + ah99;
if sah99 ge 0 then r8shrs99 = r8shrs99 + sah99;
if eah99 ge 0 then r8ehrs99 = r8ehrs99 + eah99;
end;
do k=1 to 7;
if ah99=-3 then r8hrs99 = -3;
if sah99=-3 then r8shrs99 = -3;
if eah99=-3 then r8ehrs99 = -3;
end;
/* 2000 */
* created no. of weeks worked on each job;
array wks00 (k) r8w00_1-r8w00_7;
* hours worked on each job;
array ah00 (k) ah00_1-ah00_7;
array sah00 (k) sah00_1-sah00_7;
array eah00 (k) eah00_1-eah00_7;
do k=1 to 7;
ah00=0;
sah00=0;
eah00=0;
end;
do k=1 to 7;
if hours ge 0 and wks00 ge 0 then ah00=hours*wks00;
else if wks00=-3 or (hours in (-1,-2,-3) and wks00 ne 0) then ah00=-3;
if self=1 then sah00=ah00;
if self=0 then eah00=ah00;
end;
* total hours worked in the year;
r8hrs00=0;
r8shrs00=0;
r8ehrs00=0;
do k=1 to 7;
if ah00 ge 0 then r8hrs00 = r8hrs00 + ah00;
if sah00 ge 0 then r8shrs00 = r8shrs00 + sah00;
if eah00 ge 0 then r8ehrs00 = r8ehrs00 + eah00;
end;
do k=1 to 7;
if ah00=-3 then r8hrs00 = -3;
if sah00=-3 then r8shrs00 = -3;
if eah00=-3 then r8ehrs00 = -3;
end;
/* 2001 */
* created no. of weeks worked on each job;
array wks01 (k) r8w01_1-r8w01_7;
* hours worked on each job;
array ah01 (k) ah01_1-ah01_7;
array sah01 (k) sah01_1-sah01_7;
array eah01 (k) eah01_1-eah01_7;
do k=1 to 7;
ah01=0;
sah01=0;
eah01=0;
end;
do k=1 to 7;
if hours ge 0 and wks01 ge 0 then ah01=hours*wks01;
else if wks01=-3 or (hours in (-1,-2,-3) and wks01 ne 0) then ah01=-3;
if self=1 then sah01=ah01;
if self=0 then eah01=ah01;
end;
* total hours worked in the year;
r8hrs01=0;
r8shrs01=0;
r8ehrs01=0;
do k=1 to 7;
if ah01 ge 0 then r8hrs01 = r8hrs01 + ah01;
if sah01 ge 0 then r8shrs01 = r8shrs01 + sah01;
if eah01 ge 0 then r8ehrs01 = r8ehrs01 + eah01;
end;
do k=1 to 7;
if ah01=-3 then r8hrs01 = -3;
if sah01=-3 then r8shrs01 = -3;
if eah01=-3 then r8ehrs01 = -3;
end;
/* 2002 */
* created no. of weeks worked on each job;
array wks02 (k) r8w02_1-r8w02_7;
* hours worked on each job;
array ah02 (k) ah02_1-ah02_7;
array sah02 (k) sah02_1-sah02_7;
array eah02 (k) eah02_1-eah02_7;
do k=1 to 7;
ah02=0;
sah02=0;
eah02=0;
end;
do k=1 to 7;
if hours ge 0 and wks02 ge 0 then ah02=hours*wks02;
else if wks02=-3 or (hours in (-1,-2,-3) and wks02 ne 0) then ah02=-3;
if self=1 then sah02=ah02;
if self=0 then eah02=ah02;
end;
* total hours worked in the year;
r8hrs02=0;
r8shrs02=0;
r8ehrs02=0;
do k=1 to 7;
if ah02 ge 0 then r8hrs02 = r8hrs02 + ah02;
if sah02 ge 0 then r8shrs02 = r8shrs02 + sah02;
if eah02 ge 0 then r8ehrs02 = r8ehrs02 + eah02;
end;
do k=1 to 7;
if ah02=-3 then r8hrs02 = -3;
if sah02=-3 then r8shrs02 = -3;
if eah02=-3 then r8ehrs02 = -3;
end;
/* 2003 */
* created no. of weeks worked on each job;
array wks03 (k) r8w03_1-r8w03_7;
* hours worked on each job;
array ah03 (k) ah03_1-ah03_7;
array sah03 (k) sah03_1-sah03_7;
array eah03 (k) eah03_1-eah03_7;
do k=1 to 7;
ah03=0;
sah03=0;
eah03=0;
end;
do k=1 to 7;
if hours ge 0 and wks03 ge 0 then ah03=hours*wks03;
else if wks03=-3 or (hours in (-1,-2,-3) and wks03 ne 0) then ah03=-3;
if self=1 then sah03=ah03;
if self=0 then eah03=ah03;
end;
* total hours worked in the year;
r8hrs03=0;
r8shrs03=0;
r8ehrs03=0;
do k=1 to 7;
if ah03 ge 0 then r8hrs03 = r8hrs03 + ah03;
if sah03 ge 0 then r8shrs03 = r8shrs03 + sah03;
if eah03 ge 0 then r8ehrs03 = r8ehrs03 + eah03;
end;
do k=1 to 7;
if ah03=-3 then r8hrs03 = -3;
if sah03=-3 then r8shrs03 = -3;
if eah03=-3 then r8ehrs03 = -3;
end;
/* 2004 */
* created no. of weeks worked on each job;
array wks04 (k) r8w04_1-r8w04_7;
* hours worked on each job;
array ah04 (k) ah04_1-ah04_7;
array sah04 (k) sah04_1-sah04_7;
array eah04 (k) eah04_1-eah04_7;
do k=1 to 7;
ah04=0;
sah04=0;
eah04=0;
end;
do k=1 to 7;
if hours ge 0 and wks04 ge 0 then ah04=hours*wks04;
else if wks04=-3 or (hours in (-1,-2,-3) and wks04 ne 0) then ah04=-3;
if self=1 then sah04=ah04;
if self=0 then eah04=ah04;
end;
* total hours worked in the year;
r8hrs04=0;
r8shrs04=0;
r8ehrs04=0;
do k=1 to 7;
if ah04 ge 0 then r8hrs04 = r8hrs04 + ah04;
if sah04 ge 0 then r8shrs04 = r8shrs04 + sah04;
if eah04 ge 0 then r8ehrs04 = r8ehrs04 + eah04;
end;
do k=1 to 7;
if ah04=-3 then r8hrs04 = -3;
if sah04=-3 then r8shrs04 = -3;
if eah04=-3 then r8ehrs04 = -3;
end;
/* 2005 */
* created no. of weeks worked on each job;
array wks05 (k) r8w05_1-r8w05_7;
* hours worked on each job;
array ah05 (k) ah05_1-ah05_7;
array sah05 (k) sah05_1-sah05_7;
array eah05 (k) eah05_1-eah05_7;
do k=1 to 7;
ah05=0;
sah05=0;
eah05=0;
end;
do k=1 to 7;
if hours ge 0 and wks05 ge 0 then ah05=hours*wks05;
else if wks05=-3 or (hours in (-1,-2,-3) and wks05 ne 0) then ah05=-3;
if self=1 then sah05=ah05;
if self=0 then eah05=ah05;
end;
* total hours worked in the year;
r8hrs05=0;
r8shrs05=0;
r8ehrs05=0;
do k=1 to 7;
if ah05 ge 0 then r8hrs05 = r8hrs05 + ah05;
if sah05 ge 0 then r8shrs05 = r8shrs05 + sah05;
if eah05 ge 0 then r8ehrs05 = r8ehrs05 + eah05;
end;
do k=1 to 7;
if ah05=-3 then r8hrs05 = -3;
if sah05=-3 then r8shrs05 = -3;
if eah05=-3 then r8ehrs05 = -3;
end;
/* This program is only used as an in-file for total_wksage14.sas, which
combines the dli Round created
variables for number of weeks worked since age 14.
Variables created: r8ewks14 r8wks14 r8ewks20 r8wks20.
r8ewks14 (r8wks14) is the number of weeks worked at employee-type job (all jobs)
between age 14 and age 20.
r8ewks20 (r8wks20) is the number of weeks worked at employee-type job (all jobs)
since age 20.
*/
********************************************************************
** Number of weeks worked at employee-type job since AGE 14
**
********************************************************************;
array alljobs (i) wks1-wks1335;
array empjobs (i) ewks1-ewks1335;
*********************************************************
** Calculate cumulative weeks on all jobs since age 14 **
*********************************************************;
r8ewks14=0;
r8wks14=0;
r8ewks20=0;
r8wks20=0;
/* The min. of age14wk (age20wk) is 731 (1044). The max. of age14wk (age20wk) is
992 (1305).
All values of age14wk (age20wk) are positive. */
/* r8wks14 */
if age14wk>0 and (age20wk-1)<=1335 then do;
do i=age14wk to (age20wk-1);
if alljobs=1 then do;
r8wks14=r8wks14+1;
end;
end;
do i=age14wk to (age20wk-1);
if alljobs=-3 then do;
r8wks14=-3;
end;
end;
end;
if age14wk>0 and (age20wk-1)>1335 then do;
do i=age14wk to 1335;
if alljobs=1 then do;
r8wks14=r8wks14+1;
end;
end;
do i=age14wk to 1335;
if alljobs=-3 then do;
r8wks14=-3;
end;
end;
end;
/* r8ewks14 */
if age14wk>0 and (age20wk-1)<=1335 then do;
do i=age14wk to (age20wk-1);
if empjobs=1 then do;
r8ewks14=r8ewks14+1;
end;
end;
do i=age14wk to (age20wk-1);
if empjobs=-3 then do;
r8ewks14=-3;
end;
end;
end;
if age14wk>0 and (age20wk-1)>1335 then do;
do i=age14wk to 1335;
if empjobs=1 then do;
r8ewks14=r8ewks14+1;
end;
end;
do i=age14wk to 1335;
if empjobs=-3 then do;
r8ewks14=-3;
end;
end;
end;
/* r8wks20 */
if age14wk>0 and age20wk<=1335 then do;
do i=age20wk to 1335;
if alljobs=1 then do;
r8wks20=r8wks20+1;
end;
end;
do i=age20wk to 1335;
if alljobs=-3 then do;
r8wks20=-3;
end;
end;
end;
/* r8ewks20 */
if age14wk>0 and age20wk<=1335 then do;
do i=age20wk to 1335;
if empjobs=1 then do;
r8ewks20=r8ewks20+1;
end;
end;
do i=age20wk to 1335;
if empjobs=-3 then do;
r8ewks20=-3;
end;
end;
end;
/* This program is only used as an in-file for total_hrsage14.sas, which
combines the dli Round created
variables for number of hours worked since age 14.
*/
************************************************************************************
** Cumulative hours worked since age 14/20 as of the
interview date **
************************************************************************************
** This program creates a variable aggregated across jobs relating the total **
** number of hours worked since turning age 14 & 20. A variable is created for
**
** each respondent even if the respondent has never worked with the default **
** value set to zero (0). **
** **
** Variables created: r8hrs14 r8ehrs14 r8hrs20 r8ehrs20 **
** **
** r8hrs14 (r8ehrs14) is the number of hours (employee-type job hours) worked **
** between age 14 and 20. **
** r8hrs20 (r8ehrs20) is the number of hours (employee-type job hours) worked **
** since age 20.
************************************************************************************;
********************************************************************
** Calculate cumulative weeks on each job since age 14/20 **
********************************************************************;
array job1wks (i) w1_1-w1_1335;
array job2wks (i) w2_1-w2_1335;
array job3wks (i) w3_1-w3_1335;
array job4wks (i) w4_1-w4_1335;
array job5wks (i) w5_1-w5_1335;
array job6wks (i) w6_1-w6_1335;
array job7wks (i) w7_1-w7_1335;
/* Initialize created variables */
r8hrs14=0;
r8ehrs14=0;
r8hrs20=0;
r8ehrs20=0;
/* Read "wks1405" as the number of weeks worked between the ages of 14 and 19,
for job 5 only.
Read "hrs1405" as the number of hours worked between the ages of 14 and 19, for
job 5 only.
Read "ehrs1405" as the number of employee-type job hours worked between the ages
of 14 and 19, for job 5 only.
Read "wks2005" as the number of weeks worked since age 20, for job 5 only.
Read "hrs2005" as the number of hours worked since age 20, for job 5 only.
Read "ehrs2005" as the number of employee-type job hours worked since age 20,
for job 5 only. */
array hours hours01-hours07;
array self &R8sel;
array wks14 wks1401-wks1407;
array hrs14 hrs1401-hrs1407;
array ehrs14 ehrs1401-ehrs1407;
array wks20 wks2001-wks2007;
array hrs20 hrs2001-hrs2007;
array ehrs20 ehrs2001-ehrs2007;
array jobwks job1wks job2wks job3wks job4wks job5wks job6wks job7wks ;
do over wks14;
wks14=0;
hrs14=0;
ehrs14=0;
wks20=0;
hrs20=0;
ehrs20=0;
end;
*********************** the created variable for "since age 14";
/* The ending week number for the count of "age14-age19" depending on whether
respondents turn to age 20 or not. */
end14wk=min(age20wk-1, 1335);
/* The number of weeks worked on each job since age 14 */
do over wks14;
do i=age14wk to end14wk;
if jobwks=1 then wks14=wks14+1;
end;
do i=age14wk to end14wk;
if jobwks=-3 then wks14=-3;
end;
end;
* The number of hours worked on each job since age 14;
do over hours;
if hours ge 0 and wks14 ge 0 then hrs14=hours*wks14;
else if wks14=-3 or (hours in (-1,-2,-3) and wks14 ne 0) then hrs14=-3;
if self=0 then ehrs14=hrs14;
end;
* The total number of hours worked since age 14;
do over hrs14;
if hrs14 ge 0 then r8hrs14 = r8hrs14 + hrs14;
if ehrs14 ge 0 then r8ehrs14 = r8ehrs14 + ehrs14;
end;
do over hrs14;
if hrs14=-3 then r8hrs14=-3;
if ehrs14=-3 then r8ehrs14=-3;
end;
***************** The created variable for "since age 20";
if age14wk>0 and age20wk<=1335 then do;
* The number of weeks worked since age 20 for the respondents who have turned 20
by Round 8;
do over wks20;
do i=age20wk to 1335;
if jobwks=1 then wks20=wks20+1;
end;
do i=age20wk to 1335;
if jobwks=-3 then wks20=-3;
end;
end;
end;
* The number of hours worked since age 20 for the respondents who have turned 20
by Round 8;
do over hrs20;
if hours ge 0 and wks20 ge 0 then hrs20=hours*wks20;
else if wks20=-3 or (hours in (-1,-2,-3) and wks20 ne 0) then hrs20=-3;
if self=0 then ehrs20=hrs20;
end;
* The total number of hours worked since age 20;
do over hrs20;
if hrs20 ge 0 then r8hrs20 = r8hrs20 + hrs20;
if ehrs20 ge 0 then r8ehrs20 = r8ehrs20 + ehrs20;
end;
do over hrs20;
if hrs20=-3 then r8hrs20=-3;
if ehrs20=-3 then r8ehrs20=-3;
end;
/* This program is only used as an in-file for total_numjobs.sas, which combines
the dli Round created
variables for number of jobs in a given year. */
**********************************************************************
** Number of jobs held during 19## **
** (conditional on having worked at least 1 week during that year) **
** **
** Created Variables: r8job80-r8job99 r8job00-r8job05 **
** r8self80-r8self99 r8self00-r8self04 **
** r8emp80-r8emp99 r8emp00-r8emp04 **
** **
** e.g. r8job93 (r8self93, r8emp93) is the number of jobs **
** (self-employed jobs, employee-type jobs) worked in year 1993. **
** **
**********************************************************************;
array job1wks (i) w1_1-w1_1335;
array job2wks (i) w2_1-w2_1335;
array job3wks (i) w3_1-w3_1335;
array job4wks (i) w4_1-w4_1335;
array job5wks (i) w5_1-w5_1335;
array job6wks (i) w6_1-w6_1335;
array job7wks (i) w7_1-w7_1335;
*******************************************************************
** Indicate if worked at least one week on a job in a given year **
** Note no weeks worked in Round8 before 1997 **
*******************************************************************;
r8job80 =0; r8self80=0; r8emp80 =0;
r8job81 =0; r8self81=0; r8emp81 =0;
r8job82 =0; r8self82=0; r8emp82 =0;
r8job83 =0; r8self83=0; r8emp83 =0;
r8job84 =0; r8self84=0; r8emp84 =0;
r8job85 =0; r8self85=0; r8emp85 =0;
r8job86 =0; r8self86=0; r8emp86 =0;
r8job87 =0; r8self87=0; r8emp87 =0;
r8job88 =0; r8self88=0; r8emp88 =0;
r8job89 =0; r8self89=0; r8emp89 =0;
r8job90 =0; r8self90=0; r8emp90 =0;
r8job91 =0; r8self91=0; r8emp91 =0;
r8job92 =0; r8self92=0; r8emp92 =0;
r8job93 =0; r8self93=0; r8emp93 =0;
r8job94 =0; r8self94=0; r8emp94 =0;
r8job95 =0; r8self95=0; r8emp95 =0;
r8job96 =0; r8self96=0; r8emp96 =0;
/* 1997 */
array r8j97 r8j9701-r8j9707;
array r8s97 r8s9701-r8s9707;
array r8e97 r8e9701-r8e9707;
array self &r8sel;
array jobwks job1wks job2wks job3wks job4wks job5wks job6wks job7wks;
do over r8j97; r8j97=0; r8s97=0; r8e97=0; end;
do over r8j97;
do i=888 to 939;
if jobwks=-3 then r8j97=-3;
if jobwks=-3 and self=1 then r8s97=-3;
if jobwks=-3 and self=0 then r8e97=-3;
end;
do i=888 to 939;
if jobwks=1 then r8j97=1;
if jobwks=1 and self=1 then r8s97=1;
if jobwks=1 and self=0 then r8e97=1;
end;
end;
if (r8j9701 ne -3 and r8j9702 ne -3 and r8j9703 ne -3 and r8j9704 ne -3 and
r8j9705 ne -3 and
r8j9706 ne -3 and r8j9707 ne -3) then
r8job97=sum(r8j9701,r8j9702,r8j9703,r8j9704,r8j9705,r8j9706,r8j9707);
if (r8j9701=-3 or r8j9702=-3 or r8j9703=-3 or r8j9704=-3 or r8j9705=-3 or
r8j9706=-3 or
r8j9707=-3) then r8job97=-3;
if (r8s9701 ne -3 and r8s9702 ne -3 and r8s9703 ne -3 and r8s9704 ne -3 and
r8s9705 ne -3 and
r8s9706 ne -3 and r8s9707 ne -3 ) then
r8self97=sum(r8s9701,r8s9702,r8s9703,r8s9704,r8s9705,r8s9706,r8s9707);
if (r8s9701=-3 or r8s9702=-3 or r8s9703=-3 or r8s9704=-3 or r8s9705=-3 or
r8s9706=-3 or
r8s9707=-3) then r8self97=-3;
if (r8e9701 ne -3 and r8e9702 ne -3 and r8e9703 ne -3 and r8e9704 ne -3 and
r8e9705 ne -3 and
r8e9706 ne -3 and r8e9707 ne -3) then
r8emp97=sum(r8e9701,r8e9702,r8e9703,r8e9704,r8e9705,r8e9706,r8e9707);
if (r8e9701=-3 or r8e9702=-3 or r8e9703=-3 or r8e9704=-3 or r8e9705=-3 or
r8e9706=-3 or r8e9707=-3 ) then r8emp97=-3;
/* 1998 */
array r8j98 r8j9801-r8j9807;
array r8s98 r8s9801-r8s9807;
array r8e98 r8e9801-r8e9807;
do over r8j98; r8j98=0; r8s98=0; r8e98=0; end;
do over r8j98;
do i=940 to 991;
if jobwks=-3 then r8j98=-3;
if jobwks=-3 and self=1 then r8s98=-3;
if jobwks=-3 and self=0 then r8e98=-3;
end;
do i=940 to 991;
if jobwks=1 then r8j98=1;
if jobwks=1 and self=1 then r8s98=1;
if jobwks=1 and self=0 then r8e98=1;
end;
end;
if (r8j9801 ne -3 and r8j9802 ne -3 and r8j9803 ne -3 and r8j9804 ne -3 and
r8j9805 ne -3 and
r8j9806 ne -3 and r8j9807 ne -3) then
r8job98=sum(r8j9801,r8j9802,r8j9803,r8j9804,r8j9805,r8j9806,r8j9807);
if (r8j9801=-3 or r8j9802=-3 or r8j9803=-3 or r8j9804=-3 or r8j9805=-3 or
r8j9806=-3 or
r8j9807=-3) then r8job98=-3;
if (r8s9801 ne -3 and r8s9802 ne -3 and r8s9803 ne -3 and r8s9804 ne -3 and
r8s9805 ne -3 and
r8s9806 ne -3 and r8s9807 ne -3) then
r8self98=sum(r8s9801,r8s9802,r8s9803,r8s9804,r8s9805,r8s9806,r8s9807);
if (r8s9801=-3 or r8s9802=-3 or r8s9803=-3 or r8s9804=-3 or r8s9805=-3 or
r8s9806=-3 or
r8s9807=-3) then r8self98=-3;
if (r8e9801 ne -3 and r8e9802 ne -3 and r8e9803 ne -3 and r8e9804 ne -3 and
r8e9805 ne -3 and
r8e9806 ne -3 and r8e9807 ne -3) then
r8emp98=sum(r8e9801,r8e9802,r8e9803,r8e9804,r8e9805,r8e9806,r8e9807);
if (r8e9801=-3 or r8e9802=-3 or r8e9803=-3 or r8e9804=-3 or r8e9805=-3 or
r8e9806=-3 or
r8e9807=-3) then r8emp98=-3;
/* 1999 */
array r8j99 r8j9901-r8j9907;
array r8s99 r8s9901-r8s9907;
array r8e99 r8e9901-r8e9907;
do over r8j99; r8j99=0; r8s99=0; r8e99=0; end;
do over r8j99;
do i=992 to 1043;
if jobwks=-3 then r8j99=-3;
if jobwks=-3 and self=1 then r8s99=-3;
if jobwks=-3 and self=0 then r8e99=-3;
end;
do i=992 to 1043;
if jobwks=1 then r8j99=1;
if jobwks=1 and self=1 then r8s99=1;
if jobwks=1 and self=0 then r8e99=1;
end;
end;
if (r8j9901 ne -3 and r8j9902 ne -3 and r8j9903 ne -3 and r8j9904 ne -3 and
r8j9905 ne -3 and r8j9906 ne -3 and
r8j9907 ne -3) then
r8job99=sum(r8j9901,r8j9902,r8j9903,r8j9904,r8j9905,r8j9906,r8j9907);
if (r8j9901=-3 or r8j9902=-3 or r8j9903=-3 or r8j9904=-3 or r8j9905=-3 or
r8j9906=-3 or r8j9907=-3) then r8job99=-3;
if (r8s9901 ne -3 and r8s9902 ne -3 and r8s9903 ne -3 and r8s9904 ne -3 and
r8s9905 ne -3 and r8s9906 ne -3 and
r8s9907 ne -3) then
r8self99=sum(r8s9901,r8s9902,r8s9903,r8s9904,r8s9905,r8s9906,r8s9907);
if (r8s9901=-3 or r8s9902=-3 or r8s9903=-3 or r8s9904=-3 or r8s9905=-3 or
r8s9906=-3 or r8s9907=-3) then r8self99=-3;
if (r8e9901 ne -3 and r8e9902 ne -3 and r8e9903 ne -3 and r8e9904 ne -3 and
r8e9905 ne -3 and r8e9906 ne -3 and
r8e9907 ne -3) then
r8emp99=sum(r8e9901,r8e9902,r8e9903,r8e9904,r8e9905,r8e9906,r8e9907);
if (r8e9901=-3 or r8e9902=-3 or r8e9903=-3 or r8e9904=-3 or r8e9905=-3 or
r8e9906=-3 or r8e9907=-3) then r8emp99=-3;
/* 2000 */
array r8j00 r8j0001-r8j0007;
array r8s00 r8s0001-r8s0007;
array r8e00 r8e0001-r8e0007;
do over r8j00; r8j00=0; r8s00=0; r8e00=0; end;
do over r8j00;
do i=1044 to 1096;
if jobwks=-3 then r8j00=-3;
if jobwks=-3 and self=1 then r8s00=-3;
if jobwks=-3 and self=0 then r8e00=-3;
end;
do i=1044 to 1096;
if jobwks=1 then r8j00=1;
if jobwks=1 and self=1 then r8s00=1;
if jobwks=1 and self=0 then r8e00=1;
end;
end;
if (r8j0001 ne -3 and r8j0002 ne -3 and r8j0003 ne -3 and r8j0004 ne -3 and
r8j0005 ne -3 and
r8j0006 ne -3 and r8j0007 ne -3) then
r8job00=sum(r8j0001,r8j0002,r8j0003,r8j0004,r8j0005,r8j0006,r8j0007);
if (r8j0001=-3 or r8j0002=-3 or r8j0003=-3 or r8j0004=-3 or r8j0005=-3 or
r8j0006=-3 or
r8j0007=-3) then r8job00=-3;
if (r8s0001 ne -3 and r8s0002 ne -3 and r8s0003 ne -3 and r8s0004 ne -3 and
r8s0005 ne -3 and
r8s0006 ne -3 and r8s0007 ne -3) then
r8self00=sum(r8s0001,r8s0002,r8s0003,r8s0004,r8s0005,r8s0006,r8s0007);
if (r8s0001=-3 or r8s0002=-3 or r8s0003=-3 or r8s0004=-3 or r8s0005=-3 or
r8s0006=-3 or
r8s0007=-3) then r8self00=-3;
if (r8e0001 ne -3 and r8e0002 ne -3 and r8e0003 ne -3 and r8e0004 ne -3 and
r8e0005 ne -3 and
r8e0006 ne -3 and r8e0007 ne -3) then
r8emp00=sum(r8e0001,r8e0002,r8e0003,r8e0004,r8e0005,r8e0006,r8e0007);
if (r8e0001=-3 or r8e0002=-3 or r8e0003=-3 or r8e0004=-3 or r8e0005=-3 or
r8e0006=-3 or
r8e0007=-3) then r8emp00=-3;
/* 2001 */
array r8j01 r8j0101-r8j0107;
array r8s01 r8s0101-r8s0107;
array r8e01 r8e0101-r8e0107;
do over r8j01; r8j01=0; r8s01=0; r8e01=0; end;
do over r8j01;
do i=1097 to 1148;
if jobwks=-3 then r8j01=-3;
if jobwks=-3 and self=1 then r8s01=-3;
if jobwks=-3 and self=0 then r8e01=-3;
end;
do i=1097 to 1148;
if jobwks=1 then r8j01=1;
if jobwks=1 and self=1 then r8s01=1;
if jobwks=1 and self=0 then r8e01=1;
end;
end;
if (r8j0101 ne -3 and r8j0102 ne -3 and r8j0103 ne -3 and r8j0104 ne -3 and
r8j0105 ne -3 and
r8j0106 ne -3 and r8j0107 ne -3) then
r8job01=sum(r8j0101,r8j0102,r8j0103,r8j0104,r8j0105,r8j0106,r8j0107);
if (r8j0101=-3 or r8j0102=-3 or r8j0103=-3 or r8j0104=-3 or r8j0105=-3 or
r8j0106=-3 or
r8j0107=-3) then r8job01=-3;
if (r8s0101 ne -3 and r8s0102 ne -3 and r8s0103 ne -3 and r8s0104 ne -3 and
r8s0105 ne -3 and
r8s0106 ne -3 and r8s0107 ne -3) then
r8self01=sum(r8s0101,r8s0102,r8s0103,r8s0104,r8s0105,r8s0106,r8s0107);
if (r8s0101=-3 or r8s0102=-3 or r8s0103=-3 or r8s0104=-3 or r8s0105=-3 or
r8s0106=-3 or
r8s0107=-3)then r8self01=-3;
if (r8e0101 ne -3 and r8e0102 ne -3 and r8e0103 ne -3 and r8e0104 ne -3 and
r8e0105 ne -3 and
r8e0106 ne -3 and r8e0107 ne -3) then
r8emp01=sum(r8e0101,r8e0102,r8e0103,r8e0104,r8e0105,r8e0106,r8e0107);
if (r8e0101=-3 or r8e0102=-3 or r8e0103=-3 or r8e0104=-3 or r8e0105=-3 or
r8e0106=-3 or
r8e0107=-3) then r8emp01=-3;
/* 2002 */
array r8j02 r8j0201-r8j0207;
array r8s02 r8s0201-r8s0207;
array r8e02 r8e0201-r8e0207;
do over r8j02; r8j02=0; r8s02=0; r8e02=0; end;
do over r8j02;
do i=1149 to 1200;
if jobwks=-3 then r8j02=-3;
if jobwks=-3 and self=1 then r8s02=-3;
if jobwks=-3 and self=0 then r8e02=-3;
end;
do i=1149 to 1200;
if jobwks=1 then r8j02=1;
if jobwks=1 and self=1 then r8s02=1;
if jobwks=1 and self=0 then r8e02=1;
end;
end;
if (r8j0201 ne -3 and r8j0202 ne -3 and r8j0203 ne -3 and r8j0204 ne -3 and
r8j0205 ne -3 and
r8j0206 ne -3 and r8j0207 ne -3) then
r8job02=sum(r8j0201,r8j0202,r8j0203,r8j0204,r8j0205,r8j0206,r8j0207);
if (r8j0201=-3 or r8j0202=-3 or r8j0203=-3 or r8j0204=-3 or r8j0205=-3 or
r8j0206=-3 or
r8j0207=-3) then r8job02=-3;
if (r8s0201 ne -3 and r8s0202 ne -3 and r8s0203 ne -3 and r8s0204 ne -3 and
r8s0205 ne -3 and
r8s0206 ne -3 and r8s0207 ne -3) then
r8self02=sum(r8s0201,r8s0202,r8s0203,r8s0204,r8s0205,r8s0206,r8s0207);
if (r8s0201=-3 or r8s0202=-3 or r8s0203=-3 or r8s0204=-3 or r8s0205=-3 or
r8s0206=-3 or
r8s0207=-3) then r8self02=-3;
if (r8e0201 ne -3 and r8e0202 ne -3 and r8e0203 ne -3 and r8e0204 ne -3 and
r8e0205 ne -3 and
r8e0206 ne -3 and r8e0207 ne -3) then
r8emp02=sum(r8e0201,r8e0202,r8e0203,r8e0204,r8e0205,r8e0206,r8e0207);
if (r8e0201=-3 or r8e0202=-3 or r8e0203=-3 or r8e0204=-3 or r8e0205=-3 or
r8e0206=-3 or
r8e0207=-3) then r8emp02=-3;
/* 2003 */
array r8j03 r8j0301-r8j0307;
array r8s03 r8s0301-r8s0307;
array r8e03 r8e0301-r8e0307;
do over r8j03; r8j03=0; r8s03=0; r8e03=0; end;
do over r8j03;
do i=1201 to 1252;
if jobwks=-3 then r8j03=-3;
if jobwks=-3 and self=1 then r8s03=-3;
if jobwks=-3 and self=0 then r8e03=-3;
end;
do i=1201 to 1252;
if jobwks=1 then r8j03=1;
if jobwks=1 and self=1 then r8s03=1;
if jobwks=1 and self=0 then r8e03=1;
end;
end;
if (r8j0301 ne -3 and r8j0302 ne -3 and r8j0303 ne -3 and r8j0304 ne -3 and
r8j0305 ne -3 and
r8j0306 ne -3 and r8j0307 ne -3) then
r8job03=sum(r8j0301,r8j0302,r8j0303,r8j0304,r8j0305,r8j0306,r8j0307);
if (r8j0301=-3 or r8j0302=-3 or r8j0303=-3 or r8j0304=-3 or r8j0305=-3 or
r8j0306=-3 or
r8j0307=-3) then r8job03=-3;
if (r8s0301 ne -3 and r8s0302 ne -3 and r8s0303 ne -3 and r8s0304 ne -3 and
r8s0305 ne -3 and
r8s0306 ne -3 and r8s0307 ne -3) then
r8self03=sum(r8s0301,r8s0302,r8s0303,r8s0304,r8s0305,r8s0306,r8s0307);
if (r8s0301=-3 or r8s0302=-3 or r8s0303=-3 or r8s0304=-3 or r8s0305=-3 or
r8s0306=-3 or
r8s0307=-3) then r8self03=-3;
if (r8e0301 ne -3 and r8e0302 ne -3 and r8e0303 ne -3 and r8e0304 ne -3 and
r8e0305 ne -3 and
r8e0306 ne -3 and r8e0307 ne -3) then
r8emp03=sum(r8e0301,r8e0302,r8e0303,r8e0304,r8e0305,r8e0306,r8e0307);
if (r8e0301=-3 or r8e0302=-3 or r8e0303=-3 or r8e0304=-3 or r8e0305=-3 or
r8e0306=-3 or
r8e0307=-3) then r8emp03=-3;
/* 2004 */
array r8j04 r8j0401-r8j0407;
array r8s04 r8s0401-r8s0407;
array r8e04 r8e0401-r8e0407;
do over r8j04; r8j04=0; r8s04=0; r8e04=0; end;
do over r8j04;
do i=1253 to 1305;
if jobwks=-3 then r8j04=-3;
if jobwks=-3 and self=1 then r8s04=-3;
if jobwks=-3 and self=0 then r8e04=-3;
end;
do i=1253 to 1305;
if jobwks=1 then r8j04=1;
if jobwks=1 and self=1 then r8s04=1;
if jobwks=1 and self=0 then r8e04=1;
end;
end;
if (r8j0401 ne -3 and r8j0402 ne -3 and r8j0403 ne -3 and r8j0404 ne -3 and
r8j0405 ne -3 and
r8j0406 ne -3 and r8j0407 ne -3) then
r8job04=sum(r8j0401,r8j0402,r8j0403,r8j0404,r8j0405,r8j0406,r8j0407);
if (r8j0401=-3 or r8j0402=-3 or r8j0403=-3 or r8j0404=-3 or r8j0405=-3 or
r8j0406=-3 or
r8j0407=-3) then r8job04=-3;
if (r8s0401 ne -3 and r8s0402 ne -3 and r8s0403 ne -3 and r8s0404 ne -3 and
r8s0405 ne -3 and
r8s0406 ne -3 and r8s0407 ne -3) then
r8self04=sum(r8s0401,r8s0402,r8s0403,r8s0404,r8s0405,r8s0406,r8s0407);
if (r8s0401=-3 or r8s0402=-3 or r8s0403=-3 or r8s0404=-3 or r8s0405=-3 or
r8s0406=-3 or
r8s0407=-3) then r8self04=-3;
if (r8e0401 ne -3 and r8e0402 ne -3 and r8e0403 ne -3 and r8e0404 ne -3 and
r8e0405 ne -3 and
r8e0406 ne -3 and r8e0407 ne -3) then
r8emp04=sum(r8e0401,r8e0402,r8e0403,r8e0404,r8e0405,r8e0406,r8e0407);
if (r8e0401=-3 or r8e0402=-3 or r8e0403=-3 or r8e0404=-3 or r8e0405=-3 or
r8e0406=-3 or
r8e0407=-3) then r8emp04=-3;
/* 2005 */
array r8j05 r8j0501-r8j0507;
array r8s05 r8s0501-r8s0507;
array r8e05 r8e0501-r8e0507;
do over r8j05; r8j05=0; r8s05=0; r8e05=0; end;
do over r8j05;
do i=1306 to 1334;
if jobwks=-3 then r8j05=-3;
if jobwks=-3 and self=1 then r8s05=-3;
if jobwks=-3 and self=0 then r8e05=-3;
end;
do i=1306 to 1334;
if jobwks=1 then r8j05=1;
if jobwks=1 and self=1 then r8s05=1;
if jobwks=1 and self=0 then r8e05=1;
end;
end;
if (r8j0501 ne -3 and r8j0502 ne -3 and r8j0503 ne -3 and r8j0504 ne -3 and
r8j0505 ne -3 and
r8j0506 ne -3 and r8j0507 ne -3) then
r8job05=sum(r8j0501,r8j0502,r8j0503,r8j0504,r8j0505,r8j0506,r8j0507);
if (r8j0501=-3 or r8j0502=-3 or r8j0503=-3 or r8j0504=-3 or r8j0505=-3 or
r8j0506=-3 or
r8j0507=-3) then r8job05=-3;
if (r8s0501 ne -3 and r8s0502 ne -3 and r8s0503 ne -3 and r8s0504 ne -3 and
r8s0505 ne -3 and
r8s0506 ne -3 and r8s0507 ne -3) then
r8self05=sum(r8s0501,r8s0502,r8s0503,r8s0504,r8s0505,r8s0506,r8s0507);
if (r8s0501=-3 or r8s0502=-3 or r8s0503=-3 or r8s0504=-3 or r8s0505=-3 or
r8s0506=-3 or
r8s0507=-3) then r8self05=-3;
if (r8e0501 ne -3 and r8e0502 ne -3 and r8e0503 ne -3 and r8e0504 ne -3 and
r8e0505 ne -3 and
r8e0506 ne -3 and r8e0507 ne -3) then
r8emp05=sum(r8e0501,r8e0502,r8e0503,r8e0504,r8e0505,r8e0506,r8e0507);
if (r8e0501=-3 or r8e0502=-3 or r8e0503=-3 or r8e0504=-3 or r8e0505=-3 or
r8e0506=-3 or
r8e0507=-3) then r8emp05=-3;
**********************************************************************
** Number of jobs held since age 14 & 20 **
** (conditional on having worked at least 1 week since age14) **
** **
** Variables created: r8emp14 r8job14 r8emp20 r8job20 **
** **
** r8job14 (r8emp14) is the number of all jobs (employee type jobs)**
** held between age 14 and 20. **
** r8job20 (r8emp20) is the number of all jobs (employee type jobs)**
** held since age 20. **
**********************************************************************;
array job1wks (i) w1_1-w1_1335;
array job2wks (i) w2_1-w2_1335;
array job3wks (i) w3_1-w3_1335;
array job4wks (i) w4_1-w4_1335;
array job5wks (i) w5_1-w5_1335;
array job6wks (i) w6_1-w6_1335;
array job7wks (i) w7_1-w7_1335;
***************************************************************************
** Indicate if worked at least one week on a given job since age 14 & 20 **
***************************************************************************;
array r8e14 r8e1401-r8e1407;
array r8j14 r8j1401-r8j1407;
array r8e20 r8e2001-r8e2007;
array r8j20 r8j2001-r8j2007;
array self &R8sel;
array jobwks job1wks job2wks job3wks job4wks job5wks job6wks job7wks;
* the ending week for the count "between age 14 and 20" depending on whether the
respondent turns to 20 or not;
end14wk=min(age20wk-1, 1334);
* the count for "between age 14 and 20"--all jobs;
do over r8j14;
do i=age14wk to end14wk;
if jobwks in (-3,1) then r8j14=1;
* the count for "between age 14 and 20"--employee type jobs;
if jobwks in (-3,1) and self=0 then r8e14=1;
* the count for "since age 20" for those who are over 20 at interview date--all
jobs;
end;
do i=age20wk to 1335;
if jobwks in (-3,1) then r8j20=1;
* the count for "since age 20" for those who are over 20 at interview
date--employee type jobs;
if jobwks in (-3,1) and self=0 then r8e20=1;
end;
end;
r8job14=sum(r8j1401,r8j1402,r8j1403,r8j1404,r8j1405,r8j1406,r8j1407);
r8emp14=sum(r8e1401,r8e1402,r8e1403,r8e1404,r8e1405,r8e1406,r8e1407);
r8job20=sum(r8j2001,r8j2002,r8j2003,r8j2004,r8j2005,r8j2006,r8j2007);
r8emp20=sum(r8e2001,r8e2002,r8e2003,r8e2004,r8e2005,r8e2006,r8e2007);
******** assign -3 to cases where the stop date is unknown
and the job starts prior to the 14/20th birthday; *******;
array starw starw01-starw07;
array stopf stopf_1-stopf_7;
array starf starf_1-starf_7;
do over stopf;
if stopf=1 and starf ne 1 and starw<age14wk and self=0 then r8emp14=-3;
if stopf=1 and starf ne 1 and starw<age14wk then r8emp14=-3;
if stopf=1 and starf ne 1 and starw<age20wk and self=0 and age20wk<r8int then
r8emp20=-3;
if stopf=1 and starf ne 1 and starw<age20wk and age20wk<r8int then r8job20=-3;
end;