Variables Created CVC_TRN_CERT (TRNCERT) CVC_TRN_CERT_DATE~M, Y (TRNCMTH, TRNCYR) This program creates a cross-round variable that reports whether the respondent has ever received a certificate or license other than a GED through a training program. If so, a pair of cross-round variables provide the month and year that the most recent certificate or license was obtained. These variables are created for all respondents, not just those interviewed in the most recent round. /* Cross-round training variables as of R18 */ /* dlitrnM /* 'CVC_TRN_CERT_DATE~M */ /* dlitrnY /* 'CVC_TRN_CERT_DATE~Y */ /* dlitrnCRT /* 'CVC_TRN_CERT */ /* R19 training variables */ /* Month day and year stopped attending training that R was attending last interview */ /* T640D1 'YTRN-640.01~D_2019'n */ /* T640M1 'YTRN-640.01~M_2019'n */ /* T640Y1 'YTRN-640.01~Y_2019'n */ /* T640D2 'YTRN-640.02~D_2019'n */ /* T640M2 'YTRN-640.02~M_2019'n */ /* T640Y2 'YTRN-640.02~Y_2019'n */ /* T640D3 'YTRN-640.03~D_2019'n */ /* T640M3 'YTRN-640.03~M_2019'n */ /* T640Y3 'YTRN-640.03~Y_2019'n */ /* T640D4 'YTRN-640.04~D_2019'n */ /* T640M4 'YTRN-640.04~M_2019'n */ /* T640Y4 'YTRN-640.04~Y_2019'n */ /* Month, day and year ended training */ /* T1500D1 'YTRN-1500.01~D_2019'n */ /* T1500M1 'YTRN-1500.01~M_2019'n */ /* T1500Y1 'YTRN-1500.01~Y_2019'n */ /* T1500D2 'YTRN-1500.02~D_2019'n */ /* T1500M2 'YTRN-1500.02~M_2019'n */ /* T1500Y2 'YTRN-1500.02~Y_2019'n */ /* T1500D3 'YTRN-1500.03~D_2019'n */ /* T1500M3 'YTRN-1500.03~M_2019'n */ /* T1500Y3 'YTRN-1500.03~Y_2019'n */ /* T1500D4 'YTRN-1500.04~D_2019'n */ /* T1500M4 'YTRN-1500.04~M_2019'n */ /* T1500Y4 'YTRN-1500.04~Y_2019'n */ /* T1500D5 'YTRN-1500.05~D_2019'n */ /* T1500M5 'YTRN-1500.05~M_2019'n */ /* T1500Y5 'YTRN-1500.05~Y_2019'n */ /* T1500D6 'YTRN-1500.06~D_2019'n */ /* T1500M6 'YTRN-1500.06~M_2019'n */ /* T1500Y6 'YTRN-1500.06~Y_2019'n */ /* T1500D7 'YTRN-1500.07~D_2019'n */ /* T1500M7 'YTRN-1500.07~M_2019'n */ /* T1500Y7 'YTRN-1500.07~Y_2019'n */ /* T1500D8 'YTRN-1500.08~D_2019'n */ /* T1500M8 'YTRN-1500.08~M_2019'n */ /* T1500Y8 'YTRN-1500.08~Y_2019'n */ /* T1500D9 'YTRN-1500.09~D_2019'n */ /* T1500M9 'YTRN-1500.09~M_2019'n */ /* T1500Y9 'YTRN-1500.09~Y_2019'n */ /* T1500D10 'YTRN-1500.10~D_2019'n */ /* T1500M10 'YTRN-1500.10~M_2019'n */ /* T1500Y10 'YTRN-1500.10~Y_2019'n */ /* T1500D11 'YTRN-1500.11~D_2019'n */ /* T1500M11 'YTRN-1500.11~M_2019'n */ /* T1500Y11 'YTRN-1500.11~Y_2019'n */ /* T1500D12 'YTRN-1500.12~D_2019'n */ /* T1500M12 'YTRN-1500.12~M_2019'n */ /* T1500Y12 'YTRN-1500.12~Y_2019'n */ /* T1500D13 'YTRN-1500.13~D_2019'n */ /* T1500M13 'YTRN-1500.13~M_2019'n */ /* T1500Y13 'YTRN-1500.13~Y_2019'n */ /* T1500D14 'YTRN-1500.14~D_2019'n */ /* T1500M14 'YTRN-1500.14~M_2019'n */ /* T1500Y14 'YTRN-1500.14~Y_2019'n */ /* T1500D15 'YTRN-1500.15~D_2019'n */ /* T1500M15 'YTRN-1500.15~M_2019'n */ /* T1500Y15 'YTRN-1500.15~Y_2019'n */ /* Did R receive certificate, license or degree from training? */ /* T69001 'YTRN-6900.01_2019'n */ /* T69002 'YTRN-6900.02_2019'n */ /* T69003 'YTRN-6900.03_2019'n */ /* T69004 'YTRN-6900.04_2019'n */ /* T69005 'YTRN-6900.05_2019'n */ /* T69006 'YTRN-6900.06_2019'n */ /* T69007 'YTRN-6900.07_2019'n */ /* T69008 'YTRN-6900.08_2019'n */ /* T69009 'YTRN-6900.09_2019'n */ /* T69010 'YTRN-6900.10_2019'n */ /* T69011 'YTRN-6900.11_2019'n */ /* T69012 'YTRN-6900.12_2019'n */ /* T69013 'YTRN-6900.13_2019'n */ /* T69014 'YTRN-6900.14_2019'n */ /* T69015 'YTRN-6900.15_2019'n */ /* Type of certificate/licensing received */ /* T70001 'YTRN-7000.01_2019'n */ /* T70002 'YTRN-7000.02_2019'n */ /* T70003 'YTRN-7000.03_2019'n */ /* T70004 'YTRN-7000.04_2019'n */ /* T70005 'YTRN-7000.05_2019'n */ /* T70006 'YTRN-7000.06_2019'n */ /* T70007 'YTRN-7000.07_2019'n */ /* T70008 'YTRN-7000.08_2019'n */ /* T70009 'YTRN-7000.09_2019'n */ /* T70010 'YTRN-7000.10_2019'n */ /* T70012 'YTRN-7000.12_2019'n */ /* T70013 'YTRN-7000.13_2019'n */ /* PUBID 'PUBID'n */ /* INT_Y 'CV_INTERVIEW_DATE~Y'n */ /* INT_M 'CV_INTERVIEW_DATE~M'n */ SAS Code for Variable Creation /*Initialize variables*/ TRNCERT=.; /*Ever received vocational/completion certificate or state license*/ TRNCMTH=.; /*Month of most recent certificate/license--based on date of completion of most recent cert/lic granting training program*/ TRNCYR=.; /*Year of most recent certificate/license--based on date of completion of most recent cert/lic granting training program*/ /*Defining arrays*/ %let n=15; /*# loops */ array recent(&n); *not used?; array t6900{&n}; *receive cert?; array t7000{&n}; *type of cert?; array t1500m{&n}; *end of training (month); array t1500y{&n}; *end of training (year); array t1500cm(&n); *working variable for calendar month; array t640m{&n}; *end of previously in progress training (month); array t640y{&n}; *end of previously in progress training (year); array t640cm(&n); *working variable for calendar month; array T_cm(&n); *working variable for calendar month - what is this for?; /* noninterviews */ if int_y=-5 then do; do i=1 to (&n); t6900{i} =-5; t7000{i}=-5; t1500m{i}=-5; t1500y{i}=-5; t1500cm(i)=-5; t640m{i}=-5; t640y{i}=-5; t640cm(i)=-5; end; end; /* initialize variables for interviewed respondents if missing */ if int_y>-5 then do; do i=1 to (&n); if t6900{i} = . then t6900{i} = -4; if t7000{i} = . then t7000{i} = -4; if t1500m{i} = . then t1500m{i} = -4; if t1500y{i} = . then t1500y{i} = -4; if t1500cm(i)= . then t1500cm(i) =-4; if t640m{i}= . then t640m{i} =-4 ; if t640y{i}=. then t640y{i}=-4; if t640cm(i)=. then t640cm(i)=-4; end; end; /* If R completed previously started training, assign month and year from t640 to t1500 variables */ do i=1 to (&n); if t640m{i} >-4 & t640y{i}>-4 & t1500m{i}=-4 then do; t1500m{i}=t640m{i}; t1500y{i}=t640y{i}; t640m{i}=-4; t640y{i}=-4; end; /* If valid training month and year and received a vocational certificate, state license, certificate of completion or other licence, compute calendar months since 1980 */ if t1500m{i} >0 & t1500y{i}>0 & t6900{i}=1 and (1<=t7000{i}<=3 or t7000{i}=8) then do; t1500cm{i}= (t1500y{i}-1980)*12+t1500m{i}; *months since 1980?; end; * choose maximum of dates above; if t1500cm{i}>0 then do; T_cm(&n) = max(of t1500cm1-t1500cm15); /* R19 changed to 15 (number of loops) */ end; end; do i=1 to (&n); if T_cm(&n)>0 then do; do i=492 to 216 by -12; /* CHECK! R16: 420 to 216 R15: 396 to 216 (12/2012-12/1997) */ if i-11<=T_cm(&n)<=i then do; /* R17: 444 to 216, R18: 468 to 216, R19: 492 to 216 */ TRNCMTH=T_cm(&n)-(i-12); * converts back to month; TRNCYR=(T_cm(&n)-TRNCMTH)/12+1980; * converts back to year; end; end; end; end; if TRNCMTH>-4 then TRNCERT=1; /* if no certificate then do */ do i=1 to (&n); if TRNCERT^=1 then do; if t6900{i}=0 then TRNCERT=0; if t6900{i}=1 and t7000{i}>3 & t7000{i} ne 8 then TRNCERT=0; *certificate types other than 1,2,3,8 are not counted; if t6900{i}=1 and t7000{i}<1 then TRNCERT=0; * if missing type of certificate; end; /* if certificate, but invalid month or year then do */ if t6900{i}=1 and (1<=t7000{i}<=3 or t7000{i}=8) & TRNCMTH = . & ( t1500M(i) in (-1 -2) | t1500Y(i) in (-1 -2)) then do; TRNCMTH=t1500M(i); TRNCYR= t1500Y(i); TRNCERT=1; end; end; /*This part compares values for current round to created vars for previous round(s) to obtain the most recent date of cert/lic receipt*/ if TRNCERT in(. , 0 ,-3 ) & dlitrnCRT in ( -3, 1) then do; TRNCERT=dlitrnCRT; TRNCYR=dlitrnY; TRNCMTH=dlitrnM; end; if TRNCERT=. and dlitrnCRT=0 then do; TRNCERT=dlitrnCRT; TRNCYR=dlitrnY; TRNCMTH=dlitrnM; end; /*if previous report was an invalid skip and there has never been a valid cert reported, this carries that value forward. Rosella says that it was decided to leave the last valid training date with a year as the most recent training date. */ if TRNCERT=1 and dlitrnCRT=1 and dlitrnY>TRNCYR then do; TRNCYR=dlitrnY; TRNCMTH=dlitrnM; end; if TRNCERT=1 and dlitrnCRT=1 and dlitrnY=TRNCYR and dlitrnM>TRNCMTH then do; TRNCMTH=dlitrnM; end; if TRNCYR in (-1,-2) then TRNCYR=-3; *DK/Ref year assigned to -3; if TRNCMTH in (-1,-2) then TRNCMTH=-3; *DK/Ref month assigned to -3; if TRNCERT=. and t69001=-4 then TRNCERT=-4; *no new training reported for interviewed R; if TRNCERT=. and t69001=-5 then TRNCERT=-5; *non-interview; if TRNCERT=. and t69001 in (-1,-2,-3) then TRNCERT=-3; *DK/REF/-3 assigned to -3; /* Refusals (-1) and Don't knows (-2) are all set to -3 for date and certification */ /* The following code is from the webpage but not in Hong's program that Rosella initially copied over for me. */ /* I added it back once I had access to Hong's original program in her Hong_Work folder */ /*if R received training cert but there is no date, then date variables = invalid skip */ if TRNCERT=1 and TRNCMTH<1 then TRNCMTH=-3; if TRNCERT=1 and TRNCYR<1 then TRNCYR=-3; /*if R took training but did not receive training cert then the date variables = valid skip */ if TRNCERT=0 then TRNCMTH=-4; if TRNCERT=0 then TRNCYR=-4; if TRNCERT=-3 then TRNCMTH=-3; if TRNCERT=-3 then TRNCYR=-3; if TRNCERT=-4 then TRNCMTH=-4; if TRNCERT=-4 then TRNCYR=-4; if T640M1=-5 then TRNCMTH=-5; if T640M1=-5 then TRNCYR=-5; /* Non-interviews: assign CVC training variables as of R18 */ if int_y=-5 then do; TRNCERT=dlitrnCRT; TRNCYR=dlitrnY; TRNCMTH=dlitrnM; end;