Variables Created: CV_HH_SIZE
CV_HH_UNDER_6
CV_HH_UNDER_18
Variables Used
|
Name in Program |
Question Name on CD |
|
hage01-hage16 |
HHI_AGE.01-.16 |
| hagest01-hagest08 | HHI_AGEEST.01-.08 |
|
huid01-huid16 |
HHI_UID.01-.16 |
|
id |
PUBID |
|
rsage |
SYMBOL!KEY!AGE |
This program creates several variables describing the composition of the respondent's household: the total number of residents, the number of residents under age 6, and the number of residents under age 18.
array HAGE HAGE01-HAGE16;
array HUID HUID01-HUID16;
array HAGEST HAGEST01-HAGEST16;
/* Create dummy variables HHDUM[I] (I=1 to 16) that equal one if the ith member has a member ID, and zero if the ith member does not have a member ID (i.e.HHID0i=-4).Also create dummies for the age:DUM6[I] (I=1 to 16) that equal 1 if the ith household member is under age 6 and DUM18[I] (I=1 to 16) that equal 1 if the ith household member is under age 18.*/
array HHDUM HHDUM01-HHDUM16;
array DUM6 DUM601-DUM616;
array DUM18 DUM1801-DUM1816;
do I=1 to 16;
HHDUM[I]=0;
DUM6[I]=0;
DUM18[I]=0;
end;
do I=1 to 16;
if HUID[I]>-1 then HHDUM[I]=1;
if -1<HAGE[I]<6 then DUM6[I]=1;
if -1<HAGE[I]<18 then DUM18[I]=1;
if -4<HAGE[I]<0 and HAGEST[I]=1 then do; DUM18[I]=1; UND6=-3; end;
if -4<HAGE[I]<0 and HAGEST[I]=2 then DUM18[I]=1;
end;
/* Create the dummy for the respondent's age RDUM6 and RDUM18. */
RDUM6=0;
RDUM18=0;
if -1<RSAGE<6 then RDUM6=1;
if -1<RSAGE<18 then RDUM18=1;
/* Create household size HHSIZE by adding up the dummies HHDUM[I] and also add one due to the respondent himself. Similarly, create variabes UNDER6 and UNDER18 by adding up the other two dummies.*/
HHSIZE=1;
UNDER6=RDUM6;
UNDER18=RDUM18;
do I=1 to 16;
HHSIZE=HHSIZE+HHDUM[I];
UNDER6=UNDER6+DUM6[I];
UNDER18=UNDER18+DUM18[I];
end;
if HUID01=-5 then HHSIZE=-5;
if -4<HUID01<0 or -4<HUID02<0 or -4<HUID03<0 or -4<HUID04<0 or -4<HUID05<0 or -4<HUID06<0 or -4<HUID07<0 or -4<HUID08<0 or -4<HUID09<0 or -4<HUID10<0 or -4<HUID11<0 or -4<HUID12<0 or -4<HUID13<0 or -4<HUID14<0 or -4<HUID15<0 or -4<HUID16<0 then HHSIZE=-3;
if HUID01=-5 then UNDER6=-5;
if HUID01=-5 then UNDER18=-5;
if -4<HAGE01<0 or -4<HAGE02<0 or -4<HAGE03<0 or -4<HAGE04<0 or -4<HAGE05<0 or -4<HAGE06<0 or -4<HAGE07<0 or -4<HAGE08<0 or -4<HAGE09<0 or -4<HAGE10<0 or -4<HAGE11<0 or -4<HAGE12<0 or -4<HAGE13<0 or -4<HAGE14<0 or -4<HAGE15<0 or -4<HAGE16<0 or -4<RSAGE<0 then PRT1=-3;
if (-4<HAGEST01<0 or -4<HAGEST02<0 or -4<HAGEST03<0 or -4<HAGEST04<0 or -4<HAGEST05<0 or -4<HAGEST06<0 or -4<HAGEST07<0 or -4<HAGEST08<0 or -4<HAGEST09<0 or -4<HAGEST10<0 or -4<HAGEST11<0 or -4<HAGEST12<0 or -4<HAGEST13<0 or -4<HAGEST14<0 or -4<HAGEST15<0 or -4<HAGEST16<0) and PRT1=-3 then PRT2=-3;
if PRT2=-3 or HHSIZE=-3 then do; UNDER6=-3; UNDER18=-3; end;
if UND6=-3 then do; UNDER6=-3; end;
endsas;
Variables Created: CV_YTH_REL_HH_CURRENT
Variables Used
|
Name in Program |
Question Name on CD |
Name in Program |
Question Name on CD |
|
Prior Rounds: |
|
Round 5: |
|
|
pubid |
PUBID |
hhage01-16 |
HHI_AGE.01-.16 |
|
yid |
YOUTH_ID.01 |
hagest01-hagest08 | HHI_AGEEST.01-.08 |
|
sh931-sh935 |
SH-93.01-.05 |
hh2uid01-16 |
HHI_UID.01-.16 |
|
hh1uid01-hh1uid17 |
HHI2_UID.01-.17 |
marry_1-16 |
HHI_MARSTAT.01-.16 |
|
CV97-CV00 |
CV.YTH.REL.HH.CURRENT.1997-.2000 |
rel_1-16 |
HHI_RELY.01-.16 |
|
age |
SYMBOL!KEY!AGE |
Codes for Created Variable
|
-5 = Non-Interview |
5 = Biological father only |
This program creates a variable identifying the youth's relationship to the primary adults in the household. In rounds 2-5 there was no information collected on the legal guardian of the youth, so it is not possible to determine whether respondents are living with non-parent relatives because they are guardians or because the living situation is better (e.g., closer to school, no rent). For this reason, youths above the age 18 and above are considered independent and, if they are not living with an identified parent or parent-figure (legal guardian), are put into the anything else category. Youths below the age of 18 who are not living with an identified parent or parent-figure are put into the category that most closely matches their household situation.
*set hhage to 25 when actual age of hh members is unknown, but estimated to be over 25 (est. age var=4, 5, 6);
if ageest01>3 then hhage01=25;
if ageest02>3 then hhage02=25;
if ageest03>3 then hhage03=25;
if ageest04>3 then hhage04=25;
if ageest05>3 then hhage05=25;
if ageest06>3 then hhage06=25;
if ageest07>3 then hhage07=25;
if ageest08>3 then hhage08=25;
*set hhage to 17 when actual age of hh members is unknown, but estimated to be under 18 (est. age var=1, 2);
if ageest01=1 or ageest01=2 then hhage01=17;
if ageest02=1 or ageest02=2 then hhage02=17;
if ageest03=1 or ageest03=2 then hhage03=17;
if ageest04=1 or ageest04=2 then hhage04=17;
if ageest05=1 or ageest05=2 then hhage05=17;
if ageest06=1 or ageest06=2 then hhage06=17;
if ageest07=1 or ageest07=2 then hhage07=17;
if ageest08=1 or ageest08=2 then hhage08=17;
array rel_a (i) rel_1-rel_16;
array marry_a (i) marry_1-marry_16;
array age_a (i) hhage01-hhage16;
*this part determines legal guardians so that we can determine whether any guardians are present from the R1 interview use only unique IDs (cases with 6 digits are hh members after R1 only, so this program won't do anything with them, as we don't have info on legal guardian status for these HH members ;
array hh1uid (i) hh1uid01-hh1uid16; *round 1 variable;
array hh2uid (i) hh2uid01-hh2uid16; *round 5 variable;
do i=1 to 16;
if yid=1 and sh931>0 and sh931+100=hh1uid then do; uid=hh1uid; end;
if yid=2 and sh932>0 and sh932+100=hh1uid then do; uid=hh1uid; end;
if yid=3 and sh933>0 and sh933+100=hh1uid then do; uid=hh1uid; end;
if yid=4 and sh934>0 and sh934+100=hh1uid then do; uid=hh1uid; end;
if yid=5 and sh935>0 and sh935+100=hh1uid then do; uid=hh1uid; end;
end;
do i=1 to 16; if (uid ne . and uid=hh2uid) then line=i; end;
legal=0;
do i=1 to 16; if line=i then legal=rel_a; end;
momid=0; domid=0; adopdad=0; admom=0; fostma=0; fostda=0; stepma=0; stepda=0; husb=0; wife=0; grand=0; relat=0; nonrel=0; indep=0; spouse=0;
**legal;
do i=1 to 16;
if (legal>28 and legal<37) then do; grand=1; end;
*spouse;
if legal=1 or legal=2 then do; spouse=1; end;
*brother/sister;
if (legal>12 and legal<19) and age_a>20 then do; relat=1; end;
*aunt or uncle and other relatives; if (legal>69 and legal<85) and age_a>20 then do; relat=1; end;
*lover, roommate, other non-relative, mom's or dad's partner;
if legal=69 or legal=68 or legal=85 or legal=88 or legal=89 then do; nonrel=1; end;
if legal=-1 or legal=-2 or legal=-3 then do; invalid=1; end;
if rel_1=-4 and rel_2=-4 and rel_3=-4 and rel_4=-4 and rel_5=-4 and rel_6=-4 and rel_7=-4 and rel_8=-4 and rel_9=-4 and rel_10=-4 and rel_11=-4 and rel_12=-4 and rel_13=-4 and rel_14=-4 then do;
indep=1;
end;
end;
**not legal;
do i=1 to 16;
if (rel_a>28 and rel_a<37) then do; nlgrand=1; end;
*spouse;
if rel_a=1 or rel_a=2 then do; nlspouse=1; end;
*brother/sister;
if (rel_a>12 and rel_a<19) and age_a>20 then do; nlrelat=1; end;
*aunt or uncle and other relatives;
if (rel_a>69 and rel_a<85) and age_a>20 then do; nlrelat=1; end;
*lover, roommate, other non-relative, mom's or dad's partner;
if rel_a=69 or rel_a=68 or rel_a=85 or rel_a=88 or rel_a=89 then do; nlnnrl=1; end;
if rel_a=-1 or rel_a=-2 or rel_a=-3 then do; nlinv=1; end;
end;
/*problem is a variable to check whether R did not report a relationship code for one or more household members*/
problem=0;
do i=1 to 16; if rel_a=-1 or rel_a=-2 or rel_a=-3 then problem=1; end;
if age<18 then do;
if nlgrand ne . and legal=0 then grand=nlgrand;
if nlspouse ne . and legal=0 then spouse=nlspouse;
if nlrelat ne . and legal=0 then relat=nlrelat;
if nlnnrl ne . and legal=0 then nonrel=nlnnrl;
if nlinv ne . and legal=0 then invalid=nlinv;
end;
*for all youths;
if nlspouse ne . then spouse=nlspouse;
do i=1 to 16;
if rel_a=3 then momid=i;
if rel_a=4 then domid=i;
if rel_a=5 then admom=i;
if rel_a=6 then adopdad=i;
if rel_a=7 then stepma=i;
if rel_a=8 then stepda=i;
if rel_a=9 then fostma=i;
if rel_a=10 then fostda=i;
end;
*used to determine whether single parent households contain another parent. If so hand edits are done below;
rel=-16;
if age>17 then do; rel=10; end;
if marry_1=-5 then do; rel=-5; end;
if indep=1 then do; rel=10; end;
if invalid=1 then do; rel=-3; end;
if nonrel>0 then do; rel=10; end;
if relat>0 then do; rel=9; end;
if grand>0 and momid=0 and domid=0 then do; rel=8; end;
if spouse=1 then do; rel=10; end;
if fostda>0 or fostma>0 then do; rel=7; end;
if admom>0 or adopdad>0 then do; rel=6; end;
if stepda>0 or stepma>0 then do; rel=10; end;
if domid>0 and momid=0 then do; rel=5; end;
if momid>0 and domid=0 then do; rel=4; end;
if domid>0 and momid=0 then do; if admom>0 or stepma>0 then rel=3; end;
if momid>0 and domid=0 then do; if adopdad>0 or stepda>0 then rel=2; end;
if momid>0 and domid>0 then do; both=1; rel=1; end;
if rel=-16 then rel=10;
endsas;
Variables Created:
| CV_MARSTAT CV_MARSTAT_COLLAPSED CV_FIRST_MARRY_DATE_M CV_FIRST_MARRY_DATE_Y CV_FIRST_MARRY_MONTH |
CV_FIRST_COHAB_DATE_M CV_FIRST_COHAB_DATE_Y CV_FIRST_COHAB_MONTH CV_MARRIAGES_TTL CV_COHAB_TTL |
Variables Used
|
Name in Program |
Question Name on CD |
Name in Program |
Question Name on CD |
| m700r1 | YMAR.700.1997 | M620 | YMAR.620.2001 |
| m45001r1 | YMAR.4500.01.1997 | M650 | YMAR.650.2001 |
| m45002r1 | YMAR.4500.02.1997 | M700 | YMAR.700.2001 |
| m540011r1 | YMAR.5400.01.01.1997 | M710 | YMAR.710.2001 |
| m540012r1 | YMAR.5400.01.02.1997 | M712 | YMAR.712.2001 |
| FCOH.Mr1 | CV.FIRST.COHAB.DATE.M.1997 | M714 | YMAR.714.2001 |
| FCOH.Yr1 | CV.FIRST.COHAB.DATE.Y.1997 | M718 | YMAR.718.2001 |
| FCOHCMr1 | CV.FIRST.COHAB.MONTH.1997 | M729D | YMAR.729D.2001 |
| FMAR.Mr1 | CV.FIRST.MARRY.DATE.M.1997 | M730 | YMAR.730.2001 |
| FMAR.Yr1 | CV.FIRST.MARRY.DATE.Y.1997 | M760 | YMAR.760.2001 |
| FMARMr1 | CV.FIRST.MARRY.MONTH.1997 | M31001M | YMAR.3100.01.M.2001 |
| INT.Dr1 | CV.INTERVIEW.DATE.D.1997 | M31001Y | YMAR.3100.01.Y.2001 |
| INT.Mr1 | CV.INTERVIEW.DATE.M.1997 | M31002M | YMAR.3100.02.M.2001 |
| INT.Yr1 | CV.INTERVIEW.DATE.Y.1997 | M31002Y | YMAR.3100.02.Y.2001 |
| MARSTAT1 | CV.MARSTAT.1997 | M31003M | YMAR.3100.03.M.2001 |
| CMARSTA1 | CV.MARSTAT.COLLAPSED.1997 | M31003Y | YMAR.3100.03.Y.2001 |
| COH.TTL1 | CV.MARRIAGES.TTL.1997 | M31004M | YMAR.3100.04.M.2001 |
| MAR.TTL1 | CV.MARRIAGES.TTL.1997 | M31004Y | YMAR.3100.04.Y.2001 |
| M45001 | YMAR.4500.01.2001 | ||
| m700r2 | YMAR.700.1998 | M45002 | YMAR.4500.02.2001 |
| M45001r2 | YMAR.4500.01.1998 | M45003 | YMAR.4500.03.2001 |
| M45002r2 | YMAR.4500.02.1998 | M45004 | YMAR.4500.04.2001 |
| M45003r2 | YMAR.4500.03.1998 | M46501 | YMAR.4650.01.2001 |
| M54011r2 | YMAR.5400.01.01.1998 | M46502 | YMAR.4650.02.2001 |
| M54012r2 | YMAR.5400.01.02.1998 | M46503 | YMAR.4650.03.2001 |
| FCOH.Mr2 | CV.FIRST.COHAB.DATE.M.1998 | M46504 | YMAR.4650.04.2001 |
| FCOH.Yr2 | CV.FIRST.COHAB.DATE.Y.1998 | M47001 | YMAR.4700.01.2001 |
| FCOHCMr2 | CV.FIRST.COHAB.MONTH.1998 | M47002 | YMAR.4700.02.2001 |
| FMAR.Mr2 | CV.FIRST.MARRY.DATE.M.1998 | M47003 | YMAR.4700.03.2001 |
| FMAR.Yr2 | CV.FIRST.MARRY.DATE.Y.1998 | M47004 | YMAR.4700.04.2001 |
| FMARMr2 | CV.FIRST.MARRY.MONTH.1998 | M48001M | YMAR.4800.01.M.2001 |
| INT.Dr2 | CV.INTERVIEW.DATE.D.1998 | M48001Y | YMAR.4800.01.Y.2001 |
| INT.Mr2 | CV.INTERVIEW.DATE.M.1998 | M48002M | YMAR.4800.02.M.2001 |
| INT.Yr2 | CV.INTERVIEW.DATE.Y.1998 | M48002Y | YMAR.4800.02.Y.2001 |
| MARSTAT2 | CV.MARSTAT.1998 | M48003M | YMAR.4800.03.M.2001 |
| CMARSTA2 | CV.MARSTAT.COLLAPSED.1998 | M48003Y | YMAR.4800.03.Y.2001 |
| COH.TTL2 | CV.COHAB.TTL.1998 | M48003M | YMAR.4800.04.M.2001 |
| MAR.TTL2 | CV.MARRIAGES.TTL.1998 | M48003Y | YMAR.4800.04.Y.2001 |
| M540011 | YMAR.5400.01.01.2001 | ||
| m700r3 | YMAR.700.1999 | M540012 | YMAR.5400.01.02.2001 |
| M45001r3 | YMAR.4500.01.1999 | M560012M | YMAR.5600.01.02.M.2001 |
| M45002r3 | YMAR.4500.02.1999 | M560012Y | YMAR.5600.01.02.Y.2001 |
| m54011r3 | YMAR.5400.01.01.1999 | M570011M | YMAR.5700.01.01.M.2001 |
| M54012r3 | YMAR.5400.01.02.1999 | M570011Y | YMAR.5700.01.01.Y.2001 |
| FCOH.Mr3 | CV.FIRST.COHAB.DATE.M.1999 | M570012M | YMAR.5700.02.01.M.2001 |
| FCOH.Yr3 | CV.FIRST.COHAB.DATE.Y.1999 | M570012Y | YMAR.5700.02.01.Y.2001 |
| FCOHCMr3 | CV.FIRST.COHAB.MONTH.1999 | M700011M | YMAR.7000.01.01.M.2001 |
| FMAR.Mr3 | CV.FIRST.MARRY.DATE.M.1999 | M700011Y | YMAR.7000.01.01.Y.2001 |
| FMAR.Yr3 | CV.FIRST.MARRY.DATE.Y.1999 | M700012M | YMAR.7000.01.02.M.2001 |
| FMARMr3 | CV.FIRST.MARRY.MONTH.1999 | M700012y | YMAR.7000.01.02.Y.2001 |
| INT.Dr3 | CV.INTERVIEW.DATE.D.1999 | M7900111 | YMAR.7900.01.01.01.2001 |
| INT.Mr3 | CV.INTERVIEW.DATE.M.1999 | M7900211 | YMAR.7900.02.01.01.2001 |
| INT.Yr3 | CV.INTERVIEW.DATE.Y.1999 | M810111M | YMAR.8100.01.01.01.M.2001 |
| MARSTAT3 | CV.MARSTAT.1999 | M810111Y | YMAR.8100.01.01.01.Y.2001 |
| CMARSTA3 | CV.MARSTAT.COLLAPSED.1999 | M8200111M | YMAR.8200.01.01.01.M.2001 |
| COH.TTL3 | CV.COHAB.TTL.1999 | M8200111Y | YMAR.8200.01.01.01.Y.2001 |
| MAR.TTL3 | CV.MARRIAGES.TTL.1999 | M8200112M | YMAR.8200.01.01.02.M.2001 |
| M8200112Y | YMAR.8200.01.01.02.Y.2001 | ||
| m700r4 | YMAR.700.2000 | M8200113M | YMAR.8200.01.01.03.M.2001 |
| M45001r4 | YMAR.4500.01.2000 | M8200113Y | YMAR.8200.01.01.03.Y.2001 |
| M45002r4 | YMAR.4500.02.2000 | M8200114M | YMAR.8200.01.01.04.M.2001 |
| M45003r4 | YMAR.4500.03.2000 | M8200114Y | YMAR.8200.01.01.04.Y.2001 |
| M45004r4 | YMAR.4500.04.2000 | M8200211M | YMAR.8200.02.01.01.M.2001 |
| m54011r4 | YMAR.5400.01.01.2000 | M8200211Y | YMAR.8200.02.01.01.Y.2001 |
| M54012r4 | YMAR.5400.01.02.2000 | M910011 | YMAR.9100.01.01.2001 |
| m54021r4 | YMAR.5400.02.01.2000 | M910012 | YMAR.9100.01.02.2001 |
| M54022r4 | YMAR.5400.02.02.2000 | M920011M | YMAR.9200.01.01.M.2001 |
| FCOH.Mr4 | CV.FIRST.COHAB.DATE.M.2000 | M920011Y | YMAR.9200.01.01.Y.2001 |
| FCOH.Yr4 | CV.FIRST.COHAB.DATE.Y.2000 | M920012M | YMAR.9200.01.02.M.2001 |
| FCOHCMr4 | CV.FIRST.COHAB.MONTH.2000 | M920012Y | YMAR.9200.01.02.Y.2001 |
| FMAR.Mr4 | CV.FIRST.MARRY.DATE.M.2000 | m11700011y | YMAR.11700.01.Y.2001 |
| FMAR.Yr4 | CV.FIRST.MARRY.DATE.Y.2000 | m11700011m | YMAR.11700.02.M.2001 |
| FMARMr4 | CV.FIRST.MARRY.MONTH.2000 | M114001 | YMAR.11400.01.2001 |
| INT.Dr4 | CV.INTERVIEW.DATE.D.2000 | M114002 | YMAR.11400.02.2001 |
| INT.Mr4 | CV.INTERVIEW.DATE.M.2000 | M114003 | YMAR.11400.03.2001 |
| INT.Yr4 | CV.INTERVIEW.DATE.Y.2000 | INT.D | CV.INTERVIEW.DATE.D.2001 |
| MARSTAT4 | CV.MARSTAT.2000 | INT.M | CV.INTERVIEW.DATE.M.2001 |
| CMARSTA4 | CV.MARSTAT.COLLAPSED.2000 | INT.Y | CV.INTERVIEW.DATE.Y.2001 |
| COH.TTL4 | CV.COHAB.TTL.2000 | ||
| MAR.TTL4 | CV.MARRIAGES.TTL.2000 |
Codes for Created Variable
|
Marital/Cohabitation Status |
|
|
1
= never married, cohabiting |
6 = separated, not
cohabiting |
|
Collapsed Marital Status |
|
0
= never married |
This program creates two variables that describe marital status/cohabitation status as of the interview date for respondents age 16 and older. Other respondents are valid skips (-4). Note that later partners take precedence over earlier partners.
The program also creates variables that provide the dates of the youth's first marriage and/or cohabitation in both a continuous month scheme and as actual dates (for more information on the continuous month scheme, see appendix 7 in this document). Summary variables count the total number of marriages and cohabitations for each youth. If a respondent is cohabiting and then marries it is considered both a cohabitation and a marriage. If someone refuses or doesn't know the full date of their marriage or cohabitation, then the spell is counted in the total variables and the date variables are coded -1 or -2 as applicable.
if pubid=1200 then do ;
m31001y=-4;
m31001m=-4;
m48001y=-4;
m48001m=-4;
end;
if pubid in
(162, 198, 216, 231, 275, 285, 291, 355, 370, 371, 392, 441, 473, 512, 519, 539, 586, 659, 692, 813,1029, 1152, 1182, 1261, 1276, 1343, 1354, 1356, 1385, 1389, 1392, 1524, 1576, 1584, 1703, 1718, 1730, 1747, 1775, 1785, 1801, 1835, 1987, 2157, 2160, 2223, 2339, 2498, 2577, 2599, 2615, 2668, 2749, 2849, 2961, 2964, 3129, 3170, 3230, 3291, 3308, 3348, 3413, 3427, 3434, 3442, 3483, 3596, 3694, 3752, 3767, 3777, 3803, 3819, 3824, 3828, 3830, 3899, 3905, 3909, 3912, 3952, 3955, 3972, 3982, 4031, 4065, 4111, 4120, 4122, 4183, 4184, 4203, 4211, 4257, 4271, 4272, 4303, 4330, 4335, 4345, 4350, 4353, 4354, 4402, 4495, 4516, 4554, 4650, 4651, 4679, 4685, 4710, 4718, 4777, 4778, 4852, 4882, 4893, 5012, 5042, 5051, 5111, 5146, 5189, 5202, 5276, 5281, 5285, 5296, 5298, 5303, 5359, 5387, 5451, 5466, 5473, 5479, 5564, 5586, 5653, 5658, 5663, 5676, 5687, 5718, 5742, 5789, 5800, 5807, 5832, 5856, 5919, 5921, 6036, 6046, 6132, 6146, 6169, 6201, 6220, 6227, 6266, 6280, 6281, 6305, 6363, 6369, 6523, 6545, 6556, 6586, 6627, 6672, 6713, 6714, 6748, 6752, 6763, 6775, 6791, 6810, 6857, 6977, 7066, 7131, 7134, 7191, 7192, 7211, 7467, 7482, 7486, 7502, 7531, 7641, 7681, 7730, 7817, 7819, 7839, 7947, 7949, 8000, 8202, 8368, 8376, 8378, 8448, 8491, 8494, 8531, 8545, 8562, 8577, 8588, 8598, 8625, 8626, 8627, 8640, 8648, 8668, 8732, 8762, 8763, 8778, 8802, 8818, 8822, 8867, 8891, 8953, 8954, 8965, 8968, 9018)
then flagdc=1;
if flagdc=1 then do;
m31001y=-4;
m31001m=-4;
end;
if flagdc=1 and m47001=1 then do;
m46701=1;
m47001=-4;
end;
if flagdc=1 and m47001=0 then do;
m46701=0;
m47001=-4;
end;
if pubid in (682, 864, 1428, 2018, 2447, 4078)
then m114001=-4; /* need clean up the data*/
if pubid=8310 then m114002=-4;
if -4<m114001<0 or -4<m114002<0 then do;
m114001=-4;
m114002=-4;
end;
/* new partner in r5 but cohh data fall before dli */
if pubid in
(353, 690, 1191, 1222, 1260, 1509, 2310, 2861, 2916, 3507, 3803, 4119, 4485, 5464, 5888, 6475, 7582, 7611, 7718, 7914, 8500, 8589, 8649, 8733, 9009)
then flagnback=1;
if pubid in (2530, 4988, 7770) then do;
m31001y=2001; m31001m=1;
end;
if pubid=5417 then do;
m31001y=2000; m31001m=12;
end;
/* double reporting second partner*/
if pubid=3351 then do;
m31002y=-4; m31002m=-4; m48002y=-4; m48002m=-4;
end;
if pubid=3427 then do;
m31001y=-4; m31001m=-4; m31002y=2001; m31002m=9; m48001y=2001; m48001m=4; m48002y=-4; m48002m=-4; m46701=0; m47001=-4; m47002=1; p1r5=201; p2r5=501;
end;
if pubid=512 then do;
m31001y=2000; m31001m=10; mardli=3;
end;
/* bad double counting data*/
if pubid=1343 then do;
m570011y=-4; m570011m=-4; m540011=3; m540012=-4; m560011y=2001; m560011m=11; m560012=-4; m560012=-4;
end;
if pubid=6893 then do;
m31001y=2001; m31001m=3; m31002y=-4; m31002m=-4; m48001y=2001; m48001m=9; m48002y=-4; m48002m=-4; m47001=0; m47002=-4;
end;
if pubid=1428 then do;
m31001y=2001; m31001m=2; m920011y=-4; m920011m=-4; m920012y=-4; m920012m=-4; m48001y=int_y; m48001m=int_m;
end;
if pubid=2457 then do;
m31001y=2001; m31001m=3; m48001y=2001; m48001m=9; m45001=-4; m47001=0; m31002y=-4;
m31002m=-4; m48002y=-4; m48002m=-4; m45002=-4; m47002=-4;
end;
if pubid=2599 then do;
m540011=-4; m570011y=-4; m570011m=-4;
end;
if pubid=3308 then do;
m46701=0; m47001=-4;
end;
if pubid=3321 then do;
m31001y=2001; m31001m=2; m31002y=-4; m31002m=-4; m46701=-4; m47001=1; m47002=-4; m46702=-4; m46702=-4; m48001y=-4; m48001m=-4; m560011y=-4; m560011m=-4; m560012y=-4; m560012m=-4; m570011y=-4; m570011m=-4; m540011=-4; m540012=-4;
end;
if pubid=3335 then do;
m31001y=m31002y; m31001m=m31002m; m31002y=-4; m31002m=-4; m47002=-4; m48001y=m48002y; m48001m=m48002m; m48002m=-4; m48002y=-4; m45002m=-4; m114001=-4; m46701=-4; m47001=0;
end;
if pubid=3596 or pubid=3955 then do;
m48001y=-4; m48001m=-4;
end;
if pubid=3694 then m46701=-4;
if pubid=3955 then do;
m46701=1; m47001=-4;
end;
if pubid=4685 then do;
m48001y=-4; m48001m=-4; m46701=-4; m47001=-4;
end;
if pubid=5285 then do;
m540011=-4; m570011y=-4; m570011m=-4;
end;
if pubid=5387 then do;
m46701=0; m47001=-4;
end;
if pubid=5663 then do;
m7900111=-4; m8200111y=-4; m8200111m=-4;
end;
if pubid=5807 then do;
m31001y=m700011y; m31001m=m700011m; m48001y=int_y; m48001m=int_m; m920011y=-4; m920011m=-4; m114001=-4;
end;
/* bad data for flagback*/
if pubid=1362 then do;
m31002y=-4; m31002m=-4; m48002y=-4; m48002m=-4; m47002=-4;
end;
if pubid=1939 then do;/* checked R6 she did not get married*/
m45003=0;
end;
if pubid=2157 then do;
m31001y=2001; m31001m=2; m31002y=-4; m31002y=-4; m8200111y=2001; m7900111=1; m7900112=-4; m8200111m=4; m8200112y=-4; m8200112m=-4;
end;
if pubid=5324 then do;
m31001y=2001; m31001m=10; m31002y=-4; m31002m=-4; m48001y=-4; m48001m=-4; m45001=-4; m47001=1; m47002=-4;
end;
/* double counting case and m4800y>0*/
if pubid in(1343, 2599, 3442, 5285, 6227) then do;
m46701=-4; m47001=0;
end;
if pubid=5690 then m47001=0;
if pubid=6794 then m46701=0;
if pubid= 7392 then do;
m45001=1; m7900111=-4;
end;
/* for case M114000 and M117000*/
if m114001>0 and m117001m=-4 and m117001y=-4 then m114001=-4;
if m114002>0 and m117002m=-4 and m117002y=-4 then m114002=-4;
/*check back counting problem in r5 */
if M31001y>0 and M31001M>0 then do;
coh31001 =((M31001y-1980)*12)+M31001M;
end;
if M31002Y>0 and M31002M>0 then do;
coh31002=((M31002Y-1980)*12)+M31002M;
end;
if M31003Y>0 and M31003M>0 then do;
coh31003=((M31003Y-1980)*12)+M31003M;
end;
if M31004Y>0 and M31004M>0 then do;
coh31004=((M31004Y-1980)*12)+M31004M;
end;
if M48001y>0 and M48001M>0 then do;
coh48001 =((M48001y-1980)*12)+M48001M;
end;
if (( coh31001 > int_cmr4) and ( coh31001> int_cmr3) and ( coh31001 > int_cmr2) and ( coh31001 > int_cmr1)) then do;
flag31001b=1;
end;
if (( coh31002 > int_cmr4) and ( coh31002> int_cmr3) and ( coh31002 > int_cmr2) and ( coh31002 > int_cmr1)) then do;
flag31002b=1;
end;
if (( coh31003 > int_cmr4) and ( coh31003> int_cmr3) and ( coh31003 > int_cmr2) and ( coh31003 > int_cmr1)) then do;
flag31003b=1;
end;
if (( coh31004 > int_cmr4) and ( coh31004> int_cmr3) and ( coh31004 > int_cmr2) and ( coh31004 > int_cmr1)) then do;
flag31004b=1;
end;
if ( flag31001b=1 or flag31002b=1 or flag31003b=1 or flag31004b=1) and 0<p1r5<501 and p2r5=-4 and p3r5=-4 and p4r5=-4 then flagback=1;
if ( flag31001b=1 or flag31002b=1 or flag31003b=1 or flag31004b=1) and 0<p1r5<501 and (p2r5>=501 or p3r5>=501 or p4r5>=501) then flagback1=1;
if pubid=2457 or pubid=3335 or pubid=5324 or pubid=6893 then flagback1=.;
if M48001Y>0 and M48001M>0 then do;
coh48001=((M48001Y-1980)*12)+M48001M;
end;
if M48002Y>0 and M48002M>0 then do;
coh48002=((M48002Y-1980)*12)+M48002M;
end;
if M48003Y>0 and M48003M>0 then do;
coh48003=((M48003Y-1980)*12)+M48003M;
end;
if M48004Y>0 and M48004M>0 then do;
coh48004=((M48004Y-1980)*12)+M48004M;
end;
/* stopping data fall before dli*/
if flagdc=1 and ((0< coh48001 < int_cmr4) or ( 0<coh48001< int_cmr3) or ( 0<coh48001 < int_cmr2) or ( 0<coh48001 < int_cmr1)) then do;
flag48001=1;
end;
if flag48001=1 then do;
m48001y=-4;
m48001m=-4;
end;
/* set up flag712 to find out same partner in r4 and r5*/
if m712=1 and flagdc ne 1 and 0<p1r5<501 then flag712=1;
if m712=0 and p1r5>=501 then flag712new=1;
/* find case start at dlicm flagdc1=1 and same partner*/
if (( coh31001 = int_cmr4) or ( coh31001= int_cmr3) or ( coh31001 = int_cmr2) or ( coh31001 = int_cmr1)) or (( coh31002 = int_cmr4) or ( coh31002= int_cmr3) or ( coh31002 = int_cmr2) or ( coh31002 = int_cmr1)) or (( coh31003 = int_cmr4) or ( coh31003= int_cmr3) or ( coh31002 = int_cmr3) or ( coh31003 = int_cmr1)) then flag1=1;
if flag1=1 and (0<p1r5<501 or 0<p2r5<501 or 0<p3r5<501) and pubid ne 3736 then flagdc1=1;
array hhrel (i) hhrel01-HHREL16;
do i=1 to 16;
if hhrel=1 or hhrel=2 then spo_hous=1;
end;
*Create a variable indicating r.'s marital status as they report it;
if m650 ge 0 then marques=m650;
else marques=m620;
/* Set up initial marital status by using dli created variables. */
prevmsta=MARSTAT4;
prevcmst=CMARSTA4;
mar_ttl=mar_ttl4;
coh_ttl=coh_ttl4;
prevmary=FMAR_Yr4;
prevmarm=FMAR_Mr4;
prvmarcm=fmarmr4;
prevcohm=FCOH_Mr4;
prevcohy=FCOH_Yr4;
prvcohcm=FCOHCMr4;
/*round 4 noninterview, go to round 3*/
if cmarsta4=-5 and cmarsta3 ne -5 then do;
prevmsta=marstat3;
prevcmst=cmarsta3;
mar_ttl=mar_ttl3;
coh_ttl=coh_ttl3;
prevmary=FMAR_Yr3;
prevmarm=FMAR_Mr3;
prvmarcm=fmarmr3;
prevcohm=FCOH_Mr3;
prevcohy=FCOH_Yr3;
prvcohcm=FCOHCMr3;
end;
/*round 3 noninterview, go to round 2*/
if cmarsta4=-5 and cmarsta3=-5 and cmarsta2 ne -5 then do;
prevmsta=marstat2;
prevcmst=cmarsta2;
mar_ttl=mar_ttl2;
coh_ttl=coh_ttl2;
prevmary=FMAR_Yr2;
prevmarm=FMAR_Mr2;
prvmarcm=fmarmr2;
prevcohm=FCOH_Mr2;
prevcohy=FCOH_Yr2;
prvcohcm=FCOHCMr2;
end;
/*round 4 and round 3 and round 2 noninterview, go to round 1*/
if cmarsta4=-5 and cmarsta3=-5 and cmarsta2=-5 and cmarsta1 ne -5 then do;
prevmsta=marstat1;
prevcmst=cmarsta1;
mar_ttl=mar_ttl1;
coh_ttl=coh_ttl1;
prevmary=FMAR_Yr1;
prevmarm=FMAR_Mr1;
prvmarcm=fmarmr1;
prevcohm=FCOH_Mr1;
prevcohy=FCOH_Yr1;
prvcohcm=FCOHCMr1;
end;
/* Set up the c.v.'s for first marriage and first cohab and the dli value for each respective c.v. */
dlicohy=prevcohy;
dlicohm=prevcohm;
dlicohcm=prvcohcm;
dlimary=prevmary;
dlimarm=prevmarm;
dlimarcm=prvmarcm;
/* Create interview date and previous interview date in continuous months and months/years;*/
if int_y gt 0 and int_m gt 0 then do;
iym=int_y*100+int_m;
doicm=(int_y-1980)*12+int_m;
end;
else if int_y eq -5 or int_m eq -5 then do;
doicm=-5; iym=-5;
end;
else if int_y in(-1,-2, -3,-4) or int_m in(-1, -2, -3, -4) then do;
doicm=-3; iym=-3;
end;
if MARSTAT4 ne -5 then do;
dliym=int_yr4*100+int_mr4;
dlicm=(int_yr4-1980)*12+int_mr4;
mardli=marstat4;
end;
else if marstat4 eq -5 and MARSTAT3 ne -5 then do;
dliym=int_yr3*100+int_mr3;
dlicm=(int_yr3-1980)*12+int_mr3;
mardli=marstat3;
end;
else if marstat4 eq -5 and MARSTAT3 eq -5 and MARSTAT2 ne -5 then do;
dliym=int_yr2*100+int_mr2;
dlicm=(int_yr2-1980)*12+int_mr2;
mardli=marstat2;
end;
else if marstat4 eq -5 and MARSTAT3 eq -5 and MARSTAT2 eq -5 and MARSTAT1 ne -5 then do;
dliym=int_yr1*100+int_mr1;
dlicm=(int_yr1-1980)*12+int_mr1;
mardli=marstat1;
end;
b14cm=(bdate_y+14-1980)*12+bdate_m;
/* create variable START, start month of r5 */
if m700>-3 then do;
if m700=1 then start=b14cm; /* turn 16 in round 4. */
if m700=0 then do; /* >16 in round 4 */
if m4500r4 ne -5 then start= dlicm+1; /* interviewed in round 4 */
else if m4500r4 =-5 and m4500r3 ne -5 then start= dlicm+1; /* interviewed in round 3 */
else if m4500r3 = -5 and m4500r2 ne -5 then start= dlicm+1;/* interviewed in round 2 */
else if m4500r4 =-5 and m4500r3 = -5 and m4500r2= -5 and m4500r1 ne -5 then start= dlicm+1;/* interviewed in round 2 */
else do;
if m700r4=1 then start=b14cm; /* <16 in round 4*/
if m700r3=1 then start=b14cm; /* <16 in round 3*/
if m700r2=1 then start=b14cm; /* <16 in round 2*/
if m700r1=1 then start=b14cm; /* <16 in round 1*/
else start=dlicm+1;/* >=16 in round 1*/
end;
end;
end;
else start=dlicm+1;
/* set up arrays for r4 partner and spouse*/
array r4co (l) r4co001-r4co270;
array r4link (l) r4link001-r4link270;
array r4pt (l) r4pt001-r4pt270;
array r4sp (l) r4sp001-r4sp270;
/* set up arrays for r5 partner and spouse*/
array r5pt (l) r5pt001-r5pt270;
array r5sp (l) r5sp001-r5sp270;
/* set up Mar arrays for each partner in four period*/
array maf (l) maf001-maf270;
array mas (l) mas001-mas270;
array mat (l) mat001-mat270;
array mafour (l) mafour001-mafour270;
array mbf (l) mbf001-mbf270;
array mbs (l) mbs001-mbs270;
array mbt (l) mbt001-mbt270;
array mbfour (l) mbfour001-mbfour270;
array mcf (l) mcf001-mcf270;
array mcs (l) mcs001-mcs270;
array mct (l) mct001-mct270;
array mcfour (l) mcfour001-mcfour270;
array mdf (l) mdf001-mdf270;
array mds (l) mds001-mds270;
array mdt (l) mdt001-mdt270;
array mdfour (l) mdfour001-mdfour270;
/* array for partner a in first sec third and fourth period*/
array maa (l) maa001-maa270;
array mbb (l) mbb001-mbb270;
array mcc (l) mcc001-mcc270;
array mdd (l) mdd001-mdd270;
/* set up arrays for mar total*/
array mal (l) mal001-mal270;
/* set up cohabition arrays for each partner in four period*/
array cohaf (l) cohaf001-cohaf270;
array cohas (l) cohas001-cohas270;
array cohat (l) cohat001-cohat270;
array cohafour (l) cohafour001-cohafour270;
array cohbf (l) cohbf001-cohbf270;
array cohbs (l) cohbs001-cohbs270;
array cohbt (l) cohbt001-cohbt270;
array cohbfour (l) cohbfour001-cohbfour270;
array cohcf (l) cohcf001-cohcf270;
array cohcs (l) cohcs001-cohcs270;
array cohct (l) cohct001-cohct270;
array cohcfour (l) cohcfour001-cohcfour270;
array cohdf (l) cohdf001-cohdf270;
array cohds (l) cohds001-cohds270;
array cohdt (l) cohdt001-cohdt270;
array cohdfour (l) cohdfour001-cohdfour270;
array cohaa (l) cohaa001-cohaa270;
array cohbb (l) cohbb001-cohbb270;
array cohcc (l) cohcc001-cohcc270;
array cohdd (l) cohdd001-cohdd270;
/* cohabition totla*/
array cohal (l) cohal001-cohal270;
/*arrays for event history */
array mars (l) mars001-mars270;
array cohh (l) cohh001-cohh270;
array link (l) link001-link270;
array dual (l) dual001-dual270;
do l=start to 270;
cohal=0;
cohaf=0;
cohas=0;
cohat=0;
cohafour=0;
cohbf=0;
cohbs=0;
cohbt=0;
cohbfour=0;
cohcf=0;
cohcs=0;
cohct=0;
cohcfour=0;
cohdf=0;
cohds=0;
cohdt=0;
cohdfour=0;
mal=0;
maf=0;
mas=0;
mat=0;
mafour=0;
mbf=0;
mbs=0;
mbt=0;
mbfour=0;
mcf=0;
mcs=0;
mct=0;
mcfour=0;
mdf=0;
mds=0;
mdt=0;
mdfour=0;
end;
/*In the array section, an index by "p" indicates a loop over partners, while an index by "t" indicates a loop over time periods. */
/* year start cohabitating*/
/* yscd2: year start cohabitating with partner d prd 2 */
array ysca (t) M31001Y M700011Y M700012Y ysca3;
array yscb (t) M31002Y yscb1 yscb2 yscb3;
array yscc (t) M31003Y yscc1 yscc2 yscc3;
array yscd (t) M31004Y yscd1 yscd2 yscd3;
array ysc (p) ysca yscb yscc yscd;
/* month start cohabitating*/
/*Month start cohabitating with partner d prd 3*/
array msca (t) M31001M M700011M M700012M msca3;
array mscb (t) M31002M mscb1 mscb2 mscb3;
array mscc (t) M31003M mscc1 mscc2 mscc3;
array mscd (t) M31004M mscd1 mscd2 mscd3;
array msc (p) msca mscb mscc mscd;
/*year end cohabitating (not continuous)*/
array yeca (t) M48001Y M920011Y M920012Y M920013Y;
array yecb (t) M48002Y yecb2 yecb3 yecb4;
array yecc (t) M48003Y yecc2 yecc3 yecc4;
array yecd (t) M48004Y yecd2 yecd3 yecd4;
array yec (p) yeca yecb yecc yecd;
/*month end cohabitating (not continuous)*/
array meca (t) M48001M M920011M M920012M meca4;
array mecb (t) M48002M mecb2 mecb3 mecb4;
array mecc (t) M48003M mecc2 mecc3 mecc4;
array mecd (t) M48004M mecd2 mecd3 mecd4;
array mec (p) meca mecb mecc mecd;
array ymsca (t) ymsca1 ymsca2 ymsca3 ymsca4;
array ymscb (t) ymscb1 ymscb2 ymscb3 ymscb4;
array ymscc (t) ymscc1 ymscc2 ymscc3 ymscc4;
array ymscd (t) ymscd1 ymscd2 ymscd3 ymscd4;
array ymsc (p) ymsca ymscb ymscc ymscd;
array ymeca (t) ymeca1 ymeca2 ymeca3 ymeca4;
array ymecb (t) ymecb1 ymecb2 ymecb3 ymecb4;
array ymecc (t) ymecc1 ymecc2 ymecc3 ymecc4;
array ymecd (t) ymecd1 ymecd2 ymecd3 ymecd4;
array ymec (p) ymeca ymecb ymecc ymecd;
/*continuous start month of cohabitation*/
array csmca (t) csmca1 csmca2 csmca3 csmca4;
array csmcb (t) csmcb1 csmcb2 csmcb3 csmcb4;
array csmcc (t) csmcc1 csmcc2 csmcc3 csmcc4;
array csmcd (t) csmcd1 csmcd2 csmcd3 csmcd4;
array csmc (p) csmca csmcb csmcc csmcd;
/*continuous end month of cohabitation*/
array cemca (t) cemca1 cemca2 cemca3 cemca4;
array cemcb (t) cemcb1 cemcb2 cemcb3 cemcb4;
array cemcc (t) cemcc1 cemcc2 cemcc3 cemcc4;
array cemcd (t) cemcd1 cemcd2 cemcd3 cemcd4;
array cemc (p) cemca cemcb cemcc cemcd;
/*year and month start of Marriage*/
array ymsma (t) ymsma1 ymsma2 ymsma3 ymsma4;
array ymsmb (t) ymsmb1 ymsmb2 ymsmb3 ymsmb4;
array ymsmc (t) ymsmc1 ymsmc2 ymsmc3 ymsmc4;
array ymsmd (t) ymsmd1 ymsmd2 ymsmd3 ymsmd4;
array ymsm (p) ymsma ymsmb ymsmc ymsmd;
/* continuous start month of marriage*/
array csmma (t) csmma1 csmma2 csmma3 csmma4;
array csmmb (t) csmmb1 csmmb2 csmmb3 csmmb4;
array csmmc (t) csmmc1 csmmc2 csmmc3 csmmc4;
array csmmd (t) csmmd1 csmmd2 csmmd3 csmmd4;
array csmm (p) csmma csmmb csmmc csmmd;
/* continuous start month of separation */
array csmsa (t) csmsa1 csmsa2 csmsa3 csmsa4;
array csmsb (t) csmsb1 csmsb2 csmsb3 csmsb4;
array csmsc (t) csmsc1 csmsc2 csmsc3 csmsc4;
array csmsd (t) csmsd1 csmsd2 csmsd3 csmsd4;
array csms (p) csmsa csmsb csmsc csmsd;
/* years and month start separation*/
array ymssa (t) ymssa1 ymssa2 ymssa3 ymssa4;
array ymssb (t) ymssb1 ymssb2 ymssb3 ymssb4;
array ymssc (t) ymssc1 ymssc2 ymssc3 ymssc4;
array ymssd (t) ymssd1 ymssd2 ymssd3 ymssd4;
array ymss (p) ymssa ymssb ymssc ymssd;
/* continuous end month of marriage*/
array cemma (t) cemma1 cemma2 cemma3 cemma4;
array cemmb (t) cemmb1 cemmb2 cemmb3 cemmb4;
array cemmc (t) cemmc1 cemmc2 cemmc3 cemmc4;
array cemmd (t) cemmd1 cemmd2 cemmd3 cemmd4;
array cemm (p) cemma cemmb cemmc cemmd;
/*continuous end month of separation */
array cemsa (t) cemsa1 cemsa2 cemsa3 cemsa4;
array cemsb (t) cemsb1 cemsb2 cemsb3 cemsb4;
array cemsc (t) cemsc1 cemsc2 cemsc3 cemsc4;
array cemsd (t) cemsd1 cemsd2 cemsd3 cemsd4;
array cems (p) cemsa cemsb cemsc cemsd;
/* dummy for cohabitation continuous - since dli*/
array cdlia (t) M46701 cdlia2 cdlia3 cdlia4;
array cdlib (t) cdlib1 cdlib2 cdlib3 cdlib4;
array cdlic (t) cdlic1 cdlic2 cdlic3 cdlic4;
array cdlid (t) cdlid1 cdlid2 cdlid3 cdlid4;
array cdli (p) cdlia cdlib cdlic cdlid;
/*dummy for cohabitation continuous - since start (after dli date)*/
array cbega (t) M47001 cbega2 cbega3 cbega4;
array cbegb (t) M47002 cbegb2 cbegb3 cbegb4;
array cbegc (t) M47003 cbegc2 cbegc3 cbegc4;
array cbegd (t) M47004 cbegd2 cbegd3 cbegd4;
array cbeg (p) cbega cbegb cbegc cbegd;
/* cohabitation continuous - since start (after dli date)*/ /*is it correct?*/
array cbeg2a (t) M910011 cbeg2a2 cbeg2a3 cbeg2a4;
array cbeg2b (t) M910012 cbeg2b2 cbeg2b3 cbeg2b4;
array cbeg2c (t) cbeg2c1 cbeg2c2 cbeg2c3 cbeg2c4;
array cbeg2d (t) cbeg2d1 cbeg2d2 cbeg2d3 cbeg2d4;
array cbeg2 (p) cbeg2a cbeg2b cbeg2c cbeg2d;
/* legally married when began cohabitating*/
array mbega (t) M45001 mbega2 mbega3 mbega4;
array mbegb (t) M45002 mbegb2 mbegb3 mbegb4;
array mbegc (t) M45003 mbegc2 mbegc3 mbegc4;
array mbegd (t) M45004 mbegd2 mbegd3 mbegd4;
array mbeg (p) mbega mbegb mbegc mbegd;
/*marital/cohabitation status at date of last interview*/
array mdlia (t) mardli mdlia2 mdlia3 mdlia4;
array mdlib (t) mdlib1 mdlib2 mdlib3 mdlib4;
array mdlic (t) mdlic1 mdlic2 mdlic3 mdlic4;
array mdlid (t) mdlid1 mdlid2 mdlid3 mdlid4;
array mdli (p) mdlia mdlib mdlic mdlid;
/* First or next change in status.
Read "howa2" as change in marital status for partner a, period 2. */
array howa1 (t) m540011 m540012 howa13 howa14;
array howa2 (t) m7900111 m7900112 m7900113 m7900114;
array howb3 (t) m7900211 howb32 howb33 howb34;
array howa4 (t) m9800111 howa42 howa43 howa44;
/*collapse into how status changed*/
array how1 (p) howa1 howb1 howc1 howd1;
array how2 (p) howa2 howb2 howc2 howd2;
array how3 (p) howa3 howb3 howc3 howd3;
array how4 (p) howa4 howb4 howc4 howd4;
array how (i) how1 how2 how3 how4 ;
/*month and year change is marry*/
array hyma1 (t) M570011y M570012y hyma13 hyma14;
array hmma1 (t) M570011m M570012m hmma13 hmma14;
array hyma2 (t) m8200111y m8200112y m8200113y m8200114y;
array hmma2 (t) m8200111m m8200112m m8200113m m8200114m;
array hymb3 (t) m8200211y hymb32 hymb33 hymb34;
array hmmb3 (t) m8200211m hmmb32 hmmb33 hmmb34;
array hyma4 (t) m1010011y hyma42 hyma43 hyma44;
array hmma4 (t) m1010011m hmma42 hmma43 hmma44;
/*collaspse into month and year change is marry*/
array hym1 (p) hyma1 hymb1 hymc1 hymd1;
array hmm1 (p) hmma1 hmmb1 hmmc1 hmmd1;
array hym2 (p) hyma2 hymb2 hymc2 hymd2;
array hmm2 (p) hmma2 hmmb2 hmmc2 hmmd2;
array hym3 (p) hyma3 hymb3 hymc3 hymd3;
array hmm3 (p) hmma3 hmmb3 hmmc3 hmmd3;
array hym4 (p) hyma4 hymb4 hymc4 hymd4;
array hmm4 (p) hmma4 hmmb4 hmmc4 hmmd4;
array hym (i) hym1 hym2 hym3 hym4;
array hmm (i) hmm1 hmm2 hmm3 hmm4;
/*month and year change=separation, divorce, annulment*/
array hyssa1 (t) hyssa11 M560012Y hyssa13 hyssa14;
array hmssa1 (t) hyssa12 M560012M hmssa13 hmssa14;
array hyssa2 (t) M8100111Y hyssa22 hyssa23 hyssa24;
array hmssa2 (t) M8100111M hmssa22 hmssa23 hmssa24;
array hyssa3 (t) hyssa31 hyssa32 hyssa33 hyssa34;
array hmssa3 (t) hmssa31 hmssa32 hmssa33 hmssa34;
array hyssa4 (t) hyssa41 hyssa42 hyssa43 hyssa44;
array hmssa4 (t) hmssa41 hmssa42 hmssa43 hmssa44;
/*collapse into month and year change=separation, divorce, annulment*/
array hyss1 (p) hyssa1 hyssb1 hyssc1 hyssd1;
array hmss1 (p) hmssa1 hmssb1 hmssc1 hmssd1;
array hyss2 (p) hyssa2 hyssb2 hyssc2 hyssd2;
array hmss2 (p) hmssa2 hmssb2 hmssc2 hmssd2;
array hyss3 (p) hyssa3 hyssb3 hyssc3 hyssd3;
array hmss3 (p) hmsas3 hmssb3 hmssc3 hmssd3;
array hyss4 (p) hyssa4 hyssb4 hyssc4 hyssd4;
array hmss4 (p) hmssa4 hmssb4 hmssc4 hmssd4;
array hyss (i) hyss1 hyss2 hyss3 hyss4;
array hmss (i) hmss1 hmss2 hmss3 hmss4;
/* Collapsed marital status*/
array cmarsa (t) cmarsa1 cmarsa2 cmarsa3 cmarsa4;
array cmarsb (t) cmarsb1 cmarsb2 cmarsb3 cmarsb4;
array cmarsc (t) cmarsc1 cmarsc2 cmarsc3 cmarsc4;
array cmarsd (t) cmarsd1 cmarsd2 cmarsd3 cmarsd4;
array cmars (p) cmarsa cmarsb cmarsc cmarsd;
/* imars individual marital status */
array imarsa (t) imarsa1 imarsa2 imarsa3 imarsa4;
array imarsb (t) imarsb1 imarsb2 imarsb3 imarsb4;
array imarsc (t) imarsc1 imarsc2 imarsc3 imarsc4;
array imarsd (t) imarsd1 imarsd2 imarsd3 imarsd4;
array imars (p) imarsa imarsb imarsc imarsd;
/*dummy set to one if start month cohabitate is invalid*/
array fixmc1 (t) fixmc11 fixmc12 fixmc13 fixmc14;
array fixmc2 (t) fixmc21 fixmc22 fixmc23 fixmc24;
array fixmc3 (t) fixmc31 fixmc32 fixmc33 fixmc34;
array fixmc4 (t) fixmc41 fixmc42 fixmc43 fixmc44;
array fixmc (p) fixmc1 fixmc2 fixmc3 fixmc4;
/*dummy set to one if start month marry is invalid*/
array fixmm1 (t) fixmm11 fixmm12 fixmm13 fixmm14;
array fixmm2 (t) fixmm21 fixmm22 fixmm23 fixmm24;
array fixmm3 (t) fixmm31 fixmm32 fixmm33 fixmm34;
array fixmm4 (t) fixmm41 fixmm42 fixmm43 fixmm44;
array fixmm (p) fixmm1 fixmm2 fixmm3 fixmm4;
/*dummy set to one if start year cohabitate is invalid*/
array fixyc1 (t) fixyc11 fixyc12 fixyc13 fixyc14;
array fixyc2 (t) fixyc21 fixyc22 fixyc23 fixyc24;
array fixyc3 (t) fixyc31 fixyc32 fixyc33 fixyc34;
array fixyc4 (t) fixyc41 fixyc42 fixyc43 fixyc44;
array fixyc (p) fixyc1 fixyc2 fixyc3 fixyc4;
/*dummy set to one if start year marry is invalid*/
array fixym1 (t) fixym11 fixym12 fixym13 fixym14;
array fixym2 (t) fixym21 fixym22 fixym23 fixym24;
array fixym3 (t) fixym31 fixym32 fixym33 fixym34;
array fixym4 (t) fixym41 fixym42 fixym43 fixym44;
array fixym (p) fixym1 fixym2 fixym3 fixym4;
array coha (t) cohaf cohas cohat cohafour;
array cohb (t) cohbf cohbs cohbt cohbfour;
array cohc (t) cohcf cohcs cohct cohcfour;
array cohd (t) cohdf cohds cohdt cohdfour;
array coh (p) coha cohb cohc cohd ;
array ma (t) maf mas mat mafour;
array mb (t) mbf mbs mbt mbfour;
array mc (t) mcf mcs mct mcfour;
array md (t) mcf mcs mdt mdfour;
array m (p) ma mb mc md;
/*number of cohabitations*/
array nuca (t) nuca1 nuca2 nuca3 nuca4;
array nucb (t) nucb1 nucb2 nucb3 nucb4;
array nucc (t) nucc1 nucc2 nucc3 nucc4;
array nucd (t) nucd1 nucd2 nucd3 nucd4;
array nuc (p) nuca nucb nucc nucd;
/*number of marriages*/
array numa (t) numa1 numa2 numa3 numa4;
array numb (t) numb1 numb2 numb3 numb4;
array numc (t) numc1 numc2 numc3 numc4;
array numd (t) numd1 numd2 numd3 numd4;
array num (p) numa numb numc numd;
if mardli=-1 or mardli=-2 then do; /* 7-23-02 check this do I need put it in*/
mardli=-3;
flagcheck=1;
end;
/* month and year relationship ended */
array eyra (t) M117001Y eyra2 eyra3 eyra4;
array eyrb (t) eyrb1 eyrb2 eyrb3 eyrb4;
array eyrc (t) eyrc1 eyrc2 eyrc3 eyrc4;
array eyrd (t) eyrd1 eyrd2 eyrd3 eyrd4;
array emoa (t) M117001M emoa2 emoa3 emoa4;
array emob (t) emob1 emob2 emob3 emob4;
array emoc (t) emoc1 emoc2 emoc3 emoc4;
array emod (t) emod1 emod2 emod3 emod4;
/*collapse all start years and months into arrays*/
array eyr (p) eyra eyrb eyrc eyrd;
array emo (p) emoa emob emoc emod;
/* Current staus of relationship */
array fstata (t) M114001 fstata2 fstata3 fstata4;
array fstatb (t) M114002 fstatb2 fstatb3 fstatb4;
array fstatc (t) M114003 fstatc2 fstatc3 fstatc4;
array fstatd (t) M114004 fstatd2 fstatd3 fstatd4;
/*collapse married into array*/
array fstat (p) fstata fstatb fstatc fstatd;
do l=1 to 258;
if l=dlicm then do;
cohhr4=r4co;
end;
end;
do p=1 to 4; /* loop for p */
do t=1 to 4; /* loop for t */
if cdli=1 then do; ymsc=dliym; end;
if cdli=0 then ymsc=dliym;
if mdli=1 or mdli=2 then cmars=0;
if mdli=3 or mdli=4 then do;
cmars=1;
ymsm=dliym;
if flagdc=1 then do;
m45001=1;
end;
end;
if mdli=5 or mdli=6 then do;
cmars=2; ymss=dliym;
end;
if mdli=7 or mdli=8 then cmars=3;
if mdli=9 or mdli=10 then cmars=4;
if mdli<0 and mdli ne -4 then cmars=mdli;
if ysc>0 and msc>0 and ysc gt bdate_y then ymsc=(ysc*100)+msc;
/* If a start year or month is missing and flag ne 1 then set it to dli. */
if (-3 le ysc le 0 or -3 le msc le 0) and flagdc ne 1 then ymsc=dliym;
if (-3 le ysc le 0 and -3 le msc le 0) and flagdc ne 1 then ymsc=dliym;
csmc=(round(ymsc,100)-198000)*.12+(ymsc-round(ymsc,100));
/* create dummies for negative answers. Any negative answer is set to the dli and dummies (fixyc, fixmc) are created to identify these cases. */
if -3 le ysc le 0 then fixyc=1;
if -3 le msc le 0 then fixmc=1;
/* If a start year or month is missing, then set it to dli. */
if -3 le ysc le 0 or -3 le msc le 0 then ymsc=dliym;
if -3 le ysc le 0 and -3 le msc le 0 then ymsc=dliym;
if ysc > 0 and -3 le msc le 0 then ymsc=(ysc*100)+1;/*this is new 1=jan*/
* need to add stop information for arrays;
if yec>0 and mec>0 and yec gt bdate_y then ymec=(yec*100)+mec;
if (-3 le yec le 0 or -3 le mec le 0) and (cbeg ne 1 and cbeg2 ne 1 and cdli ne 1) then ymec=iym;
if yec>0 and -3 le mec le 0 then ymec=(yec*100)+12;
csmc=(round(ymsc,100)-198000)*.12+(ymsc-round(ymsc,100));
cemc=((round(ymec,100)-198000)*.12+(ymec-round(ymec,100)))-1;
if ymec=ymsc then cemc=(round(ymec,100)-198000)*.12+(ymec-round(ymec,100));
if cbeg=1 or cbeg2=1 or cdli=1 then cemc=doicm;
if mbeg=1 then do;
cmars=1;
imars=1;
ymsm=ymsc;
ymsc=.;
if fixmc=1 then fixmm=1;
if fixyc=1 then fixym=1;
end;
if mbeg=0 then imars=0;
if mbeg=-4 and cmars ne . and cohhr3 gt 200 then imars=1;
else if mbeg=-4 and cmars ne . and cmars ne -4 and 100 lt cohhr4 lt 200 then imars=0;
csmm=(round(ymsm,100)-198000)*.12+(ymsm-round(ymsm,100));
csms=(round(ymss,100)-198000)*.12+(ymss-round(ymss,100));
if csms>0 then cems=doicm;
if csmm>0 then cemm=doicm;
C=0;
do l=start to 270; /* loop 1 */
C=C+1;
if csmc>0 and cemc>0 and csmc LE C LE cemc then cohal=1;
if csmc>0 and cemc>0 and csmc LE C LE cemc then coh=1;
if cmars=1 and csmm>0 and cemm>0 and csmm le c le cemm then mal=1;
if imars=1 and csmm>0 and cemm>0 and csmm le c le cemm then m=1;
if 2 le cmars le 3 and csms>0 and cems>0 and csms le c le cems then mal=cmars;
if 2 le imars le 3 and csms>0 and cems>0 and csms le c le cems then m=imars;
if cmars=0 then mal=cmars;
if -2 le cmars le -1 then mal=cmars;
if -2 le imars le -1 then m=imars;
end; /* end loop 1 */
/* This loop 1 will help to reserve the information from last round, without this loop, the old info. could be overwriten by the loops following. */
do i=1 to 4; /* Loop 2 */
if how=1 and hym>1 and hmm>1 then do;
cmars=1;
imars=1;
ymsm=hym*100+hmm;
end;
if -2 le how le -1 then do;
cmars=how;
imars=how;
end;
if how=1 and (-4<hym<0 or -4<hmm<0) then do;
cmars=1;
imars=1;
ymsm=iym;
end;
csmm=(round(ymsm,100)-198000)*.12+(ymsm-round(yms