Current or Most Recent Employer - Appendix 2

National Longitudinal Survey of Youth - 1997 Cohort

Current or Most Recent Employer - Appendix 2

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 in the Program           Variable Names on the Gator*/

  'HRS01'n                                CV_HRS_PER_WEEK.01            
  'HRS02'n                                CV_HRS_PER_WEEK.02            
  'HRS03'n                                CV_HRS_PER_WEEK.03            
  'HRS04'n                                CV_HRS_PER_WEEK.04            
  'HRS05'n                                CV_HRS_PER_WEEK.05            
  'HRS06'n                                CV_HRS_PER_WEEK.06            
  'HRS07'n                                CV_HRS_PER_WEEK.07            
  'HRS08'n                                CV_HRS_PER_WEEK.08            
  'HRS09'n                                CV_HRS_PER_WEEK.09            
  'PUBID'n                                PUBID                         
  'CUR01'n                                YEMP_CURFLAG.01               
  'CUR02'n                                YEMP_CURFLAG.02               
  'CUR03'n                                YEMP_CURFLAG.03               
  'CUR04'n                                YEMP_CURFLAG.04               
  'CUR05'n                                YEMP_CURFLAG.05               
  'CUR06'n                                YEMP_CURFLAG.06               
  'CUR07'n                                YEMP_CURFLAG.07               
  'CUR08'n                                YEMP_CURFLAG.08               
  'CUR09'n                                YEMP_CURFLAG.09               
  'EnD01'n                                YEMP_STOPDATE.01~D            
  'EnM01'n                                YEMP_STOPDATE.01~M            
  'EnY01'n                                YEMP_STOPDATE.01~Y            
  'EnD02'n                                YEMP_STOPDATE.02~D            
  'EnM02'n                                YEMP_STOPDATE.02~M            
  'EnY02'n                                YEMP_STOPDATE.02~Y            
  'EnD03'n                                YEMP_STOPDATE.03~D            
  'EnM03'n                                YEMP_STOPDATE.03~M            
  'EnY03'n                                YEMP_STOPDATE.03~Y            
  'EnD04'n                                YEMP_STOPDATE.04~D            
  'EnM04'n                                YEMP_STOPDATE.04~M            
  'EnY04'n                                YEMP_STOPDATE.04~Y            
  'EnD05'n                                YEMP_STOPDATE.05~D            
  'EnM05'n                                YEMP_STOPDATE.05~M            
  'EnY05'n                                YEMP_STOPDATE.05~Y            
  'EnD06'n                                YEMP_STOPDATE.06~D            
  'EnM06'n                                YEMP_STOPDATE.06~M            
  'EnY06'n                                YEMP_STOPDATE.06~Y            
  'EnD07'n                                YEMP_STOPDATE.07~D            
  'EnM07'n                                YEMP_STOPDATE.07~M            
  'EnY07'n                                YEMP_STOPDATE.07~Y            
  'EnD08'n                                YEMP_STOPDATE.08~D            
  'EnM08'n                                YEMP_STOPDATE.08~M            
  'EnY08'n                                YEMP_STOPDATE.08~Y            
  'EnD09'n                                YEMP_STOPDATE.09~D            
  'EnM09'n                                YEMP_STOPDATE.09~M            
  'EnY09'n                                YEMP_STOPDATE.09~Y            
  'STD01'n                                YEMP_STARTDATE.01~D           
  'STM01'n                                YEMP_STARTDATE.01~M           
  'STY01'n                                YEMP_STARTDATE.01~Y           
  'STD02'n                                YEMP_STARTDATE.02~D           
  'STM02'n                                YEMP_STARTDATE.02~M           
  'STY02'n                                YEMP_STARTDATE.02~Y           
  'STD03'n                                YEMP_STARTDATE.03~D           
  'STM03'n                                YEMP_STARTDATE.03~M           
  'STY03'n                                YEMP_STARTDATE.03~Y           
  'STD04'n                                YEMP_STARTDATE.04~D           
  'STM04'n                                YEMP_STARTDATE.04~M           
  'STY04'n                                YEMP_STARTDATE.04~Y           
  'STD05'n                                YEMP_STARTDATE.05~D           
  'STM05'n                                YEMP_STARTDATE.05~M           
  'STY05'n                                YEMP_STARTDATE.05~Y           
  'STD06'n                                YEMP_STARTDATE.06~D           
  'STM06'n                                YEMP_STARTDATE.06~M           
  'STY06'n                                YEMP_STARTDATE.06~Y           
  'STD07'n                                YEMP_STARTDATE.07~D           
  'STM07'n                                YEMP_STARTDATE.07~M           
  'STY07'n                                YEMP_STARTDATE.07~Y           
  'STD08'n                                YEMP_STARTDATE.08~D           
  'STM08'n                                YEMP_STARTDATE.08~M           
  'STY08'n                                YEMP_STARTDATE.08~Y           
  'STD09'n                                YEMP_STARTDATE.09~D           
  'STM09'n                                YEMP_STARTDATE.09~M           
  'STY09'n                                YEMP_STARTDATE.09~Y           
  'UID01'n                                YEMP_UID.01                   
  'UID02'n                                YEMP_UID.02                   
  'UID03'n                                YEMP_UID.03                   
  'UID04'n                                YEMP_UID.04                   
  'UID05'n                                YEMP_UID.05                   
  'UID06'n                                YEMP_UID.06                   
  'UID07'n                                YEMP_UID.07                   
  'UID08'n                                YEMP_UID.08                   
  'UID09'n                                YEMP_UID.09                   
  'MIL01'n                                YEMP_MILFLAG.01               
  'MIL02'n                                YEMP_MILFLAG.02               
  'MIL03'n                                YEMP_MILFLAG.03               
  'MIL04'n                                YEMP_MILFLAG.04               
  'MIL05'n                                YEMP_MILFLAG.05               
  'MIL06'n                                YEMP_MILFLAG.06               
  'MIL07'n                                YEMP_MILFLAG.07               
  'MIL08'n                                YEMP_MILFLAG.08               
  'MIL09'n                                YEMP_MILFLAG.09        

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 job identifiers (UID) by round*/
array UID [9] UID01 UID02 UID03 UID04 UID05 UID06 UID07 UID08 UID09;

