This appendix contains programs that produce a number of created variables in the current round (2020).
- AGEATINT -- Age at Interview variable creation (2020)
- MARST_CHNG#_TYPE, MARST_CHNG#_DATE~M/Y -- Marital Status changes variable creation (2020)
- MARSTAT-KEY, MARSTAT-COL -- Key Marital Status and Marital Status Collapsed
- PAST_CALENDAR_YEAR -- Past Calendar Year variable creation (2020)
- FAMSIZE -- Family Size variable creation (2020)
- HRP#_WHRLY2 -- Hourly Rate of Pay, Initial Report Non-Hourly variable creation (2020)
- BUSOWN-[QNAME].## - XRND Business Ownership Series (2020 updates)
2020 Age at Interview Variable Creation
curmo CURDATE_M (2020)
curry CURDATE_Y (2020)
brthmo79 Q1-3_A~M (1979)
brthyr79 Q1-3_A~M (1979)
brthmo81 Q1-3_A~M (1981)
brthyr81 Q1-3_A~Y (1981)
if brthyr81 >= -4 then do;
birthmo=brthmo81;
birthyr=brthyr81+1900;
end;
else do;
birthmo=brthmo79;
birthyr=brthyr79+1900;
end;
intmo=curmo;
intyr=curyr;
intyr = curyr;
ageatint=-4;
if (intyr > 0 and birthyr > 0 and intmo > 0 and birthmo > 0) then do;
if (intmo > birthmo) then ageatint = intyr - birthyr;
else if (intmo <= birthmo) then ageatint = intyr - birthyr - 1;
end;
else ageatint = -5;
2020 Marital Status Changes Since Last Interview Variable Creation
CURDATE~Y_2020'n CURDATEY
Q2-1_2020'n Q2_1
Q2-2_2020'n Q2_2
Q2-3-0A_2020'n NEEDDATE
Q2-3-0B~M_2020'n MO_MSINCORR
Q2-3-0B~Y_2020'n YR_MSINCORR
Q2-3A_2020'n Q2_3A
Q2-4AC_2020'n CURMARNOCHG
Q2-4A_2020'n CURMARCHG
Q2-5A1B.01_2020'n LSTMARREPL1
Q2-5A1B.02_2020'n LSTMARREPL2
Q2-5A1B.03_2020'n LSTMARREPL2
Q2-5A1.01_2020'n CHGL1_SDW
Q2-5A1.02_2020'n CHGL2_SDW
Q2-5A1.03_2020'n CHGL3_DRW
Q2-5A1_A.01_2020'n CHGL1_DRW
Q2-5A1_A.02_2020'n CHGL2_DRW
Q2-5B1.01~M_2020'n MOCHG1A
Q2-5B1.01~Y_2020'n YRCHG1A
Q2-5B2.01~M_2020'n MOCHG1B
Q2-5B2.01~Y_2020'n YRCHG1B
Q2-5B2.02~M_2020'n MOCHG2B
Q2-5B2.02~Y_2020'n YRCHG2B
Q2-5B2.03~M_2020'n MOCHG3B
Q2-5B2.03~Y_2020'n YRCHG3B
Q2-5B3.01~M_2020'n MOCHG1C
Q2-5B3.01~Y_2020'n YRCHG1C
Q2-5B3.02~M_2020'n MOCHG2C
Q2-5B3.02~Y_2020'n YRCHG2C
Q2-5B3.03~M_2020'n MOCHG3C
Q2-5B3.03~Y_2020'n YRCHG3C
Q2-5C1.01_2020'n ANYCHGAFT1
Q2-5C1.02_2020'n ANYCHGAFT2
Q2-5C1.03_2020'n ANYCHGAFT3
Q2-5C1BB.01_2020'n MSAFTC1
Q2-5C1BB.02_2020'n MSAFTC2
Q2-5C1BB.03_2020'n MSAFTC3
Q2-5E_2020'n Q2_5E
Q2-5F_2020'n Q2_5F
SYMBOL_MARCODE_2020'n MARCODE
SYMBOL_OLDMARCODE_2020'n OLDMARCODE
SYMBOL_MARCODEDLI_2020'n MARCODEDLI
intv2020=1;
if CURDATEY=-5 then intv2020=0;
/* 1st marital status change code */
marst_chng1_type = -4;
if (CHGL1_SDW > -4) then marst_chng1_type = CHGL1_SDW;
else if (CHGL1_DRW > -4) then marst_chng1_type = CHGL1_DRW;
else if (MOCHG1A > -4) then marst_chng1_type = 1;
else if (MOCHG1B > -4) then marst_chng1_type = 5;
else if (CHGL1_SDW = -4 & MOCHG1A = -4 & MOCHG1B = -4)
then marst_chng1_type = -4;
else marst_chng1_type = -3;
/* 1st marital status change date */
if (MOCHG1A > -4) then do;
marst_chng1_date_m = MOCHG1A;
marst_chng1_date_y = YRCHG1A;
end;
else if (MOCHG1B > -4) then do;
marst_chng1_date_m = MOCHG1B;
marst_chng1_date_y = YRCHG1B;
end;
else if (MOCHG1C > -4) then do;
marst_chng1_date_m = MOCHG1C;
marst_chng1_date_y = YRCHG1C;
end;
else if (MOCHG1A = -4 & MOCHG1B = -4 & MOCHG1C = -4) then do;
marst_chng1_date_m = -4;
marst_chng1_date_y = -4;
end;
/* 2nd-3rd marital status change code */
CHGL3_SDW=-4; MOCHG2A=-4; MOCHG3A=-4; YRCHG2A=-4; YRCHG3A=-4;
array mschgcd (n) marst_chng2_type marst_chng3_type;
array q2_5a1 (n) CHGL2_SDW CHGL3_SDW;
array q2_5a1a (n) CHGL2_DRW CHGL3_DRW;
array q2_5b1m (n) MOCHG2A MOCHG3A;
array q2_5b2m (n) MOCHG2B MOCHG3B;
do n=1 to 2;
if (q2_5a1 > -4) then mschgcd = q2_5a1;
else if (q2_5a1a > -4) then mschgcd = q2_5a1a;
else if (q2_5b1m > -4) then mschgcd = 5;
else if (q2_5b2m > -4) then mschgcd = 5;
else if (q2_5a1 = -4 & q2_5b1m = -4) then mschgcd = -4;
else mschgcd = -3;
end;
/* 2nd-3rd marital status change date */
array mschmo (n) marst_chng2_date_m marst_chng3_date_m;
array mschyr (n) marst_chng2_date_y marst_chng3_date_y;
*array q2_5b1m (n) MOCHG2A MOCHG3A;
array q2_5b1y (n) YRCHG2A YRCHG3A;
*array q2_5b2m (n) MOCHG2B MOCHG3B;
array q2_5b2y (n) YRCHG2B YRCHG3B;
array q2_5b3m (n) MOCHG2C MOCHG3C;
array q2_5b3y (n) YRCHG2C YRCHG3C;
do n=1 to 2;
if (q2_5b1m > -4) then do;
mschmo = q2_5b1m;
mschyr = q2_5b1y;
end;
else if (q2_5b2m > -4) then do;
mschmo = q2_5b2m;
mschyr = q2_5b2y;
end;
else if (q2_5b3m > -4) then do;
mschmo = q2_5b3m;
mschyr = q2_5b3y;
end;
else if (q2_5b1m = -4 & q2_5b2m = -4 & q2_5b3m = -4) then do;
mschmo = -4;
mschyr = -4;
end;
end;
array finvars marst_chng1_type marst_chng1_date_m marst_chng1_date_y
marst_chng2_type marst_chng2_date_m marst_chng2_date_y
marst_chng3_type marst_chng3_date_m marst_chng3_date_y;
do i=1 to dim(finvars);
if intv2020=0 then finvars[i]=-5;
end;
MARRCHG120=marst_chng1_type;
MARRCHG1MO=marst_chng1_date_m;
MARRCHG1YR=marst_chng1_date_y;
MARRCHG220=marst_chng2_type;
MARRCHG2MO=marst_chng2_date_m;
MARRCHG2YR=marst_chng2_date_y;
MARRCHG320=marst_chng3_type;
MARRCHG3MO=marst_chng3_date_m;
MARRCHG3YR=marst_chng3_date_y;
2020 Key Marital Status and Marital Status Collapsed Variable Creation
Q2-4AC_2020'n CURMARNC
Q2-5C1BB.01_2020'n MARCHNG1
Q2-5C1BB.02_2020'n MARCHNG2
Q2-5C1BB.03_2020'n MARCHNG3
RELSPPTR20 SPPTRTYPE
/***************************************/
/*Construction for key marital status variables */
/***************************************/
array changes MARCHNG1 MARCHNG2 MARCHNG3;
finchange=.;
do i=1 to 3;
if changes[i]>=-2 then finchange=changes[i];
end;
newmarstat=CURMARNC;
if CURMARNC=-4 then newmarstat=finchange;
MARSTAT_KEY=newmarstat;
if newmarstat in (4 5) then MARSTAT_KEY=1;
MARSTAT_COL=3;
if MARSTAT_KEY=0 then MARSTAT_COL=1;
else if MARSTAT_KEY=1 and spptrtype=1 then MARSTAT_COL=2;
else if MARSTAT_KEY=-5 then MARSTAT_COL=-5;
2020 Past Calendar Year Variable Creation
past_calendar_year = curdate~y;
if (symbol_pcy_year = '2019') then past_calendar_year = 2019;
else if (symbol_pcy_year = '2020') then past_calendar_year = 2020;
2020 Family Size Variable Creation
array varsall (m) CURDATE_D CURDATE_M CURDATE_Y HHI_RELCODE_01
HHI_RELCODE_02 HHI_RELCODE_03 HHI_RELCODE_04
HHI_RELCODE_05 HHI_RELCODE_06 HHI_RELCODE_07
HHI_RELCODE_08 HHI_RELCODE_09 HHI_RELCODE_10
HHI_RELCODE_11;
do over varsall; /* any missing data? if so set to -4 */
if missing(varsall) then varsall=-4;
end;
* ================;
* Compute family sizes ;
* ================;
data compute_a;set famszin;
/* --- Compute "family size '20" and "spouse '20" --- */
spou20=0;
famsize=1;
nonfamsize=0;
if (hhi_relcode_01 = -5) then famsize = -5;
array relation (i) hhi_relcode_01 - hhi_relcode_11;
/* Go thru all the relations and
(1) if there is a relation (blood or by law), increase the family size, do not count foster relations
(2) check whether one of them is a spouse */
do i = 1 to 11;
if (spou20 = 0 & relation = 1 ) then spou20=1;
if ((relation <= 0) | (33 <= relation <= 36) | relation = 45 | relation = 46
| (50 <= relation <= 54) | (relation > 66))
then famsize = famsize;
else famsize = famsize + 1;
end;
do i = 1 to 11;
if ((33 <= relation <= 36) | relation = 45 | relation = 46
| (50 <= relation <= 54) | (relation > 66)) then nonfamsize = (nonfamsize +1);
end;
2020 Hourly Rate of Pay, Initial Report Non-Hourly Variable Creation
qes_76q_## QES-76Q.##
qes_76s_## QES-76S.##
qes_76t_## QES-76T.##
hrp## HRP##
hrp_whrly# HRP#_WHRLY2
array ophrly (i) qes_76q_01-qes_76q_13;
array ohrpot (i) qes_76s_01-qes_76s_13;
array ohrp (i) qes_76t_01-qes_76t_13;
array hrp (i) hrp1-hrp13;
array hrp_rec (i) hrp_rec1-hrp_rec13;
array hrp_w (i) hrp_whrly1-hrp_whrly13;
*received HRP;
do i=1 to 13;
if ophrly=1 then do;
if ohrpot>-4 then hrp_rec=ohrpot;*overtime pay;
else if ohrp>-4 then hrp_rec=ohrp;*other time unit reported;
end;
hrp_w=-4;
if hrp_rec>0 then hrp_w=hrp_rec;
else if (hrp_rec=0|hrp_rec=-1| hrp_rec=-2|hrp_rec=-3) and hrp<0 then hrp_w=hrp_rec;
else if (hrp_rec=0|hrp_rec=-1| hrp_rec=-2|hrp_rec=-3) and hrp>0 then hrp_w=hrp;
else hrp_w=hrp;
end;
run;
HRP1_WHRLY2=hrp_whrly1;
HRP2_WHRLY2=hrp_whrly2;
HRP3_WHRLY2=hrp_whrly3;
HRP4_WHRLY2=hrp_whrly4;
HRP5_WHRLY2=hrp_whrly5;
Business Ownership XRND Variable Creation (2020 updates)
Variable Names in Program (## = 01/02) Variable Names in Data Release (## = 01/02)
busown_4_##_20/xr BUSOWN-4.##
busown_8_##_20/xr BUSOWN-8. ##
busown_13_##_20/xr BUSOWN-13_##
BUSOWN_LINT_20 BUSOWN-LINT
BUSOWN_1_20/xr BUSOWN-1
BUSOWN_2_20/xr BUSOWN-2
BUSOWN_5_##_Y_20/xr BUSOWN-5. ##~Y
BUSOWN_6_##_M_20/xr BUSOWN-6. ##~M
BUSOWN_6_##_Y_20/xr BUSOWN-6. ##~Y
BUSOWN_7_##_20/xr BUSOWN-7. ##
BUSOWN_9_##_20/xr BUSOWN-9. ##
BUSOWN_10_##_0_20/xr BUSOWN-10. ##_000000
BUSOWN_10_##_1_20/xr BUSOWN-10. ##_000001
BUSOWN_10_##_2_20/xr BUSOWN-10. ##_000002
BUSOWN_10_##_3_20/xr BUSOWN-10. ##_000003
BUSOWN_10_##_4_20/xr BUSOWN-10. ##_000004
BUSOWN_10_##_5_20/xr BUSOWN-10. ##_000005
BUSOWN_10_##_6_20/xr BUSOWN-10. ##_000006
BUSOWN_10_##_7_20/xr BUSOWN-10. ##_000007
BUSOWN_11_##_20/xr BUSOWN-11. ##
BUSOWN_11_UNF1_##_20/xr BUSOWN-11_UNF1. ##
BUSOWN_11_UNF5_##_20/xr BUSOWN-11_UNF5. ##
BUSOWN_11_UNF6_##_20/xr BUSOWN-11_UNF6. ##
BUSOWN_11_UNF7_##_20/xr BUSOWN-11_UNF7. ##
BUSOWN_12_##_20/xr BUSOWN-12. ##
BUSOWN_14_##_20/xr BUSOWN-14. ##
BUSOWN_15_##_20/xr BUSOWN-15. ##
BUSOWN_16_##_20/xr BUSOWN-16. ##
BUSOWN_16_TRUNC_##_20/xr BUSOWN-16_TRUNC. ##
BUSOWN_17_##_20/xr BUSOWN-17. ##
BUSOWN_18_##_Y_20/xr BUSOWN-18. ##~Y
BUSOWN_19_##_20/xr BUSOWN-19. ##
BUSOWN_20_##_20/xr BUSOWN-20. ##
BUSOWN_21_##_20/xr BUSOWN-21. ##
BUSOWN_22_##_20/xr BUSOWN-22. ##
BUSOWN_23A_20/xr BUSOWN-23A
BUSOWN_23B_20/xr BUSOWN-23B
BUSOWN_24A_20/xr BUSOWN-24A
BUSOWN_24B_20/xr BUSOWN-24B
BUSOWN_25_20/xr BUSOWN-25
BUSOWN_27_20/xr BUSOWN-27
BUSOWN_28A_20/xr BUSOWN-28A
BUSOWN_28B_20/xr BUSOWN-28B
BUSOWN_29_20/xr BUSOWN-29
data busownmatch_all; merge busown.busown20 busown.busownmatch20; by norcid;
pastjobuid20_1_1 = opastjobuid_1_1;
pastjobuid20_2_1 = opastjobuid_2_1;
quality20_1 = oquality_1;
quality20_2 = oquality_2;
drop o:;
data busown_xrnd20; set busownmatch_all;
length busown_4_01_xr busown_4_02_xr $60.
busown_8_01_xr busown_8_02_xr $100.
busown_13_01_xr busown_13_02_xr $60.;
if busown_1_20>-4 then do;*Have ever owned a business;
busown_1_xr=busown_1_20;
busown_sourceyr=2020;
end;
if busown_2_20>-4 then busown_2_xr=busown_2_20;*how many business;
array bus4_20 (i) $ busown_4_01_20 busown_4_02_20;
array bus4_xr (i) $ busown_4_01_xr busown_4_02_xr;
array bus5_20 (i) busown_5_01_y_20 busown_5_02_y_20;
array bus5_xr (i) busown_5_01_y_xr busown_5_02_y_xr;
array bus6m_20 (i) busown_6_01_m_20 busown_6_02_m_20;
array bus6m_xr (i) busown_6_01_m_xr busown_6_02_m_xr;
array bus6y_20 (i) busown_6_01_y_20 busown_6_02_y_20;
array bus6y_xr (i) busown_6_01_y_xr busown_6_02_y_xr;
array bus7_20 (i) busown_7_01_20 busown_7_02_20;
array bus7_xr (i) busown_7_01_xr busown_7_02_xr;
array bus8_20 (i) $ busown_8_01_20 busown_8_02_20;
array bus8_xr (i) $ busown_8_01_xr busown_8_02_xr;
array bus9_20 (i) busown_9_01_20 busown_9_02_20;
array bus9_xr (i) busown_9_01_xr busown_9_02_xr;
array bus100_20 (i) busown_10_01_0_20 busown_10_02_0_20;
array bus100_xr (i) busown_10_01_0_xr busown_10_02_0_xr;
array bus101_20 (i) busown_10_01_1_20 busown_10_02_1_20;
array bus101_xr (i) busown_10_01_1_xr busown_10_02_1_xr;
array bus102_20 (i) busown_10_01_2_20 busown_10_02_2_20;
array bus102_xr (i) busown_10_01_2_xr busown_10_02_2_xr;
array bus103_20 (i) busown_10_01_3_20 busown_10_02_3_20;
array bus103_xr (i) busown_10_01_3_xr busown_10_02_3_xr;
array bus104_20 (i) busown_10_01_4_20 busown_10_02_4_20;
array bus104_xr (i) busown_10_01_4_xr busown_10_02_4_xr;
array bus105_20 (i) busown_10_01_5_20 busown_10_02_5_20;
array bus105_xr (i) busown_10_01_5_xr busown_10_02_5_xr;
array bus106_20 (i) busown_10_01_6_20 busown_10_02_6_20;
array bus106_xr (i) busown_10_01_6_xr busown_10_02_6_xr;
array bus107_20 (i) busown_10_01_7_20 busown_10_02_7_20;
array bus107_xr (i) busown_10_01_7_xr busown_10_02_7_xr;
array bus11_20 (i) busown_11_01_20 busown_11_02_20;
array bus11_xr (i) busown_11_01_xr busown_11_02_xr;
array bus11u1_20 (i) busown_11_unf1_01_20 busown_11_unf1_02_20;
array bus11u1_xr (i) busown_11_unf1_01_xr busown_11_unf1_02_xr;
array bus11u5_20 (i) busown_11_unf5_01_20 busown_11_unf5_02_20;
array bus11u5_xr (i) busown_11_unf5_01_xr busown_11_unf5_02_xr;
array bus11u6_20 (i) busown_11_unf6_01_20 busown_11_unf6_02_20;
array bus11u6_xr (i) busown_11_unf6_01_xr busown_11_unf6_02_xr;
array bus11u7_20 (i) busown_11_unf7_01_20 busown_11_unf7_02_20;
array bus11u7_xr (i) busown_11_unf7_01_xr busown_11_unf7_02_xr;
array bus12_20 (i) busown_12_01_20 busown_12_02_20;
array bus12_xr (i) busown_12_01_xr busown_12_02_xr;
array bus13_20 (i) $ busown_13_01_20 busown_13_02_20;
array bus13_xr (i) $ busown_13_01_xr busown_13_02_xr;
array bus14_20 (i) busown_14_01_20 busown_14_02_20;
array bus14_xr (i) busown_14_01_xr busown_14_02_xr;
array bus15_20 (i) busown_15_01_20 busown_15_02_20;
array bus15_xr (i) busown_15_01_xr busown_15_02_xr;
array bus16_20 (i) busown_16_01_20 busown_16_02_20;
array bus16_xr (i) busown_16_01_xr busown_16_02_xr;
array bus17_20 (i) busown_17_01_20 busown_17_02_20;
array bus17_xr (i) busown_17_01_xr busown_17_02_xr;
array bus18_20 (i) busown_18_01_y_20 busown_18_02_y_20;
array bus18_xr (i) busown_18_01_y_xr busown_18_02_y_xr;
array bus19_20 (i) busown_19_01_20 busown_19_02_20;
array bus19_xr (i) busown_19_01_xr busown_19_02_xr;
array bus20_20 (i) busown_20_01_20 busown_20_02_20;
array bus20_xr (i) busown_20_01_xr busown_20_02_xr;
array bus21_20 (i) busown_21_01_20 busown_21_02_20;
array bus21_xr (i) busown_21_01_xr busown_21_02_xr;
array bus22_20 (i) busown_22_01_20 busown_22_02_20;
array bus22_xr (i) busown_22_01_xr busown_22_02_xr;
do i=1 to 2;
if bus4_20~=' ' then bus4_xr=bus4_20;
if bus5_20>-4 then bus5_xr=bus5_20;
if bus6m_20>-4 then bus6m_xr=bus6m_20;
if bus6y_20>-4 then bus6y_xr=bus6y_20;
if bus7_20>-4 then bus7_xr=bus7_20;
if bus8_20~=' ' then bus8_xr=bus8_20;
if bus9_20>-4 then bus9_xr=bus9_20;
if bus101_20>-4 then bus101_xr=bus101_20;
if bus102_20>-4 then bus102_xr=bus102_20;
if bus103_20>-4 then bus103_xr=bus103_20;
if bus104_20>-4 then bus104_xr=bus104_20;
if bus105_20>-4 then bus105_xr=bus105_20;
if bus106_20>-4 then bus106_xr=bus106_20;
if bus107_20>-4 then bus107_xr=bus107_20;
if bus100_20>-4 then bus100_xr=bus107_20;
if bus11_20>-4 then bus11_xr=bus11_20;
if bus11u1_20>-4 then bus11u1_xr=bus11u1_20;
if bus11u5_20>-4 then bus11u5_xr=bus11u5_20;
if bus11u6_20>-4 then bus11u6_xr=bus11u6_20;
if bus11u7_20>-4 then bus11u7_xr=bus11u7_20;
if bus12_20>-4 then bus12_xr=bus12_20;
if bus13_20~=' ' then bus13_xr=bus13_20;
if bus14_20>-4 then bus14_xr=bus14_20;
if bus15_20>-4 then bus15_xr=bus15_20;
if bus16_20>-4 then bus16_xr=bus16_20;
if bus17_20>-4 then bus17_xr=bus17_20;
if bus18_20>-4 then bus18_xr=bus18_20;
if bus19_20>-4 then bus19_xr=bus19_20;
if bus20_20>-4 then bus20_xr=bus20_20;
if bus21_20>-4 then bus21_xr=bus21_20;
if bus22_20>-4 then bus22_xr=bus22_20;
end;
if busown_23a_20>-4 then busown_23a_xr=busown_23a_20;
if busown_23b_20>-4 then busown_23b_xr=busown_23b_20;
if busown_24a_20>-4 then busown_24a_xr=busown_24a_20;
if busown_24b_20>-4 then busown_24b_xr=busown_24b_20;
if busown_25_20>-4 then busown_25_xr=busown_25_20;
*if busown_27_20>-4 then busown_27_xr=busown_27_20;
*if busown_28a_20>-4 then busown_28a_xr=busown_28a_20;
*if busown_28b_20>-4 then busown_28b_xr=busown_28b_20;
if busown_29_20>-4 then busown_29_xr=busown_29_20;
array pastuid20 (2) pastjobuid20_1_1 pastjobuid20_2_1;
array qual20 (2) quality20_1-quality20_2;
array pastuid (2) pastjobuid_1_1 pastjobuid_2_1;
array qual (2) quality_1-quality_2;
array yr (2) matchyear_1-matchyear_2;
do i=1 to 2;
if qual20(i)~=. then do;
qual(i)=qual20(i);
pastuid(i)=pastuid20(i);
yr(i)=2020;
end;
end;
data busown_xrnd20b; set busown_xrnd20;
busown_11_01_trunc_xr = busown_11_01_xr;
busown_11_02_trunc_xr = busown_11_02_xr;
busown_16_01_trunc_xr = busown_16_01_xr;
busown_16_02_trunc_xr = busown_16_02_xr;