Variable Created CV_MAINJOB_FLG For each round, this program creates a variable indicating which employer roster loop contains information for the respondent's current or most recent job (often referred to as the CPS job) at the date of the interview. If the respondent holds more than one job at the same time, the main job is the job at which he or she usually works the most hours. If hours worked are the same, the main job is the one with the earliest start date. Variables Used *******************************************************************************************************; /**Variable Names on the Gator Variable Names in the Program*********************************; 'CV_HRS_PER_WEEK.01_2019'n HRS01 'CV_HRS_PER_WEEK.02_2019'n HRS02 'CV_HRS_PER_WEEK.03_2019'n HRS03 'CV_HRS_PER_WEEK.04_2019'n HRS04 'CV_HRS_PER_WEEK.05_2019'n HRS05 'CV_HRS_PER_WEEK.06_2019'n HRS06 'CV_HRS_PER_WEEK.07_2019'n HRS07 'CV_HRS_PER_WEEK.08_2019'n HRS08 'CV_HRS_PER_WEEK.09_2019'n HRS09 'CV_HRS_PER_WEEK.10_2019'n HRS10 'CV_HRS_PER_WEEK.11_2019'n HRS11 'YEMP_CURFLAG.01_2019'n CUR01 'YEMP_CURFLAG.02_2019'n CUR02 'YEMP_CURFLAG.03_2019'n CUR03 'YEMP_CURFLAG.04_2019'n CUR04 'YEMP_CURFLAG.05_2019'n CUR05 'YEMP_CURFLAG.06_2019'n CUR06 'YEMP_CURFLAG.07_2019'n CUR07 'YEMP_CURFLAG.08_2019'n CUR08 'YEMP_CURFLAG.09_2019'n CUR09 'YEMP_CURFLAG.10_2019'n CUR10 'YEMP_CURFLAG.11_2019'n CUR11 'YEMP_STOPDATE.01~D_2019'n EnD01 'YEMP_STOPDATE.01~M_2019'n EnM01 'YEMP_STOPDATE.01~Y_2019'n EnY01 'YEMP_STOPDATE.02~D_2019'n EnD02 'YEMP_STOPDATE.02~M_2019'n EnM02 'YEMP_STOPDATE.02~Y_2019'n EnY02 'YEMP_STOPDATE.03~D_2019'n EnD03 'YEMP_STOPDATE.03~M_2019'n EnM03 'YEMP_STOPDATE.03~Y_2019'n EnY03 'YEMP_STOPDATE.04~D_2019'n EnD04 'YEMP_STOPDATE.04~M_2019'n EnM04 'YEMP_STOPDATE.04~Y_2019'n EnY04 'YEMP_STOPDATE.05~D_2019'n EnD05 'YEMP_STOPDATE.05~M_2019'n EnM05 'YEMP_STOPDATE.05~Y_2019'n EnY05 'YEMP_STOPDATE.06~D_2019'n EnD06 'YEMP_STOPDATE.06~M_2019'n EnM06 'YEMP_STOPDATE.06~Y_2019'n EnY06 'YEMP_STOPDATE.07~D_2019'n EnD07 'YEMP_STOPDATE.07~M_2019'n EnM07 'YEMP_STOPDATE.07~Y_2019'n EnY07 'YEMP_STOPDATE.08~D_2019'n EnD08 'YEMP_STOPDATE.08~M_2019'n EnM08 'YEMP_STOPDATE.08~Y_2019'n EnY08 'YEMP_STOPDATE.09~D_2019'n EnD09 'YEMP_STOPDATE.09~M_2019'n EnM09 'YEMP_STOPDATE.09~Y_2019'n EnY09 'YEMP_STOPDATE.10~D_2019'n EnD10 'YEMP_STOPDATE.10~M_2019'n EnM10 'YEMP_STOPDATE.10~Y_2019'n EnY10 'YEMP_STOPDATE.11~D_2019'n EnD11 'YEMP_STOPDATE.11~M_2019'n EnM11 'YEMP_STOPDATE.11~Y_2019'n EnY11 'YEMP_STARTDATE.01~D_2019'n STD01 'YEMP_STARTDATE.01~M_2019'n STM01 'YEMP_STARTDATE.01~Y_2019'n STY01 'YEMP_STARTDATE.02~D_2019'n STD02 'YEMP_STARTDATE.02~M_2019'n STM02 'YEMP_STARTDATE.02~Y_2019'n STY02 'YEMP_STARTDATE.03~D_2019'n STD03 'YEMP_STARTDATE.03~M_2019'n STM03 'YEMP_STARTDATE.03~Y_2019'n STY03 'YEMP_STARTDATE.04~D_2019'n STD04 'YEMP_STARTDATE.04~M_2019'n STM04 'YEMP_STARTDATE.04~Y_2019'n STY04 'YEMP_STARTDATE.05~D_2019'n STD05 'YEMP_STARTDATE.05~M_2019'n STM05 'YEMP_STARTDATE.05~Y_2019'n STY05 'YEMP_STARTDATE.06~D_2019'n STD06 'YEMP_STARTDATE.06~M_2019'n STM06 'YEMP_STARTDATE.06~Y_2019'n STY06 'YEMP_STARTDATE.07~D_2019'n STD07 'YEMP_STARTDATE.07~M_2019'n STM07 'YEMP_STARTDATE.07~Y_2019'n STY07 'YEMP_STARTDATE.08~D_2019'n STD08 'YEMP_STARTDATE.08~M_2019'n STM08 'YEMP_STARTDATE.08~Y_2019'n STY08 'YEMP_STARTDATE.09~D_2019'n STD09 'YEMP_STARTDATE.09~M_2019'n STM09 'YEMP_STARTDATE.09~Y_2019'n STY09 'YEMP_STARTDATE.10~D_2019'n STD10 'YEMP_STARTDATE.10~M_2019'n STM10 'YEMP_STARTDATE.10~Y_2019'n STY10 'YEMP_STARTDATE.11~D_2019'n STD11 'YEMP_STARTDATE.11~M_2019'n STM11 'YEMP_STARTDATE.11~Y_2019'n STY11 'YEMP_UID.01_2019'n UID01 'YEMP_UID.02_2019'n UID02 'YEMP_UID.03_2019'n UID03 'YEMP_UID.04_2019'n UID04 'YEMP_UID.05_2019'n UID05 'YEMP_UID.06_2019'n UID06 'YEMP_UID.07_2019'n UID07 'YEMP_UID.08_2019'n UID08 'YEMP_UID.09_2019'n UID09 'YEMP_UID.10_2019'n UID10 'YEMP_UID.11_2019'n UID11 'YEMP_MILFLAG.01_2019'n MIL01 'YEMP_MILFLAG.02_2019'n MIL02 'YEMP_MILFLAG.03_2019'n MIL03 'YEMP_MILFLAG.04_2019'n MIL04 'YEMP_MILFLAG.05_2019'n MIL05 'YEMP_MILFLAG.06_2019'n MIL06 'YEMP_MILFLAG.07_2019'n MIL07 'YEMP_MILFLAG.08_2019'n MIL08 'YEMP_MILFLAG.09_2019'n MIL09 'YEMP_MILFLAG.10_2019'n MIL10 'YEMP_MILFLAG.11_2019'n MIL11 ******************************************************************************************************/ SAS Code for Variable Creation /*When more than one current job is reported, the CPS/main job is defined as the job at which the person usually works the most hours. If the person works the same number of hours on more than one current job, then the CPS/main job is the one at which the person has been employed the longest (this does not take account of absences from the job. To calculate this, array the job uids, the current status, the number of hours worked, and the start dates.*/ array UID [11] UID01-UID11; array CUR [11] CUR01-CUR11; array HRS [11] HRS01-HRS11; array MIL [11] MIL01-MIL11; array STDAY [11] STD01-STD11; array STM [11] STM01-STM11; array STY [11] STY01-STY11; array BDTE [11] BDTE01-BDTE11; do i=1 to 11; if stday(i)<=0 and stday(i)>-4 then stday(i)=1; end; do i=1 to 11; if stm(i)>0 and sty(i)>0 then do; BDTE(i)=mdy(stm(i), stday(i), sty(i)); end; else if stm(i) in (-1, -2, -3) or sty(i) in (-1, -2, -3) then do; BDTE(i)=-3; begflg=1; end; end; array END [11] END01-END11; array ENM [11] ENM01-ENM11; array ENY [11] ENY01-ENY11; array EDTE [11] EDTE01-EDTE11; do i=1 to 11; if end(i)<0 and end(i)>-4 then end(i)=28; end; do i=1 to 11; if end(i)=-4 and (enm(i) ne -4 or eny(i) ne -4) then badstop=1; if enm(i)=-4 and (end(i) ne -4 or eny(i) ne -4) then badstop=2; if eny(i)=-4 and (enm(i) ne -4 or end(i) ne -4) then badstop=3; end; do i=1 to 11; if stday(i)=-4 and (stm(i) ne -4 or sty(i) ne -4) then badstart=1; if stm(i)=-4 and (stday(i) ne -4 or sty(i) ne -4) then badstart=2; if sty(i)=-4 and (stm(i) ne -4 or stday(i) ne -4) then badstart=3; end; do i=2 to 11; if enm(i)>-4 and enm(i)<0 and eny(i)>0 and eny(i)0 and eny(i)>0 then do; EDTE(i)=mdy(ENM(i), END(i), ENY(i)); end; else if enm(i) in (-1, -2, -3) or eny(i) in (-1, -2, -3) then do; edte(i)=-3; dteflg=1; end; end; if stm01=-5 then cps19=-5; if stm01=-4 and stm02=-4 and stm03=-4 and stm04=-4 and stm05=-4 and stm06=-4 and stm07=-4 and stm08=-4 and stm09=-4 and stm10=-4 and stm11=-4 then do; cps19=-4; loc=1; end; do i=1 to 11; if MIL(i)=1 then do; EDTE(i)=.; HRS(i)=.; UID(i)=.; CUR(i)=.; end; end; uidcnt=0; do i=1 to 11; if uid(i)>0 then uidcnt=uidcnt+1; end; do i=1 to 11; if uidcnt=1 and uid(i)>0 then do; cps19=i; loc=2; end; end; do i=1 to 11; if cps19=. and edte(i) ne . and edte(i) ne -3 then dtemax=max(edte01, edte02, edte03, edte04, edte05, edte06, edte07, edte08, edte09, edte10, edte11); end; do i=1 to 11; if cps19=. and edte(i)=-3 then dtemax=-3; end; count=0; do i=1 to 11; if dtemax>-3 and dtemax=edte(i) then count=count+1; end; do i=1 to 11; if cps19=. and count=1 and dtemax>-3 and dtemax=edte(i) then do; cps19=i; loc=3; end; end; if cps19=. and dtemax=. and mil01=1 and mil02 ne 0 and mil03 ne 0 and mil04 ne 0 and mil05 ne 0 and mil06 ne 0 and mil07 ne 0 and mil08 ne 0 and mil09 ne 0 and mil10 ne 0 and mil11 ne 0 then do; cps19=-4; loc=4; end; curcnt=0; do i=1 to 11; if cps19=. and cur(i)=1 then curcnt=curcnt+1; end; do i=1 to 11; if cps19=. and curcnt=1 and cur(i)=1 then do; cps19=i; curflg=1; loc=5; end; end; do i=1 to 11; if cps19=. and dtemax>-3 and edte(i)>0 and dtemax ne edte(i) then do; hrs(i)=.; bdte(i)=.; end; end; do i=1 to 11; if cps19=. and dtemax>-3 and hrs(i)=-3 then do; cps19=-3; loc=6; end; end; do i=1 to 11; if cps19=. and hrs(i)>-1 and edte(i) ne -3 then hrselg=1; end; do i=1 to 11; if hrselg=1 and hrs(i)>-1 then hrsmax=max(hrs01,hrs02,hrs03,hrs04,hrs05,hrs06,hrs07,hrs08,hrs09,hrs10,hrs11); end; hrscnt=0; do i=1 to 11; if hrsmax ne . and hrsmax=hrs(i) then hrscnt=hrscnt+1; end; do i=1 to 11; if cps19=. and hrscnt=1 and hrsmax=hrs(i) and hrsmax ne . then do; cps19=i; loc=7; end; end; do i=1 to 11; if cps19=. and hrsmax ne . and hrselg=1 and hrsmax ne hrs(i) then bdte(i)=.; end; do i=1 to 11; if cps19=. and hrselg=1 and bdte(i)>0 and hrsmax=hrs(i) then dtemin=min(bdte01, bdte02, bdte03, bdte04, bdte05, bdte06, bdte07, bdte08, bdte09, bdte10, bdte11); end; do i=1 to 11; if cps19=. and hrselg=1 and hrsmax=hrs(i) and bdte(i)=-3 then dtemin=-3; end; begcnt=0; do i=1 to 11; if dtemin>-3 and dtemin=bdte(i) then begcnt=begcnt+1; end; do i=1 to 11; if cps19=. and begcnt=1 and dtemin>-3 and dtemin=bdte(i) then do; cps19=i; loc=8; end; end; do i=1 to 11; if cps19=. and dtemin ne bdte(i) and dtemin>-3 then bdte(i)=.; end; do i=1 to 11; if cps19=. and dtemin=bdte(i) and dtemin>-3 then do; cps19=i; loc=9; end; end; if cps19=. then do; cps19=-3; loc=10; end; do i=1 to 11; if hrs(i)=0 then hrs0_f1=1; end; do i=1 to 11; if hrs(i)=0 & cps19=i then hrs0_f2=1; end; data mainjob.R19_mainjob; set two; keep pubid cps19; rename cps19=CV_MAINJOB_FLG; run;