/*array current status (CUR) by round*/
array CUR [9] CUR01 CUR02 CUR03 CUR04 CUR05 CUR06 CUR07 CUR08 CUR09;

/*array hours (HRS) by round*/
array HRS [9] HRS01 HRS02 HRS03 HRS04 HRS05 HRS06 HRS07 HRS08 HRS09;

*array military (MIL) by round;
array MIL [9] MIL01 MIL02 MIL03 MIL04 MIL05 MIL06 MIL07 MIL08 MIL09;

/*array start day (STDAY) by round*/
array STDAY [9] STD01 STD02 STD03 STD04 STD05 STD06 STD07 STD08 STD09;

/*array start month (STM) by round*/
array STM [9] STM01 STM02 STM03 STM04 STM05 STM06 STM07 STM08 STM09;

/*array start year (STY) by round*/
array STY [9] STY01 STY02 STY03 STY04 STY05 STY06 STY07 STY08 STY09;

/*array start date (BDTE) by round*/
array BDTE [9] BDTE01 BDTE02 BDTE03 BDTE04 BDTE05 BDTE06 BDTE07 BDTE08 BDTE09;

/*set any missing start days to the first day of the month*/
do i=1 to 9;
 if stday(i)<0 and stday(i)>-4 then stday(i)=1;
end;

/*calculate the combined start date for all dates with valid day, month year - for all others, set the variable to an invalid skip (-3)*/
do i=1 to 9;
 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 day (END) by round*/
array END [9] END01 END02 END03 END04 END05 END06 END07 END08 END09;

/*array end month (ENM) by round*/
array ENM [9] ENM01 ENM02 ENM03 ENM04 ENM05 ENM06 ENM07 ENM08 ENM09;

/*array end year (ENY) by round*/
array ENY [9] ENY01 ENY02 ENY03 ENY04 ENY05 ENY06 ENY07 ENY08 ENY09;

*array end date (EDTE) by round;
array EDTE [9] EDTE01 EDTE02 EDTE03 EDTE04 EDTE05 EDTE06 EDTE07 EDTE08 EDTE09;

do i=1 to 9;
 if end(i)<0 and end(i)>-4 then end(i)=28;
end;

/*fill in the end-job-months where the corresponding reported year is less than reported year in a job with a good date*/
do i=2 to 9;
  if enm(i)>-4 and enm(i)<0 and eny(i)>0 and eny(i)<eny(i-1) then do;
    enm(i)=12;
    bmgy=i;
  end;
end;

