/***************************Status at Date of Interview Variables**************************/ /*CV_DOI_EMPLOYED*/ /* This program creates the CV_DOI_EMPLOYED variable, using information from the employment event history variables for status EMP_STATUS at the interview date*/ data R20_doi_employed; merge r20emp.current_(keep=pubid r0int) r20emp.emp_array_btw; by pubid; array alljobs (i) _1-_892 wks893-wks2231; do i=893 to 2231; if i=r0int-1 then do; empstat_wbi=alljobs; if empstat_wbi>0 & empstat_wbi<=5 & empstat_wbi~=3 then cv_doi_employed=0;*Rs who are associated with an employer but report a with-in job gap during that time are coded as not currently working; else if empstat_wbi=6 then cv_doi_employed=2;*in military service; else if empstat_wbi>=9701 then cv_doi_employed=1; else if empstat_wbi=0 | empstat_wbi=3 then cv_doi_employed=-3;*no info reported to account for week, job date indeterminate. associated with an employer, periods not working missing; else if empstat_wbi=. then cv_doi_employed=0; end; end; if r0int=-5 then cv_doi_employed=-5; run; /*CV_DOI_HOURS_WORKED*/ /* This program creates the CV_DOI_HOURS_WORKED variable, using information from the employment event history variables for the number of hours worked EMP_HOURS at the interview date*/ data R20_doi_hours_worked; merge r20emp.current_(keep=pubid r0int) r20emp.emp_array_hrs R20_doi_employed (keep=pubid cv_doi_employed); by pubid; array hrs (i) _1-_892 hr893-hr2231; do i=893 to 2231; if i=r0int-1 then do; hrs_doi=hrs; if hrs_doi>-4 & hrs_doi<0 then cv_doi_hours_worked=-3; else if hrs_doi>=0 & hrs_doi<30 then cv_doi_hours_worked=0; else if hrs_doi>=30 then cv_doi_hours_worked=1; else if hrs_doi=-4|hrs_doi=. then cv_doi_hours_worked=-4; end; end; if cv_doi_employed=0 & cv_doi_hours_worked=-3 then cv_doi_hours_worked=-4; if r0int=-5 then cv_doi_hours_worked=-5; run; /* CV_DOI_DISABLED*/ /* This program creates the CV_DOI_DISABLED variable, using information from the employment section*/ proc sql; create table number as select pubid, qname, response from nlsy97.yth2021 where qname like 'YEMP-119200.%' or qname like 'YEMP-119300.%' or qname like 'YEMP-119410AA.%' or qname like 'YEMP-119410B.%' or qname like 'YEMP-119410D.%' or qname in ('YEMP-119650.01','YEMP-119650.02','YEMP-119650.03','YEMP-119650.04','YEMP-119650.05','YEMP-119650.06','YEMP-119650.08') order by pubid, qname; create table character as select pubid, qname, response_a from nlsy97.yth2021 where qname like 'YEMP-119650_V%' order by pubid, qname; quit; proc transpose data=number out=number2 let; by pubid; id qname; var response; proc contents; proc transpose data=character out=character2 let; by pubid; id qname; var response_a; run; data r20emp.emp_btw; set emp_btw; keep pubid r0int gapb: gape:; run; data dis; merge r20emp.emp_btw one; by pubid; array gapb (i) gapb1-gapb8; * start week of a gap; array gape (i) gape1-gape8; * stop week of a gap; array y119410a (i) yemp_119410aa_01-yemp_119410aa_08; array y119410b (i) yemp_119410b_01-yemp_119410b_08; gap_ct=0; do i=1 to 8; if gapb>0 then gap_ct=gap_ct+1; end; if CV_DOI_EMPLOYED=1|CV_DOI_EMPLOYED=2|CV_DOI_EMPLOYED=-3 then dis=-4; else if CV_DOI_EMPLOYED=0 & gap_ct=0 then dis=0; else if CV_DOI_EMPLOYED=0 & gap_ct>0 then do; do i=1 to 8; if gapb<=r0int-1 & gape>=r0int-1 then do; gapnumber=i; if y119410a=3|y119410b=3 then dis=1; else dis=0; end; else if dis=. & gape