Return to Appendix 2 main file
***********************************************************************
** Preliminary steps for linking current round information with data from previous rounds **
***********************************************************************
if r8int>-5;
array r1wks (i) &R1WKS; /* Round 1 created variable */
array r2wks (i) &R2WKS; /* Round 2 created variable */
array r3wks (i) &R3WKS; /* Round 3 created variable */
array r4wks (i) &R4WKS; /* Round 4 created variable, all jobs */
array r4ewks (i) &R4EWKS; /* Round 4 created variable, employee jobs*/
array r4swks (i) &R4SWKS; /* Round 4 created variable, self-employed jobs */
array r5wks (i) &R5WKS; /* Round 5 created variable, all jobs */
array r5ewks (i) &R5EWKS; /* Round 5 created variable, employee jobs */
array r5swks (i) &R5SWKS; /* Round 5 created variable, self-employed jobs */
array r6wks (i) &R6WKS; /* Round 6 created variable, all jobs */
array r6ewks (i) &R6EWKS; /* Round 6 created variable, employee jobs */
array r6swks (i) &R6SWKS; /* Round 6 created variable, self-employed jobs */
array r7wks (i) &R7WKS; /* Round 7 created variable, all jobs */
array r7swks (i) &R7SWKS; /*Round 7 created variable, employee jobs*/
array r7ewks (i) &R7EWKS; /*Round 7 created variable, self-employed jobs */
array r8wks (i) R8wks80-R8wks99 R8wks00-R8wks05;
array r8swks (i) R8swks80-R8swks99 R8swks00-R8swks05;
array r8ewks (i) R8ewks80-R8ewks99 R8ewks00-R8ewks05;
array twks (i) twks80-twks99 twks00-twks05; /* Total created variable, all jobs */
array tewks (i) tewks80-tewks99 tewks00-tewks05; /* Total created variable, employee jobs */
array tswks (i) tswks80-tswks99 tswks00-tswks05; /* Total created variable, self-employed jobs */
do over twks;
twks=0; tswks=0; tewks=0;
end;
do over twks;
if r8wks>0 then twks=twks+r8wks;
if r8swks>0 then tswks=tswks+r8swks;
if r8ewks>0 then tewks=tewks+r8ewks;
end;
/*Add total wks from dli to above to create new total*/
/* dli is Round 7 */
if dliwk=r7int then do;
do over r7wks;
if r7wks>0 then twks=twks+r7wks;
if r7swks>0 then tswks=tswks+r7swks;
if r7ewks>0 then tewks=tewks+r7ewks;
end;
end;
/* dli is Round 6 */
if dliwk=r6int then do;
do over r6wks;
if r6wks>0 then twks=twks+r6wks;
if r6swks>0 then tswks=tswks+r6swks;
if r6ewks>0 then tewks=tewks+r6ewks;
end;
end;
/* dli is Round 5 */
if dliwk=r5int then do;
do over r5wks;
if r5wks>0 then twks=twks+r5wks;
if r5swks>0 then tswks=tswks+r5swks;
if r5ewks>0 then tewks=tewks+r5ewks;
end;
end;
/* dli is Round 4 */
if dliwk=r4int then do;
do over r4wks;
if r4wks>0 then twks=twks+r4wks;
if r4swks>0 then tswks=tswks+r4swks;
if r4ewks>0 then tewks=tewks+r4ewks;
end;
end;
/* dli is Round 3 */
if dliwk=r3int then do;
do over r3wks;
if r3wks>0 then do; twks=twks+r3wks; tewks=tewks+r3wks; end;
end;
end;
/* dli is Round 2 */
if dliwk=r2int then do;
do over r2wks;
if r2wks>0 then do; twks=twks+r2wks; tewks=tewks+r2wks; end;
end;
end;
/* dli is Round 1 */
if dliwk=r1int then do;
do over r1wks;
if r1wks>0 then do; twks=twks+r1wks; tewks=tewks+r1wks; end;
end;
end;
/* This section is written for backreporters. Double weeks worked are identified by comparing
Round8 weeks worked with event history emp_status. A uid on event history indicates a week
that is already identified as worked. Note earliest back reported start year is 1997*/
array alljobs (i) wks1--wks1280;
array selfjobs (i) swks1--swks1280;
array empjobs (i) ewks1--ewks1280;
/*from event history (r7) emp_status*/
array r7ar (i) _1-_887 R8016200 -- R8021300 R8021600 -- R8026700 R8027000 -- R8032100
R8808500 -- R8813700 R8904100 -- R8909200 R9039600 -- R9044700
R9044800 -- R9049900 R9175500 -- R9178100 _1280;
/* 1997 */
dwks97=0; dswks97=0; dewks97=0;
do i=888 to 939;
if alljobs=1 and r7ar>9700 then dwks97=dwks97+1;
if selfjobs=1 and r7ar>9700 then dswks97=dswks97+1;
if empjobs=1 and r7ar>9700 then dewks97=dewks97+1;
end;
/* 1998 */
dwks98=0; dswks98=0; dewks98=0;
do i=940 to 991;
if alljobs=1 and r7ar>9700 then dwks98=dwks98+1;
if selfjobs=1 and r7ar>9700 then dswks98=dswks98+1;
if empjobs=1 and r7ar>9700 then dewks98=dewks98+1;
end;
/* 1999 */
dwks99=0; dswks99=0; dewks99=0;
do i=992 to 1043;
if alljobs=1 and r7ar>9700 then dwks99=dwks99+1;
if selfjobs=1 and r7ar>9700 then dswks99=dswks99+1;
if empjobs=1 and r7ar>9700 then dewks99=dewks99+1;
end;
/* 2000 */
dwks00=0; dswks00=0; dewks00=0;
do i=1044 to 1096;
if alljobs=1 and r7ar>9700 then dwks00=dwks00+1;
if selfjobs=1 and r7ar>9700 then dswks00=dswks00+1;
if empjobs=1 and r7ar>9700 then dewks00=dewks00+1;
end;
/* 2001 */
dwks01=0; dswks01=0; dewks01=0;
do i=1097 to 1148;
if alljobs=1 and r7ar>9700 then dwks01=dwks01+1;
if selfjobs=1 and r7ar>9700 then dswks01=dswks01+1;
if empjobs=1 and r7ar>9700 then dewks01=dewks01+1;
end;
/* 2002 */
dwks02=0; dswks02=0; dewks02=0;
do i=1149 to 1200;
if alljobs=1 and r7ar>9700 then dwks02=dwks02+1;
if selfjobs=1 and r7ar>9700 then dswks02=dswks02+1;
if empjobs=1 and r7ar>9700 then dewks02=dewks02+1;
end;
if pubid=416 then do; dwks02=dwks02+20; dewks02=dewks02+20; end;
*bckrep on alljobs not on r7ar;
/* 2003 */
dwks03=0; dswks03=0; dewks03=0;
do i=1201 to 1252;
if alljobs=1 and r7ar>9700 then dwks03=dwks03+1;
if selfjobs=1 and r7ar>9700 then dswks03=dswks03+1;
if empjobs=1 and r7ar>9700 then dewks03=dewks03+1;
end;
/* 2004 */
dwks04=0; dswks04=0; dewks04=0;
do i=1253 to 1280;
if alljobs=1 and r7ar>9700 then dwks04=dwks04+1;
if selfjobs=1 and r7ar>9700 then dswks04=dswks04+1;
if empjobs=1 and r7ar>9700 then dewks04=dewks04+1;
end;
array dwks (i) dwks80-dwks99 dwks00-dwks05;
array dswks (i) dswks80-dswks99 dswks00-dswks05;
array dewks (i) dewks80-dewks99 dewks00-dewks05;
do over dwks;
if dwks>0 then twks=twks-dwks;
if dswks>0 then tswks=tswks-dswks;
if dewks>0 then tewks=tewks-dewks;
end;
/* If either created variable from current or dli is a -2 or -3,
then the overall created variable will be -2 or -3,
respectively. */
do over r7wks;
if r8wks in (-1,-2,-3) then twks=-3;
if r8swks in (-1,-2,-3) then tswks=-3;
if r8ewks in (-1,-2,-3) then tewks=-3;
if r7wks in (-1,-2,-3) and dliwk=r7int then twks=-3;
if r7swks in (-1,-2,-3) and dliwk=r7int then tswks=-3;
if r7ewks in (-1,-2,-3) and dliwk=r7int then tewks=-3;
if r6wks in (-1,-2,-3) and dliwk=r6int then twks=-3;
if r6swks in (-1,-2,-3) and dliwk=r6int then tswks=-3;
if r6ewks in (-1,-2,-3) and dliwk=r6int then tewks=-3;
if r5wks in (-1,-2,-3) and dliwk=r5int then twks=-3;
if r5swks in (-1,-2,-3) and dliwk=r5int then tswks=-3;
if r5ewks in (-1,-2,-3) and dliwk=r5int then tewks=-3;
if r4wks in (-1,-2,-3) and dliwk=r4int then twks=-3;
if r4swks in (-1,-2,-3) and dliwk=r4int then tswks=-3;
if r4ewks in (-1,-2,-3) and dliwk=r4int then tewks=-3;
if r3wks in (-1,-2,-3) and dliwk=r3int then do; twks=-3; tewks=-3; end;
if r2wks in (-1,-2,-3) and dliwk=r2int then do; twks=-3; tewks=-3; end;
if r1wks in (-1,-2,-3) and dliwk=r1int then do; twks=-3; tewks=-3; end;
end;
run;
*****************************************************************************************
** Weeks Worked at Employee Job #x during 19xx/20xx
*****************************************************************************************
** This program connects the Round7 and dli created variables for number of weeks worked at job x during year. **
Variables Created: twks**_nn CV_WKSWK_JOB_YR.nn.**
(** refers to the year number; "nn" refers to the job number.)
*****************************************************************************************;
data total_numwksyr;
merge one round8.emp_int round8.emp_week round8.emp31_jobwks; by pubid;
if r8int>-5;
/*correcting total numwksyr, tenure for uids with multiple spells in matching round*/
/*numjobs for all with multiple spell uids*/
/*documentation on spells3.xls*/
if pubid =9 then do; mspflg=7; mspuid1=200201;
S2036400=15; S2035100=28;
S2026100=1; S2023600=1; end;
if pubid =334 then do; mspflg=7; mspuid1=200302;
S2036300=2; S2036400=5; S2035100=10;
S2026100=2; S2023600=2; end;
if pubid =1116 then do; mspflg=7; mspuid1=200301;
S2038800=6; S2038900=32; S2035200=38; end;
if pubid =1135 then do; mspflg=7; mspuid1=200301;
S2036400=14; S2035100=15;
S2026100=1; S2023600=1; end;
if pubid =1194 then do; mspflg=7; mspuid1=200101;
S2038800=45; S2038900=48; S2035200=104;
S2026000=1; S2023500=1; end;
if pubid =2670 then do; mspflg=7; mspuid1=200102;
S2038800=3; S2038900=17; S2035200=30;
S2025900=2; S2023400=2; S2026100=2; S2023600=2; end;
if pubid =2938 then do; mspflg=7; mspuid1=200201;
S2036400=20; S2035100=33;
S2026100=1; S2023600=1; end;
if pubid =3520 then do; mspflg=7; mspflg2=6; mspuid1=200102;
S2036300=16; S2036400=27; S1566300=16; S2035100=55;
S2026000=1; S2023500=1; end;
if pubid =3777 then do; mspflg=7; mspuid1=9803;
S2038800=7; S2038900=10; S2035200=192;
S2025900=2; S2023400=2; S2026100=2; S2023600=2; end;
if pubid =5249 then do; mspflg=7; mspuid1=200002;
S2036400=48; S2035100=136;
S2025900=2; S2023400=2; S2026100=2; S2023600=2; end;
if pubid =5472 then do; mspflg=7; mspuid1=200002;
S2036400=23; S2035100=37;
S2026100=4; S2028600=1; end;
if pubid =3054 then do; mspflg=6; mspuid1=200101;
S2036200=52; S2036300=52; S2035100=188;
S2025900=1; S2026000=2; S2028400=1; S2028500=1; end;
if pubid =5391 then do; mspflg=6; mspuid1=200104;
S2043800=14; S2035400=53;
S2025800=2; S2023300=2; S2025900=3; S2023400=3;
S2026000=4; S2023500=4; S2026100=5; S2023600=5; end;
if pubid =5506 then do; mspflg=6; mspuid1=200003;
S2041300=10; S2035300=61;
S2026000=3; S2023500=2; end;
if pubid =6859 then do; mspflg=6; mspuid1=200002;
S2026000=7; S2023500=6; S2026100=2; S2023600=1; S2028500=1; end;
if pubid =7600 then do; mspflg=6; mspuid1=200102;
S2036300=11; S2035100=84; end;
if pubid =7719 then do; mspflg=6; mspuid1=199901;
S2036200=44; S2036300=36; S2035100=194;
S2025900=1; S2023400=1; S2026000=2; S2023500=2; end;
if pubid =8977 then do; mspflg=6; mspuid1=199902;
S1566100=-3; S1566400=7; end;
if pubid =4030 then do; mspflg=5; mspuid1=9803;
R7254300=9; R7252200=5; R7252300=15; R7249200=32;
S2025900=4; S2023400=4; S2026000=4; S2023500=4; end;
if pubid=308 then do; S1556300=5; S1558700=2; S1553900=3; end;
if pubid=168 then do; S1556300=4; S1553900=4; end;
if pubid=246 then do; S2026000=4; S2023500=4; end;
if pubid=676 then do; S2026000=2; S2023500=2; end;
if pubid=915 then do; S2025900=4; S2028400=2; end;
if pubid=980 then do; S2026000=4; S2023500=4; end;
if pubid=1159 then do; S2026000=3; S2023500=3; end;
if pubid=1175 then do; S2026000=2; S2023500=2; end;
if pubid=1260 then do; S2026000=3; S2023500=3; S2025900=1; S2023400=1; end;
if pubid=1374 then do; S2028100=3; S2025600=3; S2026000=2; S2023500=2; end;
if pubid=1392 then do; S2028100=2; S2025600=2; end;
if pubid=1586 then do; S2025900=2; S2023400=2; end;
if pubid=1990 then do; S2026000=2; S2028500=1; end;
if pubid=2255 then do; S2026000=3; S2023500=3; end;
if pubid=2611 then do; S2026100=2; S2023600=1; end;
if pubid=2721 then do; S2026000=3; S2023500=3; end;
if pubid=2742 then do; S2026000=2; S2023500=2; end;
if pubid=3132 then do; S2026100=3; S2023600=3; end;
if pubid=3156 then do; S2026000=1; S2025900=2; S2023500=1; S2023400=2; end;
if pubid=3171 then do; S2026000=2; S2023500=2; end;
if pubid=3192 then do; S2026000=2; S2025900=2; S2023500=2; S2023400=2; end;
if pubid=3378 then do; S2026000=2; S2025900=1; S2023500=2; S2023400=1; end;
if pubid=3449 then do; S2027900=2; S2025400=2; S2025900=3; S2023400=3; end;
if pubid=3549 then do; S2026000=3; S2023500=2; end;
if pubid=3739 then do; S2025900=5; S2023400=5; end;
if pubid=3893 then do; S2025900=2; S2026000=4; S2023400=1; S2023500=3; end;
if pubid=3966 then do; S2026000=3; S2023500=3; end;
if pubid=4399 then do; S2026100=2; S2023600=2; end;
if pubid=4668 then do; S2025900=2; S2023400=2; end;
if pubid=4953 then do; S2026000=5; S2023500=5; end;
if pubid=5163 then do; S2026000=1; S2023500=1; S2026100=2; S2023600=2; end;
if pubid=5644 then do; S2026000=3; S2023500=3; S2026100=2; S2023600=2; end;
if pubid=5649 then do; S2025900=2; S2023400=2; end;
if pubid=5868 then do; S2026000=2; S2023500=2; end;
if pubid=5888 then do; S2028000=2; S2025500=2; end;
if pubid=5977 then do; S2026000=1; S2023500=1; end;
if pubid=6210 then do; S2025900=1; S2026000=2; S2023400=1; S2023500=2; end;
if pubid=6305 then do; S2025900=2; S2023400=2; end;
if pubid=6325 then do; S2026000=1; S2023500=1; end;
if pubid=6347 then do; S2026000=2; S2023500=2; end;
if pubid=6348 then do; S2027900=2; S2025400=2; end;
if pubid=6389 then do; S2025900=4; S2023400=4; S2026100=2; S2023600=2; end;
if pubid=6479 then do; S2026000=1; S2023500=1; end;
if pubid=6570 then do; S2025900=2; S2023400=2; end;
if pubid=7141 then do; S2025800=2; S2023300=2; end;
if pubid=7144 then do; S2025900=1; S2026000=1; S2023400=1; S2023500=1; end;
if pubid=7170 then do; S2025900=1; S2023400=1; end;
if pubid=7217 then do; S2026000=1; S2023500=1; end;
if pubid=7223 then do; S2025800=2; S2023300=2; end;
if pubid=7258 then do; S2025900=1; S2023400=1; end;
if pubid=7356 then do; S2026000=2; S2023500=2; end;
if pubid=7382 then do; S2026000=2; S2023500=2; end;
if pubid=7799 then do; S2025900=1; S2023400=1; S2026100=1; S2023600=1; end;
if pubid=8010 then do; S2026100=4; S2023600=4; end;
if pubid=8611 then do; S2026000=2; S2023500=2; end;
if pubid=9011 then do; S2025900=2; S2023400=2; S2026000=2; S2023500=2; end;
/* Define "mat1_4" as the dummy variable that equals 1 when the first job
in the last round and the fourth job in the current round have the same UID.*/
array r8uid (j) &R8uid;
array r8mil (j) &r8mil;
array r7uid (i) &R7UID;
array r6uid (i) &R6uid;
array r5uid (i) &R5UID;
array r4uid (i) &R4uid;
array r3uid (i) &R3uid;
array r2uid (i) &R2UID;
array r1uid (i) &R1uid;
array match {11,7} match1_1-match1_7 match2_1-match2_7
match3_1-match3_7 match4_1-match4_7
match5_1-match5_7 match6_1-match6_7
match7_1-match7_7 match8_1-match8_7
match9_1-match9_7 match10_1-match10_7
match11_1-match11_7;
do i=1 to 7;
if r1uid>0 then do;
do j=1 to 7;
if r1uid=r8uid and r2uid ne r8uid and r3uid ne r8uid and r4uid ne r8uid and
r5uid ne r8uid and r6uid ne r8uid and r7uid ne r8uid
then match(i,j)=1;
end;
end;
end;
do i=1 to 9;
if r2uid>0 then do;
do j=1 to 7;
if r2uid=r8uid and r3uid ne r8uid and r4uid ne r8uid and
r5uid ne r8uid and r6uid ne r8uid and r7uid ne r8uid
then match(i,j)=2;
end;
end;
end;
do i=1 to 9;
if r3uid>0 then do;
do j=1 to 7;
if r3uid=r8uid and r4uid ne r8uid and
r5uid ne r8uid and r6uid ne r8uid and r7uid ne r8uid
then match(i,j)=3;
end;
end;
end;
do i=1 to 9;
if r4uid>0 then do;
do j=1 to 7;
if r4uid=r8uid and
r5uid ne r8uid and r6uid ne r8uid and r7uid ne r8uid
then match(i,j)=4;
end;
end;
end;
do i=1 to 8;
if r5uid>0 then do;
do j=1 to 7;
if r5uid=r8uid and r6uid ne r8uid and r7uid ne r8uid
then match(i,j)=5;
end;
end;
end;
do i=1 to 11;
if r6uid>0 then do;
do j=1 to 7;
if r6uid=r8uid and r7uid ne r8uid then match(i,j)=6;
end;
end;
end;
do i=1 to 10;
if r7uid>0 then do;
do j=1 to 7;
if r7uid=r8uid then match(i,j)=7;
end;
end;
end;
/*find the most recent round matching each Round8 job*/
array match1 (j) match1_1-match1_7;
array match2 (j) match2_1-match2_7;
array match3 (j) match3_1-match3_7;
array match4 (j) match4_1-match4_7;
array match5 (j) match5_1-match5_7;
array match6 (j) match6_1-match6_7;
do over match1;
if match1 ne max(match1,match2,match3,match4,match5,match6) then match1=.;
if match2 ne max(match1,match2,match3,match4,match5,match6) then match2=.;
if match3 ne max(match1,match2,match3,match4,match5,match6) then match3=.;
if match4 ne max(match1,match2,match3,match4,match5,match6) then match4=.;
if match5 ne max(match1,match2,match3,match4,match5,match6) then match5=.;
if match6 ne max(match1,match2,match3,match4,match5,match6) then match6=.;
/*take more recent match from matching round if multiple spells*/
if match6 ne . and
match6=max(match1,match2,match3,match4,match5) then match6=.;
if match5 ne . and
match5=max(match1,match2,match3,match4) then match5=.;
if match4 ne . and
match4=max(match1,match2,match3) then match4=.;
if match3 ne . and
match3=max(match1,match2) then match3=.;
if match2 ne . and
match2=match1 then match2=.;
end;
array r8wks80 (j) r8w80_1-r8w80_7;
array r8wks81 (j) r8w81_1-r8w81_7;
array r8wks82 (j) r8w82_1-r8w82_7;
array r8wks83 (j) r8w83_1-r8w83_7;
array r8wks84 (j) r8w84_1-r8w84_7;
array r8wks85 (j) r8w85_1-r8w85_7;
array r8wks86 (j) r8w86_1-r8w86_7;
array r8wks87 (j) r8w87_1-r8w87_7;
array r8wks88 (j) r8w88_1-r8w88_7;
array r8wks89 (j) r8w89_1-r8w89_7;
array r8wks90 (j) r8w90_1-r8w90_7;
array r8wks91 (j) r8w91_1-r8w91_7;
array r8wks92 (j) r8w92_1-r8w92_7;
array r8wks93 (j) r8w93_1-r8w93_7;
array r8wks94 (j) r8w94_1-r8w94_7;
array r8wks95 (j) r8w95_1-r8w95_7;
array r8wks96 (j) r8w96_1-r8w96_7;
array r8wks97 (j) r8w97_1-r8w97_7;
array r8wks98 (j) r8w98_1-r8w98_7;
array r8wks99 (j) r8w99_1-r8w99_7;
array r8wks00 (j) r8w00_1-r8w00_7;
array r8wks01 (j) r8w01_1-r8w01_7;
array r8wks02 (j) r8w02_1-r8w02_7;
array r8wks03 (j) r8w03_1-r8w03_7;
array r8wks04 (j) r8w04_1-r8w04_7;
array r8wks05 (j) r8w05_1-r8w05_7;
array r7w_1 (k) &R7W_01;
array r7w_2 (k) &R7W_02;
array r7w_3 (k) &R7W_03;
array r7w_4 (k) &R7W_04;
array r7w_5 (k) &R7W_05;
array r7w_6 (k) &R7W_06;
array r6w_1 (k) &R6W_01;
array r6w_2 (k) &R6W_02;
array r6w_3 (k) &R6W_03;
array r6w_4 (k) &R6W_04;
array r6w_5 (k) &R6W_05;
array r6w_6 (k) &R6W_06;
array r5w_1 (k) &R5W_01;
array r5w_2 (k) &R5W_02;
array r5w_3 (k) &R5W_03;
array r5w_4 (k) &R5W_04;
array r5w_5 (k) &R5W_05;
array r5w_6 (k) &R5W_06;
array r4w_1 (k) &R4W_01;
array r4w_2 (k) &R4W_02;
array r4w_3 (k) &R4W_03;
array r4w_4 (k) &R4W_04;
array r4w_5 (k) &R4W_05;
array r4w_6 (k) &R4W_06;
array r3w_1 (k) &R3W_01;
array r3w_2 (k) &R3W_02;
array r3w_3 (k) &R3W_03;
array r3w_4 (k) &R3W_04;
array r3w_5 (k) &R3W_05;
array r3w_6 (k) &R3W_06;
array r2w_1 (k) &R2W_01;
array r2w_2 (k) &R2W_02;
array r2w_3 (k) &R2W_03;
array r2w_4 (k) &R2W_04;
array r2w_5 (k) &R2W_05;
array r2w_6 (k) &R2W_06;
/* Arrange total weeks by year and job */
array twks {26,7}
twk80_1-twk80_7 twk81_1-twk81_7 twk82_1-twk82_7 twk83_1-twk83_7 twk84_1-twk84_7
twk85_1-twk85_7 twk86_1-twk86_7 twk87_1-twk87_7 twk88_1-twk88_7 twk89_1-twk89_7
twk90_1-twk90_7 twk91_1-twk91_7 twk92_1-twk92_7 twk93_1-twk93_7 twk94_1-twk94_7
twk95_1-twk95_7 twk96_1-twk96_7 twk97_1-twk97_7 twk98_1-twk98_7 twk99_1-twk99_7
twk00_1-twk00_7 twk01_1-twk01_7 twk02_1-twk02_7 twk03_1-twk03_7 twk04_1-twk04_7
twk05_1-twk05_7;
array r8wks {26,7}
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;
/* Initialize total weeks count to zero, then add the current round weeks
Current round weeks nonzero only for 1997 and later */
do j=1 to 7; do k=1 to 26;
twks(k,j)=0;
if r8uid>9700 and r8mil ne 1 and r8wks(k,j)>0 then twks(k,j)=twks(k,j)+r8wks(k,j);
if r8wks(k,j)=-3 then twks(k,j)=-3;
if match1=7 and twks(k,j) ge 0 and r7w_1>0 then twks(k,j)=twks(k,j)+r7w_1;
if match1=7 and twks(k,j) ge 0 and r7w_1=-3 then twks(k,j)=-3;
if match2=7 and twks(k,j) ge 0 and r7w_2>0 then twks(k,j)=twks(k,j)+r7w_2;
if match2=7 and twks(k,j) ge 0 and r7w_2=-3 then twks(k,j)=-3;
if match3=7 and twks(k,j) ge 0 and r7w_3>0 then twks(k,j)=twks(k,j)+r7w_3;
if match3=7 and twks(k,j) ge 0 and r7w_3=-3 then twks(k,j)=-3;
if match4=7 and twks(k,j) ge 0 and r7w_4>0 then twks(k,j)=twks(k,j)+r7w_4;
if match4=7 and twks(k,j) ge 0 and r7w_4=-3 then twks(k,j)=-3;
if match5=7 and twks(k,j) ge 0 and r7w_5>0 then twks(k,j)=twks(k,j)+r7w_5;
if match5=7 and twks(k,j) ge 0 and r7w_5=-3 then twks(k,j)=-3;
if match6=7 and twks(k,j) ge 0 and r7w_6>0 then twks(k,j)=twks(k,j)+r7w_6;
if match6=7 and twks(k,j) ge 0 and r7w_6=-3 then twks(k,j)=-3;
if match1=6 and twks(k,j) ge 0 and r6w_1>0 then twks(k,j)=twks(k,j)+r6w_1;
if match1=6 and twks(k,j) ge 0 and r6w_1=-3 then twks(k,j)=-3;
if match2=6 and twks(k,j) ge 0 and r6w_2>0 then twks(k,j)=twks(k,j)+r6w_2;
if match2=6 and twks(k,j) ge 0 and r6w_2=-3 then twks(k,j)=-3;
if match3=6 and twks(k,j) ge 0 and r6w_3>0 then twks(k,j)=twks(k,j)+r6w_3;
if match3=6 and twks(k,j) ge 0 and r6w_3=-3 then twks(k,j)=-3;
if match4=6 and twks(k,j) ge 0 and r6w_4>0 then twks(k,j)=twks(k,j)+r6w_4;
if match4=6 and twks(k,j) ge 0 and r6w_4=-3 then twks(k,j)=-3;
if match5=6 and twks(k,j) ge 0 and r6w_5>0 then twks(k,j)=twks(k,j)+r6w_5;
if match5=6 and twks(k,j) ge 0 and r6w_5=-3 then twks(k,j)=-3;
if match6=6 and twks(k,j) ge 0 and r6w_6>0 then twks(k,j)=twks(k,j)+r6w_6;
if match6=6 and twks(k,j) ge 0 and r6w_6=-3 then twks(k,j)=-3;
if match1=5 and twks(k,j) ge 0 and r5w_1>0 then twks(k,j)=twks(k,j)+r5w_1;
if match1=5 and twks(k,j) ge 0 and r5w_1=-3 then twks(k,j)=-3;
if match2=5 and twks(k,j) ge 0 and r5w_2>0 then twks(k,j)=twks(k,j)+r5w_2;
if match2=5 and twks(k,j) ge 0 and r5w_2=-3 then twks(k,j)=-3;
if match3=5 and twks(k,j) ge 0 and r5w_3>0 then twks(k,j)=twks(k,j)+r5w_3;
if match3=5 and twks(k,j) ge 0 and r5w_3=-3 then twks(k,j)=-3;
if match4=5 and twks(k,j) ge 0 and r5w_4>0 then twks(k,j)=twks(k,j)+r5w_4;
if match4=5 and twks(k,j) ge 0 and r5w_4=-3 then twks(k,j)=-3;
if match5=5 and twks(k,j) ge 0 and r5w_5>0 then twks(k,j)=twks(k,j)+r5w_5;
if match5=5 and twks(k,j) ge 0 and r5w_5=-3 then twks(k,j)=-3;
if match6=5 and twks(k,j) ge 0 and r5w_6>0 then twks(k,j)=twks(k,j)+r5w_6;
if match6=5 and twks(k,j) ge 0 and r5w_6=-3 then twks(k,j)=-3;
if match1=4 and twks(k,j) ge 0 and r4w_1>0 then twks(k,j)=twks(k,j)+r4w_1;
if match1=4 and twks(k,j) ge 0 and r4w_1=-3 then twks(k,j)=-3;
if match2=4 and twks(k,j) ge 0 and r4w_2>0 then twks(k,j)=twks(k,j)+r4w_2;
if match2=4 and twks(k,j) ge 0 and r4w_2=-3 then twks(k,j)=-3;
if match3=4 and twks(k,j) ge 0 and r4w_3>0 then twks(k,j)=twks(k,j)+r4w_3;
if match3=4 and twks(k,j) ge 0 and r4w_3=-3 then twks(k,j)=-3;
if match4=4 and twks(k,j) ge 0 and r4w_4>0 then twks(k,j)=twks(k,j)+r4w_4;
if match4=4 and twks(k,j) ge 0 and r4w_4=-3 then twks(k,j)=-3;
if match5=4 and twks(k,j) ge 0 and r4w_5>0 then twks(k,j)=twks(k,j)+r4w_5;
if match5=4 and twks(k,j) ge 0 and r4w_5=-3 then twks(k,j)=-3;
if match6=4 and twks(k,j) ge 0 and r4w_6>0 then twks(k,j)=twks(k,j)+r4w_6;
if match6=4 and twks(k,j) ge 0 and r4w_6=-3 then twks(k,j)=-3;
if match1=3 and twks(k,j) ge 0 and r3w_1>0 then twks(k,j)=twks(k,j)+r3w_1;
if match1=3 and twks(k,j) ge 0 and r3w_1=-3 then twks(k,j)=-3;
if match2=3 and twks(k,j) ge 0 and r3w_2>0 then twks(k,j)=twks(k,j)+r3w_2;
if match2=3 and twks(k,j) ge 0 and r3w_2=-3 then twks(k,j)=-3;
if match3=3 and twks(k,j) ge 0 and r3w_3>0 then twks(k,j)=twks(k,j)+r3w_3;
if match3=3 and twks(k,j) ge 0 and r3w_3=-3 then twks(k,j)=-3;
if match4=3 and twks(k,j) ge 0 and r3w_4>0 then twks(k,j)=twks(k,j)+r3w_4;
if match4=3 and twks(k,j) ge 0 and r3w_4=-3 then twks(k,j)=-3;
if match5=3 and twks(k,j) ge 0 and r3w_5>0 then twks(k,j)=twks(k,j)+r3w_5;
if match5=3 and twks(k,j) ge 0 and r3w_5=-3 then twks(k,j)=-3;
if match6=3 and twks(k,j) ge 0 and r3w_6>0 then twks(k,j)=twks(k,j)+r3w_6;
if match6=3 and twks(k,j) ge 0 and r3w_6=-3 then twks(k,j)=-3;
if match1=2 and twks(k,j) ge 0 and r2w_1>0 then twks(k,j)=twks(k,j)+r2w_1;
if match1=2 and twks(k,j) ge 0 and r2w_1=-3 then twks(k,j)=-3;
if match2=2 and twks(k,j) ge 0 and r2w_2>0 then twks(k,j)=twks(k,j)+r2w_2;
if match2=2 and twks(k,j) ge 0 and r2w_2=-3 then twks(k,j)=-3;
if match3=2 and twks(k,j) ge 0 and r2w_3>0 then twks(k,j)=twks(k,j)+r2w_3;
if match3=2 and twks(k,j) ge 0 and r2w_3=-3 then twks(k,j)=-3;
if match4=2 and twks(k,j) ge 0 and r2w_4>0 then twks(k,j)=twks(k,j)+r2w_4;
if match4=2 and twks(k,j) ge 0 and r2w_4=-3 then twks(k,j)=-3;
if match5=2 and twks(k,j) ge 0 and r2w_5>0 then twks(k,j)=twks(k,j)+r2w_5;
if match5=2 and twks(k,j) ge 0 and r2w_5=-3 then twks(k,j)=-3;
if match6=2 and twks(k,j) ge 0 and r2w_6>0 then twks(k,j)=twks(k,j)+r2w_6;
if match6=2 and twks(k,j) ge 0 and r2w_6=-3 then twks(k,j)=-3;
end;
end;
run;
********************************************************
**** Total Tenure at Job #x as of the Survey Date ***
********************************************************
**** Variables created: CV_WKSWK_JOB_DLI.xx ***
********************************************************
data total_tenure;
merge one round8.emp_int round8.emp32_jobten total_numwksyr; by pubid;
if r8int>-5;
array match1 (j) match1_1-match1_7;
array match2 (j) match2_1-match2_7;
array match3 (j) match3_1-match3_7;
array match4 (j) match4_1-match4_7;
array match5 (j) match5_1-match5_7;
array match6 (j) match6_1-match6_7;
array r8ten (j) r8ten1-r8ten7;
array totten (j) totten1-totten7;
do j=1 to 7;
totten=0;
if r8ten ne . then totten=totten+r8ten;
end;
/*only R8 matches are to L1-L6, round2 to round7*/
array match {6,7} match1_1-match1_7 match2_1-match2_7 match3_1-match3_7
match4_1-match4_7 match5_1-match5_7 match6_1-match6_7;
array r7ten (i) S2035100 S2035200 S2035300 S2035400 S2035500 S2035600;
array r6ten (i) S1565000 S1565100 S1565200 S1565300 S1565400 S1565500;
array r5ten (i) R7249100 R7249200 R7249300 R7249400 R7249500 R7249600;
array r4ten (i) R5484800 R5484900 R5485000 R5485100 R5485200 R5485300;
array r3ten (i) R3901600 R3901700 R3901800 R3901900 R3902000 R3902100;
array r2ten (i) R2579200 R2579300 R2579400 R2579500 R2579600 R2579700;
do j=1 to 7;
if totten ge 0 then do;
do i=1 to 6;
if match(i,j)=7 and r7ten>0 then totten=totten+r7ten;
if match(i,j)=7 and r7ten=-3 then totten=-3;
if match(i,j)=6 and r6ten>0 then totten=totten+r6ten;
if match(i,j)=6 and r6ten=-3 then totten=-3;
if match(i,j)=5 and r5ten>0 then totten=totten+r5ten;
if match(i,j)=5 and r5ten=-3 then totten=-3;
if match(i,j)=4 and r4ten>0 then totten=totten+r4ten;
if match(i,j)=4 and r4ten=-3 then totten=-3;
if match(i,j)=3 and r3ten>0 then totten=totten+r3ten;
if match(i,j)=3 and r3ten=-3 then totten=-3;
if match(i,j)=2 and r2ten>0 then totten=totten+r2ten;
if match(i,j)=2 and r2ten=-3 then totten=-3;
end;
end;
end;
run;
********************************************************
**** Total Hours Worked in 19xx/20xx ***
********************************************************
**** Variables created: ***
**** thrsxx CV_HOURS_WK_YR_ALL.xx ***
**** tehrsxx CV_HOURS_WK_YR_ET.xx ***
**** tshrsxx CV_HOURS_WK_YR_SE.xx ***
********************************************************
data total_anhrs;
merge one round8.emp_int round8.emp_week round8.emp33_anhours; by pubid;
if r8int>-5;
array thrs (k) thrs80-thrs99 thrs00-thrs05;
array tshrs (k) tshrs80-tshrs99 tshrs00-tshrs05;
array tehrs (k) tehrs80-tehrs99 tehrs00-tehrs05;
array r1hrs (k) &R1hrs;
array r2hrs (k) &R2hrs;
array r3hrs (k) &R3hrs;
array r4hrs (k) &R4hrs;
array r4shrs (k) &R4shrs;
array r4ehrs (k) &R4ehrs;
array r5hrs (k) &R5hrs;
array r5shrs (k) &R5shrs;
array r5ehrs (k) &R5ehrs;
array r6hrs (k) &R6hrs;
array r6shrs (k) &R6shrs;
array r6ehrs (k) &R6ehrs;
array r7hrs (k) &R7hrs;
array r7shrs (k) &R7shrs;
array r7ehrs (k) &R7ehrs;
array r8hrs (k) r8hrs80-r8hrs99 r8hrs00-r8hrs05;
array r8shrs (k) r8shrs80-r8shrs99 r8shrs00-r8shrs05;
array r8ehrs (k) r8ehrs80-r8ehrs99 r8ehrs00-r8ehrs05;
/*Total hours each year is current hours and total hours from dli*/
do k=1 to 26;
thrs=0; tshrs=0; tehrs=0;
if r8hrs>0 then thrs=thrs+r8hrs;
if r8shrs>0 then tshrs=tshrs+r8shrs;
if r8ehrs>0 then tehrs=tehrs+r8ehrs;
if r7hrs>0 and dliwk=r7int then thrs=thrs+r7hrs;
if r7shrs>0 and dliwk=r7int then tshrs=tshrs+r7shrs;
if r7ehrs>0 and dliwk=r7int then tehrs=tehrs+r7ehrs;
if r6hrs>0 and dliwk=r6int then thrs=thrs+r6hrs;
if r6shrs>0 and dliwk=r6int then tshrs=tshrs+r6shrs;
if r6ehrs>0 and dliwk=r6int then tehrs=tehrs+r6ehrs;
if r5hrs>0 and dliwk=r5int then thrs=thrs+r5hrs;
if r5shrs>0 and dliwk=r5int then tshrs=tshrs+r5shrs;
if r5ehrs>0 and dliwk=r5int then tehrs=tehrs+r5ehrs;
if r4hrs>0 and dliwk=r4int then thrs=thrs+r4hrs;
if r4shrs>0 and dliwk=r4int then tshrs=tshrs+r4shrs;
if r4ehrs>0 and dliwk=r4int then tehrs=tehrs+r4ehrs;
if r3hrs>0 and dliwk=r3int then thrs=thrs+r3hrs;
if r2hrs>0 and dliwk=r2int then thrs=thrs+r2hrs;
if r1hrs>0 and dliwk=r1int then thrs=thrs+r1hrs;
if -4<r8hrs<0 then thrs=r8hrs;
if -4<r8shrs<0 then tshrs=r8shrs;
if -4<r8ehrs<0 then tehrs=r8ehrs;
if -4<r7hrs<0 and dliwk=r7int then thrs=r7hrs;
if -4<r7shrs<0 and dliwk=r7int then tshrs=r7shrs;
if -4<r7ehrs<0 and dliwk=r7int then tehrs=r7ehrs;
if -4<r6hrs<0 and dliwk=r6int then thrs=r6hrs;
if -4<r6shrs<0 and dliwk=r6int then tshrs=r6shrs;
if -4<r6ehrs<0 and dliwk=r6int then tehrs=r6ehrs;
if -4<r5hrs<0 and dliwk=r5int then thrs=r5hrs;
if -4<r5shrs<0 and dliwk=r5int then tshrs=r5shrs;
if -4<r5ehrs<0 and dliwk=r5int then tehrs=r5ehrs;
if -4<r4hrs<0 and dliwk=r4int then thrs=r4hrs;
if -4<r4shrs<0 and dliwk=r4int then tshrs=r4shrs;
if -4<r4ehrs<0 and dliwk=r4int then tehrs=r4ehrs;
if -4<r3hrs<0 and dliwk=r3int then thrs=r3hrs;
if -4<r2hrs<0 and dliwk=r2int then thrs=r2hrs;
if -4<r1hrs<0 and dliwk=r1int then thrs=r1hrs;
end;
run;
********************************************************
**** Number of Weeks Worked Age 14-19, ***
**** Weeks Worked at All Jobs Since Age 20, ***
**** and Weeks Worked at Employee-Type Jobs Since Age 20 ***
********************************************************
**** Variables created: ***
**** tewks14 CV_WKSWK_TEEN ***
**** tewks20 CV_WKSWK_ADULT_ET ***
**** twks20 CV_WKSWK_ADULT_ALL ***
********************************************************
data total_wksage14;
merge one(keep=pubid S2034800 -- S2035000 S1564700 -- S1564900 R7248800 -- R7249000
R5484500 -- R5484700 R3901500 R2579100 R1219800) round8.emp_bday
round8.emp_int round8.emp_week round8.emp29_numwks round8.emp34_wksage14
empstatus; by pubid;
if r8int>-5;
/*rename variables from prior rounds*/
r7ewks14=S2034800; r7ewks20=S2034900; r7wks20=S2035000;
r6ewks14=S1564700; r6ewks20=S1564800; r6wks20=S1564900;
r5ewks14=R7248800; r5ewks20=R7248900; r5wks20=R7249000;
r4ewks14=R5484500; r4ewks20=R5484600; r4wks20=R5484700;
r3ewks14=R3901500;
r2ewks14=R2579100;
r1ewks14=R1219800;
if age20wk<r8int then twks20=0; if age20wk<r8int then tewks20=0; tewks14=0;
if r8wks20>0 then twks20=twks20+r8wks20;
if r8ewks20>0 then tewks20=tewks20+r8ewks20;
if r8ewks14>0 then tewks14=tewks14+r8ewks14;
/*Add total wks from dli to above to create new total*/
/* dli is Round 7 */
if dliwk=r7int then do;
if r7wks20>0 then twks20=twks20+r7wks20;
if r7ewks20>0 then tewks20=tewks20+r7ewks20;
if r7ewks14>0 then tewks14=tewks14+r7ewks14;
end;
/* dli is Round 6 */
if dliwk=r6int then do;
if r6wks20>0 then twks20=twks20+r6wks20;
if r6ewks20>0 then tewks20=tewks20+r6ewks20;
if r6ewks14>0 then tewks14=tewks14+r6ewks14;
end;
/* dli is Round 5 */
if dliwk=r5int then do;
if r5wks20>0 then twks20=twks20+r5wks20;
if r5ewks20>0 then tewks20=tewks20+r5ewks20;
if r5ewks14>0 then tewks14=tewks14+r5ewks14;
end;
/* dli is Round 4 */
if dliwk=r4int then do;
if r4wks20>0 then twks20=twks20+r4wks20;
if r4ewks20>0 then tewks20=tewks20+r4ewks20;
if r4ewks14>0 then tewks14=tewks14+r4ewks14;
end;
/* dli is Round 3 */
if dliwk=r3int then do;
if r3ewks14>0 then tewks14=tewks14+r3ewks14;
end;
/* dli is Round 2 */
if dliwk=r2int then do;
if r2ewks14>0 then tewks14=tewks14+r2ewks14;
end;
/* dli is Round 1 */
if dliwk=r1int then do;
if r1ewks14>0 then tewks14=tewks14+r1ewks14;
end;
/* This section is written for backreporters. Double weeks worked are identified by comparing
Round8 weeks worked with event history emp_status. A uid on event history indicates a week
that is already identified as worked. Note earliest back reported start year is 1997*/
array alljobs (i) wks1--wks1280;
array empjobs (i) ewks1--ewks1280;
/*from event history (r7) emp_status*/
array r7ar (i) _1-_887 R8016200 -- R8021300 R8021600 -- R8026700 R8027000 -- R8032100
R8808500 -- R8813700 R8904100 -- R8909200 R9039600 -- R9044700
R9044800 -- R9049900 R9175500 -- R9178100 _1280;
/*age14wk to age20wk-1 */
dewks14=0;
if age20wk-1 le 1280 then do;
do i=888 to age20wk-1;
if empjobs=1 and r7ar>9700 then dewks14=dewks14+1;
end; end;
/* age20wk to wk1280 */
if age20wk<r8int then do; dwks20=0; dewks20=0; end;
if age20wk le 1280 then do;
do i=age20wk to 1280;
if alljobs=1 and r7ar>9700 then dwks20=dwks20+1;
if empjobs=1 and r7ar>9700 then dewks20=dewks20+1;
end; end;
if dwks20>0 then twks20=twks20-dwks20;
if dewks20>0 then tewks20=tewks20-dewks20;
if dewks14>0 then tewks14=tewks14-dewks14;
/* If either created variable from current or dli is -3,
then the overall created variable will be -3 */
if r8wks20 in (-3) then twks20=-3;
if r8ewks20 in (-3) then tewks20=-3;
if r8ewks14 in (-3) then tewks14=-3;
if r7wks20 in (-3) and dliwk=r7int then twks20=-3;
if r7ewks20 in (-3) and dliwk=r7int then tewks20=-3;
if r7ewks14 in (-3) and dliwk=r7int then tewks14=-3;
if r6wks20 in (-3) and dliwk=r6int then twks20=-3;
if r6ewks20 in (-3) and dliwk=r6int then tewks20=-3;
if r6ewks14 in (-3) and dliwk=r6int then tewks14=-3;
if r5wks20 in (-3) and dliwk=r5int then twks20=-3;
if r5ewks20 in (-3) and dliwk=r5int then tewks20=-3;
if r5ewks14 in (-3) and dliwk=r5int then tewks14=-3;
if r4wks20 in (-3) and dliwk=r4int then twks20=-3;
if r4ewks20 in (-3) and dliwk=r4int then tewks20=-3;
if r4ewks14 in (-3) and dliwk=r4int then tewks14=-3;
if r3ewks14 in (-3) and dliwk=r3int then do; tewks14=-3; end;
if r2ewks14 in (-3) and dliwk=r2int then do; tewks14=-3; end;
if r1ewks14 in (-3) and dliwk=r1int then do; tewks14=-3; end;
run;
******************************************************
**** Total Hours Worked Age 14-19, ***
**** Hours Worked at All Jobs Since Age 20, and ***
**** Hours Worked at Employee-Type Jobs Since Age 20 ***
********************************************************
**** Variables created: ***
**** CV_HOURS_WK_TEEN ***
**** CV_HOURS_WK_ADULT_ALL ***
**** CV_HOURS_WK_ADULT_ET ***
********************************************************
data total_hrsage14; merge one round8.emp_bday round8.emp_int
round8.emp_week round8.emp35_hrsage14 round7.total_hrsage14_r6(keep=pubid r3hrs20);
by pubid;
if r8int>-5;
/*rename variables from prior rounds*/
r7ehrs14=S2012400; r7ehrs20=S2012500; r7hrs20=S2012600;
r6ehrs14=S1542600; r6ehrs20=S1542700; r6hrs20=S1542800;
r5ehrs14=R7228700; r5ehrs20=R7228800; r5hrs20=R7228900;
r4ehrs14=R5465000; r4ehrs20=R5465100; r4hrs20=R5465000;
r3hrs14=R3885800;
r2hrs14=R2564200;
r1hrs14=R1205800;
/* Initialize created variables to zero. */
tehrs14=0;
if age20wk<r8int then thrs20=0;
if age20wk<r8int then tehrs20=0;
/* By the construction of the dli created variables, we can simply add the two created variables from the current and
previous rounds if they are both postive. If one is positive and one is not, then the positive value will be the total
created variable for both rounds. If neither is positive, then the total created variable for both rounds will be
zero.
Want only hrs from employee type jobs for age 14-19. All hrs R3 and earlier are assumed
to be from employee type jobs*/
if r8ehrs14=>0 then tehrs14=tehrs14+r8ehrs14;
if r8ehrs14=-3 then tehrs14=-3;
if tehrs14 ge 0 and dliwk=r7int then do;
if r7ehrs14>0 then tehrs14=tehrs14+r7ehrs14;
if r7ehrs14=-3 then tehrs14=-3;
end;
if tehrs14 ge 0 and dliwk=r6int then do;
if r6ehrs14>0 then tehrs14=tehrs14+r6ehrs14;
if r6ehrs14=-3 then tehrs14=-3;
end;
if tehrs14 ge 0 and dliwk=r5int then do;
if r5ehrs14>0 then tehrs14=tehrs14+r5ehrs14;
if r5ehrs14=-3 then tehrs14=-3;
end;
if tehrs14 ge 0 and dliwk=r4int then do;
if r4ehrs14>0 then tehrs14=tehrs14+r4ehrs14;
if r4ehrs14=-3 then tehrs14=-3;
end;
if tehrs14 ge 0 and dliwk=r3int then do;
if r3hrs14>0 then tehrs14=tehrs14+r3hrs14;
if r3hrs14=-3 then tehrs14=-3;
end;
if tehrs14 ge 0 and dliwk=r2int then do;
if r2hrs14>0 then tehrs14=tehrs14+r2hrs14;
if r2hrs14=-3 then tehrs14=-3;
end;
if tehrs14 ge 0 and dliwk=r1int then do;
if r1hrs14>0 then tehrs14=tehrs14+r1hrs14;
if r1hrs14=-3 then tehrs14=-3;
end;
/*No R is age 20 until R3*/
if r8ehrs20=>0 then tehrs20=tehrs20+r8ehrs20;
if r8ehrs20=-3 then tehrs20=-3;
if tehrs20 ge 0 and dliwk=r7int then do;
if r7ehrs20>0 then tehrs20=tehrs20+r7ehrs20;
if r7ehrs20=-3 then tehrs20=-3;
end;
if tehrs20 ge 0 and dliwk=r6int then do;
if r6ehrs20>0 then tehrs20=tehrs20+r6ehrs20;
if r6ehrs20=-3 then tehrs20=-3;
end;
if tehrs20 ge 0 and dliwk=r5int then do;
if r5ehrs20>0 then tehrs20=tehrs20+r5ehrs20;
if r5ehrs20=-3 then tehrs20=-3;
end;
if tehrs20 ge 0 and dliwk=r4int then do;
if r4ehrs20>0 then tehrs20=tehrs20+r4ehrs20;
if r4ehrs20=-3 then tehrs20=-3;
end;
if tehrs20 ge 0 and dliwk=r3int then do;
if r3hrs20>0 then tehrs20=tehrs20+r3hrs20;
if r3hrs20=-3 then tehrs20=-3;
end;
if r8hrs20=>0 then thrs20=thrs20+r8hrs20;
if r8hrs20=-3 then thrs20=-3;
if thrs20 ge 0 and dliwk=r7int then do;
if r7hrs20>0 then thrs20=thrs20+r7hrs20;
if r7hrs20=-3 then thrs20=-3;
end;
if thrs20 ge 0 and dliwk=r6int then do;
if r6hrs20>0 then thrs20=thrs20+r6hrs20;
if r6hrs20=-3 then thrs20=-3;
end;
if thrs20 ge 0 and dliwk=r5int then do;
if r5hrs20>0 then thrs20=thrs20+r5hrs20;
if r5hrs20=-3 then thrs20=-3;
end;
if thrs20 ge 0 and dliwk=r4int then do;
if r4hrs20>0 then thrs20=thrs20+r4hrs20;
if r4hrs20=-3 then thrs20=-3;
end;
if thrs20 ge 0 and dliwk=r3int then do;
if r3hrs20>0 then thrs20=thrs20+r3hrs20;
if r3hrs20=-3 then thrs20=-3;
end;
run;
********************************************************
**** Number of Jobs Held during 19xx/20xx ***
********************************************************
**** Variables created: ***
**** CV_TTL_JOB_ALL.xx ***
**** CV_TTL_JOB_ET.xx ***
**** CV_TTL_JOB_SE.xx ***
********************************************************
/* This program calculates the total number of jobs in a given year by matching up the UID's from dli Rounds
to Round 8. */
array r2job (k) &R2job;
array r3job (k) &R3job;
array r4job (k) &R4job;
array r4self (k) &R4self;
array r4emp (k) &R4emp;
array r5job (k) &R5job;
array r5self (k) &R5self;
array r5emp (k) &R5emp;
array r6job (k) &R6job;
array r6self (k) &R6self;
array r6emp (k) &R6emp;
array r7job (k) &R7job;
array r7self (k) &R7self;
array r7emp (k) &R7emp;
array r8job (k) r8job80 -r8job99 r8job00 -r8job05;
array r8self (k) r8self80-r8self99 r8self00-r8self05;
array r8emp (k) r8emp80 -r8emp99 r8emp00 -r8emp05;
array tjob (k) tjob80-tjob99 tjob00-tjob05;
array tsjob (k) tsjob80-tsjob99 tsjob00-tsjob05;
array tejob (k) tejob80-tejob99 tejob00-tejob05;
/* Initialize created variable */
do over tjob;
tjob=0;
tsjob=0;
tejob=0;
end;
do over tjob;
if r8job>0 then tjob=tjob+r8job; else if r8job=-3 then tjob=-3;
if r8emp>0 then tejob=tejob+r8emp; else if r8emp=-3 then tejob=-3;
if r8self>0 then tsjob=tsjob+r8self; else if r8self=-3 then tsjob=-3;
if dliwk=r7int then do;
if tjob ge 0 and r7job>0 then tjob=tjob+r7job; else if r7job=-3 then tjob=-3;
if tejob ge 0 and r7emp>0 then tejob=tejob+r7emp; else if r7emp=-3 then tejob=-3;
if tsjob ge 0 and r7self>0 then tsjob=tsjob+r7self; else if r7self=-3 then tsjob=-3;
end;
if dliwk=r6int then do;
if tjob ge 0 and r6job>0 then tjob=tjob+r6job; else if r6job=-3 then tjob=-3;
if tejob ge 0 and r6emp>0 then tejob=tejob+r6emp; else if r6emp=-3 then tejob=-3;
if tsjob ge 0 and r6self>0 then tsjob=tsjob+r6self; else if r6self=-3 then tsjob=-3;
end;
if dliwk=r5int then do;
if tjob ge 0 and r5job>0 then tjob=tjob+r5job; else if r5job=-3 then tjob=-3;
if tejob ge 0 and r5emp>0 then tejob=tejob+r5emp; else if r5emp=-3 then tejob=-3;
if tsjob ge 0 and r5self>0 then tsjob=tsjob+r5self; else if r5self=-3 then tsjob=-3;
end;
if dliwk=r4int then do;
if tjob ge 0 and r4job>0 then tjob=tjob+r4job; else if r4job=-3 then tjob=-3;
if tejob ge 0 and r4emp>0 then tejob=tejob+r4emp; else if r4emp=-3 then tejob=-3;
if tsjob ge 0 and r4self>0 then tsjob=tsjob+r4self; else if r4self=-3 then tsjob=-3;
end;
if dliwk=r3int then do;
if tjob ge 0 and r3job>0 then tjob=tjob+r3job; else if r3job=-3 then tjob=-3;
end;
if dliwk=r2int then do;
if tjob ge 0 and r2job>0 then tjob=tjob+r2job; else if r2job=-3 then tjob=-3;
end;
end;
array self (j) &R8sel;
array match1 (j) match1_1-match1_7;
array match2 (j) match2_1-match2_7;
array match3 (j) match3_1-match3_7;
array match4 (j) match4_1-match4_7;
array match5 (j) match5_1-match5_7;
array match6 (j) match6_1-match6_7;
array same (k) same80-same99 same00-same05;
array ssame (k) ssame80-ssame99 ssame00-ssame05;
do k=1 to 26; same=0; ssame=0; end;
array r7w_1 (k) &R7W_01;
array r7w_2 (k) &R7W_02;
array r7w_3 (k) &R7W_03;
array r7w_4 (k) &R7W_04;
array r7w_5 (k) &R7W_05;
array r7w_6 (k) &R7W_06;
array r6w_1 (k) &R6W_01;
array r6w_2 (k) &R6W_02;
array r6w_3 (k) &R6W_03;
array r6w_4 (k) &R6W_04;
array r6w_5 (k) &R6W_05;
array r6w_6 (k) &R6W_06;
array r5w_1 (k) &R5W_01;
array r5w_2 (k) &R5W_02;
array r5w_3 (k) &R5W_03;
array r5w_4 (k) &R5W_04;
array r5w_5 (k) &R5W_05;
array r5w_6 (k) &R5W_06;
array r4w_1 (k) &R4W_01;
array r4w_2 (k) &R4W_02;
array r4w_3 (k) &R4W_03;
array r4w_4 (k) &R4W_04;
array r4w_5 (k) &R4W_05;
array r4w_6 (k) &R4W_06;
array r3w_1 (k) &R3W_01;
array r3w_2 (k) &R3W_02;
array r3w_3 (k) &R3W_03;
array r3w_4 (k) &R3W_04;
array r3w_5 (k) &R3W_05;
array r3w_6 (k) &R3W_06;
array r2w_1 (k) &R2W_01;
array r2w_2 (k) &R2W_02;
array r2w_3 (k) &R2W_03;
array r2w_4 (k) &R2W_04;
array r2w_5 (k) &R2W_05;
array r2w_6 (k) &R2W_06;
array r8wks {26,11}
r8w80_1-r8w80_11 r8w81_1-r8w81_11 r8w82_1-r8w82_11 r8w83_1-r8w83_11 r8w84_1-r8w84_11
r8w85_1-r8w85_11 r8w86_1-r8w86_11 r8w87_1-r8w87_11 r8w88_1-r8w88_11 r8w89_1-r8w89_11
r8w90_1-r8w90_11 r8w91_1-r8w91_11 r8w92_1-r8w92_11 r8w93_1-r8w93_11 r8w94_1-r8w94_11
r8w95_1-r8w95_11 r8w96_1-r8w96_11 r8w97_1-r8w97_11 r8w98_1-r8w98_11 r8w99_1-r8w99_11
r8w00_1-r8w00_11 r8w01_1-r8w01_11 r8w02_1-r8w02_11 r8w03_1-r8w03_11 r8w04_1-r8w04_11
r8w05_1-r8w05_11;
do j=1 to 7; do k=1 to 26;
if r8wks(k,j)>0 and match1=7 and r7w_1>0 then same=same+1;
if r8wks(k,j)>0 and match2=7 and r7w_2>0 then same=same+1;
if r8wks(k,j)>0 and match3=7 and r7w_3>0 then same=same+1;
if r8wks(k,j)>0 and match4=7 and r7w_4>0 then same=same+1;
if r8wks(k,j)>0 and match5=7 and r7w_5>0 then same=same+1;
if r8wks(k,j)>0 and match6=7 and r7w_6>0 then same=same+1;
if r8wks(k,j)>0 and match1=6 and r6w_1>0 then same=same+1;
if r8wks(k,j)>0 and match2=6 and r6w_2>0 then same=same+1;
if r8wks(k,j)>0 and match3=6 and r6w_3>0 then same=same+1;
if r8wks(k,j)>0 and match4=6 and r6w_4>0 then same=same+1;
if r8wks(k,j)>0 and match5=6 and r6w_5>0 then same=same+1;
if r8wks(k,j)>0 and match6=6 and r6w_6>0 then same=same+1;
if r8wks(k,j)>0 and match1=5 and r5w_1>0 then same=same+1;
if r8wks(k,j)>0 and match2=5 and r5w_2>0 then same=same+1;
if r8wks(k,j)>0 and match3=5 and r5w_3>0 then same=same+1;
if r8wks(k,j)>0 and match4=5 and r5w_4>0 then same=same+1;
if r8wks(k,j)>0 and match5=5 and r5w_5>0 then same=same+1;
if r8wks(k,j)>0 and match6=5 and r5w_6>0 then same=same+1;
if r8wks(k,j)>0 and match1=4 and r4w_1>0 then same=same+1;
if r8wks(k,j)>0 and match2=4 and r4w_2>0 then same=same+1;
if r8wks(k,j)>0 and match3=4 and r4w_3>0 then same=same+1;
if r8wks(k,j)>0 and match4=4 and r4w_4>0 then same=same+1;
if r8wks(k,j)>0 and match5=4 and r4w_5>0 then same=same+1;
if r8wks(k,j)>0 and match6=4 and r4w_6>0 then same=same+1;
if r8wks(k,j)>0 and match1=3 and r3w_1>0 then same=same+1;
if r8wks(k,j)>0 and match2=3 and r3w_2>0 then same=same+1;
if r8wks(k,j)>0 and match3=3 and r3w_3>0 then same=same+1;
if r8wks(k,j)>0 and match4=3 and r3w_4>0 then same=same+1;
if r8wks(k,j)>0 and match5=3 and r3w_5>0 then same=same+1;
if r8wks(k,j)>0 and match6=3 and r3w_6>0 then same=same+1;
if r8wks(k,j)>0 and match1=2 and r2w_1>0 then same=same+1;
if r8wks(k,j)>0 and match2=2 and r2w_2>0 then same=same+1;
if r8wks(k,j)>0 and match3=2 and r2w_3>0 then same=same+1;
if r8wks(k,j)>0 and match4=2 and r2w_4>0 then same=same+1;
if r8wks(k,j)>0 and match5=2 and r2w_5>0 then same=same+1;
if r8wks(k,j)>0 and match6=2 and r2w_6>0 then same=same+1;
if r8wks(k,j)>0 and self=1 and match1=7 and r7w_1>0 then ssame=ssame+1;
if r8wks(k,j)>0 and self=1 and match2=7 and r7w_2>0 then ssame=ssame+1;
if r8wks(k,j)>0 and self=1 and match3=7 and r7w_3>0 then ssame=ssame+1;
if r8wks(k,j)>0 and self=1 and match4=7 and r7w_4>0 then ssame=ssame+1;
if r8wks(k,j)>0 and self=1 and match5=7 and r7w_5>0 then ssame=ssame+1;
if r8wks(k,j)>0 and self=1 and match6=7 and r7w_6>0 then ssame=ssame+1;
if r8wks(k,j)>0 and self=1 and match1=6 and r6w_1>0 then ssame=ssame+1;
if r8wks(k,j)>0 and self=1 and match2=6 and r6w_2>0 then ssame=ssame+1;
if r8wks(k,j)>0 and self=1 and match3=6 and r6w_3>0 then ssame=ssame+1;
if r8wks(k,j)>0 and self=1 and match4=6 and r6w_4>0 then ssame=ssame+1;
if r8wks(k,j)>0 and self=1 and match5=6 and r6w_5>0 then ssame=ssame+1;
if r8wks(k,j)>0 and self=1 and match6=6 and r6w_6>0 then ssame=ssame+1;
if r8wks(k,j)>0 and self=1 and match1=5 and r5w_1>0 then ssame=ssame+1;
if r8wks(k,j)>0 and self=1 and match2=5 and r5w_2>0 then ssame=ssame+1;
if r8wks(k,j)>0 and self=1 and match3=5 and r5w_3>0 then ssame=ssame+1;
if r8wks(k,j)>0 and self=1 and match4=5 and r5w_4>0 then ssame=ssame+1;
if r8wks(k,j)>0 and self=1 and match5=5 and r5w_5>0 then ssame=ssame+1;
if r8wks(k,j)>0 and self=1 and match6=5 and r5w_6>0 then ssame=ssame+1;
if r8wks(k,j)>0 and self=1 and match1=4 and r4w_1>0 then ssame=ssame+1;
if r8wks(k,j)>0 and self=1 and match2=4 and r4w_2>0 then ssame=ssame+1;
if r8wks(k,j)>0 and self=1 and match3=4 and r4w_3>0 then ssame=ssame+1;
if r8wks(k,j)>0 and self=1 and match4=4 and r4w_4>0 then ssame=ssame+1;
if r8wks(k,j)>0 and self=1 and match5=4 and r4w_5>0 then ssame=ssame+1;
if r8wks(k,j)>0 and self=1 and match6=4 and r4w_6>0 then ssame=ssame+1;
end;
end;
do k=1 to 26;
if tjob>0 then tjob=tjob-same;
if tsjob>0 then tsjob=tsjob-ssame;
if tejob>0 then tejob=tejob-(same-ssame);
end;
run;
********************************************************
**** Total Number of Jobs Held Age 14-19, ***
**** Number of Employee Jobs Held since Age 20, and ***
**** Number of All Jobs Held since Age 20 ***
********************************************************
**** Variables created: ***
**** CV_TTL_JOBS_TEEN ***
**** CV_TTL_JOBS_ADULT_ET ***
**** CV_ TTL_JOBS_ADULT_ALL ***
********************************************************
if pubid=915 then do; S2023100=4; S2023200=6; end;
if pubid=1159 then do; S2023100=3; S2023200=3; end;
if pubid=1392 then S2023000=5;
if pubid=2291 then S2023000=9;
if pubid=2672 then S2023000=4;
if pubid=2721 then S2023000=6;
if pubid=2930 then do; S2023100=3; S2023200=3; end;
if pubid=3084 then do; S2023000=6; S2023100=2; S2023200=2; end;
if pubid=3156 then do; S2023100=3; S2023200=3; end;
if pubid=3192 then do; S2023100=5; S2023200=5; end;
if pubid=3449 then S2023000=7;
if pubid=3549 then S2023000=3;
if pubid=3556 then S2023000=3;
if pubid=4668 then S2023000=6;
if pubid=4953 then do; S2023100=10; S2023200=10; end;
if pubid=5163 then S2023000=2;
if pubid=5868 then S2023000=7;
if pubid=5888 then S2023000=9;
if pubid=6347 then do; S2023100=4; S2023200=4; end;
if pubid=6348 then S2023000=7;
if pubid=6479 then S2023000=10;
if pubid=6535 then S2023000=6;
if pubid=7170 then do; S2023100=3; S2023200=3; end;
if pubid=7217 then do; S2023100=1; S2023200=1; end;
if pubid=7223 then S2023000=5;
if pubid=7356 then do; S2023000=3; S2023100=2; S2023200=2; end;
if pubid=7382 then do; S2023000=2; S2023100=5; S2023200=5; end;
if pubid=8990 then S2023000=5;
if pubid=9011 then do; S2023100=3; S2023200=3; end;
/*rename variables from prior rounds*/
r7emp14=S2023000; r7emp20=S2023100; r7job20=S2023200;
r6emp14=S1553400; r6emp20=S1553500; r6job20=S1553600;
r5emp14=R7238100; r5emp20=R7238200; r5job20=R7238300;
r4emp14=R5474400; r4emp20=R5474500; r4job20=R5474600;
r3emp14=R3892400; r3emp20=r3job20;
r2emp14=R2570400;
totemp14=0;
if age20wk<r8int then totjob20=0;
if age20wk<r8int then totemp20=0;
if r8emp14 ne . then totemp14=totemp14+r8emp14;
if r8job20 ne . then totjob20=totjob20+r8job20;
if r8emp20 ne . then totemp20=totemp20+r8emp20;
/* Begin by adding together the created variables from both rounds. Jobs that are double counted will be subtracted off
later in the program. */
if dliwk=r7int and totemp14 ge 0 then do;
if r7emp14>0 then totemp14=totemp14+r7emp14;
if r7emp14=-3 then totemp14=-3;
end;
if dliwk=r6int and totemp14 ge 0 then do;
if r6emp14>0 then totemp14=totemp14+r6emp14;
if r6emp14=-3 then totemp14=-3;
end;
if dliwk=r5int and totemp14 ge 0 then do;
if r5emp14>0 then totemp14=totemp14+r5emp14;
if r5emp14=-3 then totemp14=-3;
end;
if dliwk=r4int and totemp14 ge 0 then do;
if r4emp14>0 then totemp14=totemp14+r4emp14;
if r4emp14=-3 then totemp14=-3;
end;
if dliwk=r3int and totemp14 ge 0 then do;
if r3emp14>0 then totemp14=totemp14+r3emp14;
if r3emp14=-3 then totemp14=-3;
end;
if dliwk=r2int and totemp14 ge 0 then do;
if r2emp14>0 then totemp14=totemp14+r2emp14;
if r2emp14=-3 then totemp14=-3;
end;
if dliwk=r7int and totemp20 ge 0 then do;
if r7emp20>0 then totemp20=totemp20+r7emp20;
if r7emp20=-3 then totemp20=-3;
end;
if dliwk=r6int and totemp20 ge 0 then do;
if r6emp20>0 then totemp20=totemp20+r6emp20;
if r6emp20=-3 then totemp20=-3;
end;
if dliwk=r5int and totemp20 ge 0 then do;
if r5emp20>0 then totemp20=totemp20+r5emp20;
if r5emp20=-3 then totemp20=-3;
end;
if dliwk=r4int and totemp20 ge 0 then do;
if r4emp20>0 then totemp20=totemp20+r4emp20;
if r4emp20=-3 then totemp20=-3;
end;
if dliwk=r3int and totemp20 ge 0 then do;
if r3emp20>0 then totemp20=totemp20+r3emp20;
if r3emp20=-3 then totemp20=-3;
end;
if dliwk=r7int and totjob20 ge 0 then do;
if r7job20>0 then totjob20=totjob20+r7job20;
if r7job20=-3 then totjob20=-3;
end;
if dliwk=r6int and totjob20 ge 0 then do;
if r6job20>0 then totjob20=totjob20+r6job20;
if r6job20=-3 then totjob20=-3;
end;
if dliwk=r5int and totjob20 ge 0 then do;
if r5job20>0 then totjob20=totjob20+r5job20;
if r5job20=-3 then totjob20=-3;
end;
if dliwk=r4int and totjob20 ge 0 then do;
if r4job20>0 then totjob20=totjob20+r4job20;
if r4job20=-3 then totjob20=-3;
end;
if dliwk=r3int and totjob20 ge 0 then do;
if r3job20>0 then totjob20=totjob20+r3job20;
if r3job20=-3 then totjob20=-3;
end;
array match1 (j) match1_1-match1_7;
array match2 (j) match2_1-match2_7;
array match3 (j) match3_1-match3_7;
array match4 (j) match4_1-match4_7;
array match5 (j) match5_1-match5_7;
array match6 (j) match6_1-match6_7;
array emp14 (j) r8e1401-r8e1407;
array job20 (j) r8j2001-r8j2007;
array emp20 (j) r8e2001-r8e2007;
same14=0;
same20=0;
esame20=0;
do j=1 to 7;
if match1=7 and emp14>0 and r7j141>0 then same14=same14+1;
if match2=7 and emp14>0 and r7j142>0 then same14=same14+1;
if match3=7 and emp14>0 and r7j143>0 then same14=same14+1;
if match4=7 and emp14>0 and r7j144>0 then same14=same14+1;
if match5=7 and emp14>0 and r7j145>0 then same14=same14+1;
if match6=7 and emp14>0 and r7j146>0 then same14=same14+1;
if match1=7 and emp20>0 and r7j201>0 then esame20=esame20+1;
if match2=7 and emp20>0 and r7j202>0 then esame20=esame20+1;
if match3=7 and emp20>0 and r7j203>0 then esame20=esame20+1;
if match4=7 and emp20>0 and r7j204>0 then esame20=esame20+1;
if match5=7 and emp20>0 and r7j205>0 then esame20=esame20+1;
if match6=7 and emp20>0 and r7j206>0 then esame20=esame20+1;
if match1=7 and job20>0 and r7j201>0 then same20=same20+1;
if match2=7 and job20>0 and r7j202>0 then same20=same20+1;
if match3=7 and job20>0 and r7j203>0 then same20=same20+1;
if match4=7 and job20>0 and r7j204>0 then same20=same20+1;
if match5=7 and job20>0 and r7j205>0 then same20=same20+1;
if match6=7 and job20>0 and r7j206>0 then same20=same20+1;
if match1=6 and emp14>0 and r6j141>0 then same14=same14+1;
if match2=6 and emp14>0 and r6j142>0 then same14=same14+1;
if match3=6 and emp14>0 and r6j143>0 then same14=same14+1;
if match4=6 and emp14>0 and r6j144>0 then same14=same14+1;
if match5=6 and emp14>0 and r6j145>0 then same14=same14+1;
if match6=6 and emp14>0 and r6j146>0 then same14=same14+1;
if match1=6 and emp20>0 and r6j201>0 then esame20=esame20+1;
if match2=6 and emp20>0 and r6j202>0 then esame20=esame20+1;
if match3=6 and emp20>0 and r6j203>0 then esame20=esame20+1;
if match4=6 and emp20>0 and r6j204>0 then esame20=esame20+1;
if match5=6 and emp20>0 and r6j205>0 then esame20=esame20+1;
if match6=6 and emp20>0 and r6j206>0 then esame20=esame20+1;
if match1=6 and job20>0 and r6j201>0 then same20=same20+1;
if match2=6 and job20>0 and r6j202>0 then same20=same20+1;
if match3=6 and job20>0 and r6j203>0 then same20=same20+1;
if match4=6 and job20>0 and r6j204>0 then same20=same20+1;
if match5=6 and job20>0 and r6j205>0 then same20=same20+1;
if match6=6 and job20>0 and r6j206>0 then same20=same20+1;
if match1=5 and emp14>0 and r5j141>0 then same14=same14+1;
if match2=5 and emp14>0 and r5j142>0 then same14=same14+1;
if match3=5 and emp14>0 and r5j143>0 then same14=same14+1;
if match4=5 and emp14>0 and r5j144>0 then same14=same14+1;
if match5=5 and emp14>0 and r5j145>0 then same14=same14+1;
if match6=5 and emp14>0 and r5j146>0 then same14=same14+1;
if match1=5 and emp20>0 and r5j201>0 then esame20=esame20+1;
if match2=5 and emp20>0 and r5j202>0 then esame20=esame20+1;
if match3=5 and emp20>0 and r5j203>0 then esame20=esame20+1;
if match4=5 and emp20>0 and r5j204>0 then esame20=esame20+1;
if match5=5 and emp20>0 and r5j205>0 then esame20=esame20+1;
if match6=5 and emp20>0 and r5j206>0 then esame20=esame20+1;
if match1=5 and job20>0 and r5j201>0 then same20=same20+1;
if match2=5 and job20>0 and r5j202>0 then same20=same20+1;
if match3=5 and job20>0 and r5j203>0 then same20=same20+1;
if match4=5 and job20>0 and r5j204>0 then same20=same20+1;
if match5=5 and job20>0 and r5j205>0 then same20=same20+1;
if match6=5 and job20>0 and r5j206>0 then same20=same20+1;
if match1=4 and emp14>0 and r4j141>0 then same14=same14+1;
if match2=4 and emp14>0 and r4j142>0 then same14=same14+1;
if match3=4 and emp14>0 and r4j143>0 then same14=same14+1;
if match4=4 and emp14>0 and r4j144>0 then same14=same14+1;
if match5=4 and emp14>0 and r4j145>0 then same14=same14+1;
if match6=4 and emp14>0 and r4j146>0 then same14=same14+1;
if match1=4 and emp20>0 and r4j201>0 then esame20=esame20+1;
if match2=4 and emp20>0 and r4j202>0 then esame20=esame20+1;
if match3=4 and emp20>0 and r4j203>0 then esame20=esame20+1;
if match4=4 and emp20>0 and r4j204>0 then esame20=esame20+1;
if match5=4 and emp20>0 and r4j205>0 then esame20=esame20+1;
if match6=4 and emp20>0 and r4j206>0 then esame20=esame20+1;
if match1=4 and job20>0 and r4j201>0 then same20=same20+1;
if match2=4 and job20>0 and r4j202>0 then same20=same20+1;
if match3=4 and job20>0 and r4j203>0 then same20=same20+1;
if match4=4 and job20>0 and r4j204>0 then same20=same20+1;
if match5=4 and job20>0 and r4j205>0 then same20=same20+1;
if match6=4 and job20>0 and r4j206>0 then same20=same20+1;
if match1=3 and emp14>0 and r3j141>0 then same14=same14+1;
if match2=3 and emp14>0 and r3j142>0 then same14=same14+1;
if match3=3 and emp14>0 and r3j143>0 then same14=same14+1;
if match4=3 and emp14>0 and r3j144>0 then same14=same14+1;
if match5=3 and emp14>0 and r3j145>0 then same14=same14+1;
if match6=3 and emp14>0 and r3j146>0 then same14=same14+1;
if match1=3 and emp20>0 and r3j201>0 then esame20=esame20+1;
if match2=3 and emp20>0 and r3j202>0 then esame20=esame20+1;
if match3=3 and emp20>0 and r3j203>0 then esame20=esame20+1;
if match4=3 and emp20>0 and r3j204>0 then esame20=esame20+1;
if match5=3 and emp20>0 and r3j205>0 then esame20=esame20+1;
if match6=3 and emp20>0 and r3j206>0 then esame20=esame20+1;
if match1=3 and job20>0 and r3j201>0 then same20=same20+1;
if match2=3 and job20>0 and r3j202>0 then same20=same20+1;
if match3=3 and job20>0 and r3j203>0 then same20=same20+1;
if match4=3 and job20>0 and r3j204>0 then same20=same20+1;
if match5=3 and job20>0 and r3j205>0 then same20=same20+1;
if match6=3 and job20>0 and r3j206>0 then same20=same20+1;
end;
if totemp14>0 then totemp14=totemp14-same14;
if totjob20>0 then totjob20=totjob20-same20;
if totemp20>0 then totemp20=totemp20-esame20;
run;