/*set to calculated dates to missing when the month or year is missing*/
do i=1 to 9;
/*09*/
 if enm(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;

/*determine the main job*/
/*first determine whether the respondent is interviewed in the round and held any civilian job - if not set the variable to -4 (or -5 if not interviewed)*/
if stm01=-5 then cps10=-5;
if stm01=-4 and stm02=-4 then cps10=-4;

/*define military jobs and set to missing associated values*/
do i=1 to 9;
  if MIL(i)=1 then do;
   EDTE(i)=.;
     HRS(i)=.;
     UID(i)=.;
     CUR(i)=.;
  end;
end;

/*count the total number of civilian jobs*/
uidcnt=0;
do i=1 to 9;
  if uid(i)>0 then uidcnt=uidcnt+1;
end;

do i=1 to 9;
  if uidcnt=1 and uid(i)>0 and edte(i)=-3 then cps=i;
end;

do i=1 to 9;
  if cps10=. and edte(i) ne .  and edte(i) ne -3 then dtemax=max(edte01, edte02, edte03, edte04, edte05, edte06, edte07, edte08, edte09);
end;

/*this is taking out the people with bad end months and years - need to figure it out next*/
do i=1 to 9;
 if  edte(i)=-3 then dtemax=.;
end;

count=0;
do i=1 to 9;
  if dtemax ne . and dtemax=edte(i) then count=count+1;
end;

do i=1 to 9;
  if cps10=. and count=1 and dtemax ne . and dtemax=edte(i) and dtemax ne . then cps10=i;
end;

do i=1 to 9;
  if cps10=. and dtemax=. and mil01=1 and mil(i) ne 0 then cps10=-4;
end;

/*check the count of current jobs against the total jobs - if only 1 current job, then choose that for the main job*/
curcnt=0;

do i=1 to 9;
  if cps10=. and cur(i)=1 then curcnt=curcnt+1;
end;

do i=1 to 9;
  if cps10=. and curcnt=1 and cur(i)=1 then do;
    cps10=i;
      curflg=1;
  end;
end;

/*for multiple jobs, determine the job with more hours if the dates are the same*/
/*first set to missing any hours for jobs no longer considered*/
do i=1 to 9;
  if cps10=. and dtemax ne . and edte(i)>0 and dtemax ne edte(i) then hrs(i)=.;
end;

do i=1 to 9;
  if cps10=. and dtemax ne . and hrs(i)=-3 then cps10=-3;
end;

do i=1 to 9;
  if cps10=. and dtemax ne . and hrs(i)>-1 and hrs(i) ne . and edte(i) ne -3 then hrselg=1;
end;

do i=1 to 9;
  if hrselg=1 and hrs(i)>-1 then hrsmax=max(hrs01, hrs02, hrs03, hrs04, hrs05, hrs06, hrs07, hrs08, hrs09);
end;

hrscnt=0;
do i=1 to 9;
  if hrsmax ne . and hrsmax=hrs(i) then hrscnt=hrscnt+1;
end;

do i=1 to 9;
  if cps10=. and hrscnt=1 and hrsmax=hrs(i) and hrsmax ne . then cps10=i;
end;

/*for multiple jobs, determine the job with the earlier start date if hours and end dates are the same*/
do i=1 to 9;
  if cps10=. and hrsmax ne . and hrselg=1 and hrsmax ne hrs(i) then bdte(i)=.;
end;

do i=1 to 9;
  if cps10=. and bdte(i) ne . and hrselg=1 and bdte(i)>0 and hrsmax=hrs(i) then dtemin=min(bdte01, bdte02, bdte03, bdte04, bdte05, bdte06, bdte07, bdte08, bdte09);
end;

/*this is taking out the people with bad beginning months and years - need to figure it out next*/
do i=1 to 9;
 if  bdte(i)=-3 then dtemin=.;
end;

begcnt=0;
do i=1 to 9;
  if dtemin ne . and dtemin=bdte(i) then begcnt=begcnt+1;
end;

do i=1 to 9;
  if cps10=. and begcnt=1 and dtemin ne . and dtemin=bdte(i) and dtemin ne . then cps10=i;
end;

/*if more than one job has the same end date, hours, and beginning date, then just choose the first on the roster*/
do i=1 to 9;
  if cps10=. and dtemin ne bdte(i) and dtemin ne . then bdte(i)=.;
end;

do i=1 to 8;
  if cps10=. and bdte(i)=bdte(i+1) and dtemin=bdte(i) and bdte(i) ne . then cps10=i;
end;

/*assign invalid skips to respondents without valid job information*/
if cps10=. then cps10=-3;
endsas;