Variables Created:
1. Household size = HHSIZE =
CV_HH_SIZE
2. Number of household members less than 6 years old = UNDER6 = CV_HH_UNDER_6
3. Number of household members less than 18 years old = UNDER18 =
CV_HH_UNDER_18
Variables Used
|
Name in Program |
Question in Survey |
|
PUBID |
PUBID |
| HAGE01 | HHI AGE (ROS ITEM) L1 2004 |
|
HAGE02 |
HHI AGE (ROS ITEM) L2 2004 |
|
HAGE03 |
HHI AGE (ROS ITEM) L3 2004 |
|
HAGE04 |
HHI AGE (ROS ITEM) L4 2004 |
| HAGE05 | HHI AGE (ROS ITEM) L5 2004 |
| HAGE06 | HHI AGE (ROS ITEM) L6 2004 |
| HAGE07 | HHI AGE (ROS ITEM) L7 2004 |
| HAGE08 | HHI AGE (ROS ITEM) L8 2004 |
| HAGE09 | HHI AGE (ROS ITEM) L9 2004 |
| HAGE10 | HHI AGE (ROS ITEM) L10 2004 |
| HAGE11 | HHI AGE (ROS ITEM) L11 2004 |
| HAGE12 | HHI AGE (ROS ITEM) L12 2004 |
| HAGEST01 | HHI, ESTIMATED AGE OF HH MEMBER 01 AS OF INTDATE (ROS ITEM) 2004 |
| HAGEST02 | HHI, ESTIMATED AGE OF HH MEMBER 02 AS OF INTDATE (ROS ITEM) 2004 |
| HAGEST03 | HHI, ESTIMATED AGE OF HH MEMBER 03 AS OF INTDATE (ROS ITEM) 2004 |
| HAGEST04 | HHI, ESTIMATED AGE OF HH MEMBER 04 AS OF INTDATE (ROS ITEM) 2004 |
| HAGEST05 | HHI, ESTIMATED AGE OF HH MEMBER 05 AS OF INTDATE (ROS ITEM) 2004 |
| HAGEST06 | HHI, ESTIMATED AGE OF HH MEMBER 06 AS OF INTDATE (ROS ITEM) 2004 |
| HAGEST07 | HHI, ESTIMATED AGE OF HH MEMBER 07 AS OF INTDATE (ROS ITEM) 2004 |
| HUID01 | HHI UID (ROS ITEM) L1 2004 |
| HUID02 | HHI UID (ROS ITEM) L2 2004 |
| HUID03 | HHI UID (ROS ITEM) L3 2004 |
| HUID04 | HHI UID (ROS ITEM) L4 2004 |
| HUID05 | HHI UID (ROS ITEM) L5 2004 |
| HUID06 | HHI UID (ROS ITEM) L6 2004 |
| HUID07 | HHI UID (ROS ITEM) L7 2004 |
| HUID08 | HHI UID (ROS ITEM) L8 2004 |
| HUID09 | HHI UID (ROS ITEM) L9 2004 |
| HUID10 | HHI UID (ROS ITEM) L10 2004 |
| HUID11 | HHI UID (ROS ITEM) L11 2004 |
| HUID12 | HHI UID (ROS ITEM) L12 2004 |
| 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-HAGE12;
ARRAY HUID HUID01-HUID12;
ARRAY HAGEST HAGEST01-HAGEST12;
/* Create dummy variables HHDUM[I] (I=1 TO 13) 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 13)
that equal 1 if the ith household member is under age 6 and DUM18[I] (I=1 TO 13)
that equal 1 if the ith
household member is under age 18.*/
ARRAY HHDUM HHDUM01-HHDUM12;
ARRAY DUM6 DUM601-DUM612;
ARRAY DUM18 DUM1801-DUM1812;
DO I=1 TO 12;
HHDUM[I]=0;
DUM6[I]=0;
DUM18[I]=0;
END;
DO I=1 TO 12;
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 12;
HHSIZE=HHSIZE+HHDUM[I];
UNDER6=UNDER6+DUM6[I];
UNDER18=UNDER18+DUM18[I];
END;
IF HUID01=-5 THEN HHSIZE=-5;
do I=1 TO 12;
IF -4<HUID[I]<0 THEN HHSIZE=-3;
END;
IF HUID01=-5 THEN UNDER6=-5;
IF HUID01=-5 THEN UNDER18=-5;
DO I=1 TO 12;
IF -4<HAGE[I]<0 THEN PRT1=-3;
END;
Do I=1 TO 12;
IF -4<HAGEST[I]<0 AND PRT1=-3 THEN PRT2=-3;
END;
IF PRT2=-3 OR HHSIZE=-3 THEN DO;
UNDER6=-3;
UNDER18=-3;
END;
IF UND6=-3 THEN DO;
UNDER6=-3;
END;
/* hand edit case*/
do i=1 to 11;
if HUID[i]=-4 and HUID[i+1]>0 then flag=1;
end;
if pubid=1398 then do;
HHSIZE =-5;
UNDER6=-5;
UNDER18=-5;
end;
endsas;
Variables Created: CV_MARSTAT
CV_MARSTAT_COLLAPSED
CV_FIRST_COHAB_DATE_M
CV_FIRST_COHAB_DATE_Y
CV_FIRST_MARRY_DATE_M
CV_FIRST_MARRY_DATE_Y
CV_FIRST_COHAB_MONTH
CV_FIRST_MARRY_MONTH
CV_COHAB_TTL
CV_MARRIAGES_TTL
Variables Used
|
Name in Program |
Question Name on CD |
Name in Program |
Question Name on CD |
Name in Program |
Question Name on CD |
||
| Round 1 | Round 4 cont'd | Round 7 cont'd | |||||
| m700r1 | YMAR_700_1997 | INT_Mr4 | CV_INTERVIEW_DATE_M_2000 | COH_TTL7 | CV_COHAB_TTL_2003 | ||
| m45001r1 | YMAR_4500_01_1997 | INT_Yr4 | CV_INTERVIEW_DATE_Y_2000 | MAR_TTL7 | CV_MARRIAGES_TTL_2003 | ||
| m45002r1 | YMAR_4500_02_1997 | MARSTAT4 | CV_MARSTAT_2000 | ||||
| m540011r1 | YMAR_5400_01_01_1997 | CMARSTA4 | CV_MARSTAT_COLLAPSED_2000 | Round 8 | |||
| m540012r1 | YMAR_5400_01_02_1997 | COH_TTL4 | CV_COHAB_TTL_2000 | M620 | YMAR_620_2004 | ||
| FCOH_Mr1 | CV_FIRST_COHAB_DATE_M_1997 | MAR_TTL4 | CV_MARRIAGES_TTL_2000 | M650 | YMAR_650_2004 | ||
| FCOH_Yr1 | CV_FIRST_COHAB_DATE_Y_1997 | PUBID | PUBID_2000 | M710 | YMAR_710_2004 | ||
| FCOHCMr1 | CV_FIRST_COHAB_MONTH_1997 | M712 | YMAR_712_2004 | ||||
| FMAR_Mr1 | CV_FIRST_MARRY_DATE_M_1997 | Round 5 | M714 | YMAR_714_2004 | |||
| FMAR_Yr1 | CV_FIRST_MARRY_DATE_Y_1997 | m700r5 | YMAR_700_2001 | M718 | YMAR_718_2004 | ||
| FMARMr1 | CV_FIRST_MARRY_MONTH_1997 | M45001r5 | YMAR_4500_01_2001 | M729D | YMAR_729D_2004 | ||
| INT_Dr1 | CV_INTERVIEW_DATE_D_1997 | M45002r5 | YMAR_4500_02_2001 | M730 | YMAR_730_2004 | ||
| INT_Mr1 | CV_INTERVIEW_DATE_M_1997 | M45003r5 | YMAR_4500_03_2001 | M740 | YMAR_740_2004 | ||
| INT_Yr1 | CV_INTERVIEW_DATE_Y_1997 | M45004r5 | YMAR_4500_04_2001 | M760 | YMAR_760_2004 | ||
| MARSTAT1 | CV_MARSTAT_1997 | m54011r5 | YMAR_5400_01_01_2001 | M2900 | YMAR_2900_2004 | ||
| CMARSTA1 | CV_MARSTAT_COLLAPSED_1997 | M54012r5 | YMAR_5400_01_02_2001 | M31001M | YMAR_3100_01_M_2004 | ||
| COH_TTL1 | CV_MARRIAGES_TTL_1997 | m54021r5 | YMAR_5400_02_01_2001 | M31001Y | YMAR_3100_01_Y_2004 | ||
| MAR_TTL1 | CV_MARRIAGES_TTL_1997 | M54022r5 | YMAR_5400_02_02_2001 | M31002M | YMAR_3100_02_M_2004 | ||
| FCOH_Mr5 | CV_FIRST_COHAB_DATE_M_2001 | M31002Y | YMAR_3100_02_Y_2004 | ||||
| Round 2 | FCOH_Yr5 | CV_FIRST_COHAB_DATE_Y_2001 | M31003M | YMAR_3100_03_M_2004 | |||
| m700r2 | YMAR_700_1998 | FCOHCMr5 | CV_FIRST_COHAB_MONTH_2001 | M31003Y | YMAR_3100_03_Y_2004 | ||
| M45001r2 | YMAR_4500_01_1998 | FMAR_Mr5 | CV_FIRST_MARRY_DATE_M_2001 | m45001 | YMAR_4500_01_2004 | ||
| M45002r2 | YMAR_4500_02_1998 | FMAR_Yr5 | CV_FIRST_MARRY_DATE_Y_2001 | M45002 | YMAR_4500_02_2004 | ||
| M45003r2 | YMAR_4500_03_1998 | FMARMr5 | CV_FIRST_MARRY_MONTH_2001 | M45003 | YMAR_4500_03_2004 | ||
| M54011r2 | YMAR_5400_01_01_1998 | INT_Dr5 | CV_INTERVIEW_DATE_D_2001 | M45004 | YMAR_4500_04_2004 | ||
| M54012r2 | YMAR_5400_01_02_1998 | INT_Mr5 | CV_INTERVIEW_DATE_M_2001 | M46501 | YMAR_4650_01_2004 | ||
| FCOH_Mr2 | CV_FIRST_COHAB_DATE_M_1998 | INT_Yr5 | CV_INTERVIEW_DATE_Y_2001 | M46502 | YMAR_4650_02_2004 | ||
| FCOH_Yr2 | CV_FIRST_COHAB_DATE_Y_1998 | MARSTAT5 | CV_MARSTAT_2001 | M46503 | YMAR_4650_03_2004 | ||
| FCOHCMr2 | CV_FIRST_COHAB_MONTH_1998 | CMARSTA5 | CV_MARSTAT_COLLAPSED_2001 | M47001 | YMAR_4700_01_2004 | ||
| FMAR_Mr2 | CV_FIRST_MARRY_DATE_M_1998 | COH_TTL5 | CV_COHAB_TTL_2001 | M47002 | YMAR_4700_02_2004 | ||
| FMAR_Yr2 | CV_FIRST_MARRY_DATE_Y_1998 | MAR_TTL5 | CV_MARRIAGES_TTL_2001 | M47003 | YMAR_4700_03_2004 | ||
| FMARMr2 | CV_FIRST_MARRY_MONTH_1998 | M48001M | YMAR_4800_01_M_2004 | ||||
| INT_Dr2 | CV_INTERVIEW_DATE_D_1998 | Round 6 | M48001Y | YMAR_4800_01_Y_2004 | |||
| INT_Mr2 | CV_INTERVIEW_DATE_M_1998 | m700r6 | YMAR_700_2002 | M48002M | YMAR_4800_02_M_2004 | ||
| INT_Yr2 | CV_INTERVIEW_DATE_Y_1998 | M45001r6 | YMAR_4500_01_2002 | M48002Y | YMAR_4800_02_Y_2004 | ||
| MARSTAT2 | CV_MARSTAT_1998 | M45002r6 | YMAR_4500_02_2002 | M48003M | YMAR_4800_03_M_2004 | ||
| CMARSTA2 | CV_MARSTAT_COLLAPSED_1998 | M45003r6 | YMAR_4500_03_2002 | M48003Y | YMAR_4800_03_Y_2004 | ||
| COH_TTL2 | CV_COHAB_TTL_1998 | M45004r6 | YMAR_4500_04_2002 | M540011 | YMAR_5400_01_01_2004 | ||
| MAR_TTL2 | CV_MARRIAGES_TTL_1998 | m54011r6 | YMAR_5400_01_01_2002 | M540012 | YMAR_5400_01_02_2004 | ||
| M54012r6 | YMAR_5400_01_02_2002 | M540013 | YMAR_5400_01_03_2004 | ||||
| Round 3 | m54021r6 | YMAR_5400_02_01_2002 | M560012M | YMAR_5600_01_01_M_2004 | |||
| m700r3 | YMAR_700_1999 | M54022r6 | YMAR_5400_02_02_2002 | M560012Y | YMAR_5600_01_02_Y_2004 | ||
| M45001r3 | YMAR_4500_01_1999 | FCOH_Mr6 | CV_FIRST_COHAB_DATE_M_2002 | M560013Y | YMAR_5600_01_03_Y_2004 | ||
| M45002r3 | YMAR_4500_02_1999 | FCOH_Yr6 | CV_FIRST_COHAB_DATE_Y_2002 | M570011M | YMAR_5700_01_01_M_2004 | ||
| m54011r3 | YMAR_5400_01_01_1999 | FCOHCMr6 | CV_FIRST_COHAB_MONTH_2002 | M570011Y | YMAR_5700_01_01_Y_2004 | ||
| M54012r3 | YMAR_5400_01_02_1999 | FMAR_Mr6 | CV_FIRST_MARRY_DATE_M_2002 | M700011M | YMAR_7000_01_01_M_2004 | ||
| FCOH_Mr3 | CV_FIRST_COHAB_DATE_M_1999 | FMAR_Yr6 | CV_FIRST_MARRY_DATE_Y_2002 | M700011Y | YMAR_7000_01_01_Y_2004 | ||
| FCOH_Yr3 | CV_FIRST_COHAB_DATE_Y_1999 | FMARMr6 | CV_FIRST_MARRY_MONTH_2002 | M700012M | YMAR_7000_01_02_M_2004 | ||
| FCOHCMr3 | CV_FIRST_COHAB_MONTH_1999 | INT_Dr6 | CV_INTERVIEW_DATE_D_2002 | M700012y | YMAR_7000_01_02_Y_2004 | ||
| FMAR_Mr3 | CV_FIRST_MARRY_DATE_M_1999 | INT_Mr6 | CV_INTERVIEW_DATE_M_2002 | M700021M | YMAR_7000_02_01_M_2004 | ||
| FMAR_Yr3 | CV_FIRST_MARRY_DATE_Y_1999 | INT_Yr6 | CV_INTERVIEW_DATE_Y_2002 | M700031Y | YMAR_7000_03_01_Y_2004 | ||
| FMARMr3 | CV_FIRST_MARRY_MONTH_1999 | MARSTAT6 | CV_MARSTAT_2002 | M7900111 | YMAR_7900_01_01_01_2004 | ||
| INT_Dr3 | CV_INTERVIEW_DATE_D_1999 | CMARSTA6 | CV_MARSTAT_COLLAPSED_2002 | M7900211 | YMAR_7900_02_01_01_2004 | ||
| INT_Mr3 | CV_INTERVIEW_DATE_M_1999 | COH_TTL6 | CV_COHAB_TTL_2002 | M810111M | YMAR_8100_01_01_01_M_2004 | ||
| INT_Yr3 | CV_INTERVIEW_DATE_Y_1999 | MAR_TTL6 | CV_MARRIAGES_TTL_2002 | M810111Y | YMAR_8100_01_01_01_Y_2004 | ||
| MARSTAT3 | CV_MARSTAT_1999 | M8200111M | YMAR_8200_01_01_01_M_2004 | ||||
| CMARSTA3 | CV_MARSTAT_COLLAPSED_1999 | Round 7 | M8200111Y | YMAR_8200_01_01_01_Y_2004 | |||
| COH_TTL3 | CV_COHAB_TTL_1999 | m700r7 | YMAR_700_2003 | M8200112M | YMAR_8200_01_01_02_M_2004 | ||
| MAR_TTL3 | CV_MARRIAGES_TTL_1999 | M45001r7 | YMAR_4500_01_2003 | M8200112Y | YMAR_8200_01_01_02_Y_2004 | ||
| M45002r7 | YMAR_4500_02_2003 | M8200211M | YMAR_8200_02_01_01_M_2004 | ||||
| Round 4 | M45003r7 | YMAR_4500_03_2003 | M8200211Y | YMAR_8200_02_01_01_Y_2004 | |||
| m700r4 | YMAR_700_2000 | M45004r7 | YMAR_4500_04_2003 | M910011 | YMAR_9100_01_01_2004 | ||
| M45001r4 | YMAR_4500_01_2000 | m54011r7 | YMAR_5400_01_01_2003 | M910012 | YMAR_9100_01_02_2004 | ||
| M45002r4 | YMAR_4500_02_2000 | M54012r7 | YMAR_5400_01_02_2003 | M910021 | YMAR_9100_02_01_2004 | ||
| M45003r4 | YMAR_4500_03_2000 | m54021r7 | YMAR_5400_02_01_2003 | M920011M | YMAR_9200_01_01_M_2004 | ||
| M45004r4 | YMAR_4500_04_2000 | M54022r7 | YMAR_5400_02_02_2003 | M920011Y | YMAR_9200_01_01_Y_2004 | ||
| m54011r4 | YMAR_5400_01_01_2000 | FCOH_Mr7 | CV_FIRST_COHAB_DATE_M_2003 | M920021M | YMAR_9200_02_01_M_200 | ||
| M54012r4 | YMAR_5400_01_02_2000 | FCOH_Yr7 | CV_FIRST_COHAB_DATE_Y_2003 | M920021Y | YMAR_9200_02_01_Y_2004 | ||
| m54021r4 | YMAR_5400_02_01_2000 | FCOHCMr7 | CV_FIRST_COHAB_MONTH_2003 | m11700011y | YMAR_11700_01_Y_2004 | ||
| M54022r4 | YMAR_5400_02_02_2000 | FMAR_Mr7 | CV_FIRST_MARRY_DATE_M_2003 | m11700011m | YMAR_11700_02_M_2004 | ||
| FCOH_Mr4 | CV_FIRST_COHAB_DATE_M_2000 | FMAR_Yr7 | CV_FIRST_MARRY_DATE_Y_2003 | M114001 | YMAR_11400_01_2004 | ||
| FCOH_Yr4 | CV_FIRST_COHAB_DATE_Y_2000 | FMARMr7 | CV_FIRST_MARRY_MONTH_2003 | M114002 | YMAR_11400_02_2004 | ||
| FCOHCMr4 | CV_FIRST_COHAB_MONTH_2000 | INT_Dr7 | CV_INTERVIEW_DATE_D_2003 | M114003 | YMAR_11400_03_2004 | ||
| FMAR_Mr4 | CV_FIRST_MARRY_DATE_M_2000 | INT_Mr7 | CV_INTERVIEW_DATE_M_2003 | INT_D | CV_INTERVIEW_DATE_D_2004 | ||
| FMAR_Yr4 | CV_FIRST_MARRY_DATE_Y_2000 | INT_Yr7 | CV_INTERVIEW_DATE_Y_2003 | INT_M | CV_INTERVIEW_DATE_M_2004 | ||
| FMARMr4 | CV_FIRST_MARRY_MONTH_2000 | MARSTAT7 | CV_MARSTAT_2003 | INT_Y | CV_INTERVIEW_DATE_Y_2004 | ||
| INT_Dr4 | CV_INTERVIEW_DATE_D_2000 | CMARSTA7 | CV_MARSTAT_COLLAPSED_2003 |
Codes for Created Variable
|
Marital/Cohabitation Status |
|
|
1
= never married, cohabiting |
6 = separated, not
cohabiting |
|
Collapsed Marital Status |
|
0
= never married |
| Marital Status in Event History |
|
0 = never married, not cohabiting 1 = never married, cohabiting 2 = married 3 = separated 4 = divorced 5 = widowed |
p1=partner
p2=partner
p3=partner
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.
/* There are 70 cases R's have new partners, But R's were not asked the
cohabitation month and year */
if p1>800 and m31001y=-4 and m31001m=-4 then do;
m31001y=-3;
m31001m=-3;
if m46701=1 then do;
m47001=1;
m46701=-4;
end;
if m46701=0 and m48001m=-4 then do;
m47001=0;
m48001m=-3;
m48001y=-3;
end;
if m7900111=1 and m47001=0 and m48001m=-3 then do;
m47001=1;
m48001y=-4;
m48001m=-4;
end;
if m46701=0 then do;
m47001=0;
m46701=-4;
end;
end;
if p2>800 and m31002m=-4 and m31002y=-4 then do;
m31002y=-3;
m31002m=-3;
if m46702=1 then do;
m47002=1;
m46702=-4;
end;
end;
if pubid=6147 then do;
m117001m=m560011m;
end;
/* put second partner name in partner roster*/
if pubid =2148 then p2=301;
if pubid in( 159,8627)then do;
m45001=1;
end;
/* No information about R's new partner*/
if pubid in (6080, 8069) then do;
m48001m=-3;
m48001y=-3;
end;
if pubid=2653 then m48001y=2003;
if pubid in( 6208, 7721 ) then m114002=-4;
if pubid in ( 6932, 1587, 6812) then m114001=-4;
/* One partner, two loops delete second loop two*/
if pubid in (4824, 7605 , 7747,8208,3835,1873,8627
,8953 ) then do;
m31002y=-4;
m31002m=-4;
m46702=-4;
m48002y=-4;
m48002m=-4;
p2=-4;
m8200211y=-4;
m8200211m=-4;
end;
if pubid=8627 then m46701=1;
/* legeal separation month before stopping live togeher month
so set up stopping cohabitation month equal to legal separation month or divorce
month*/
if pubid= 3488 then m48001m=4;
if pubid=6665 then m48001m=5;
if pubid in (3438 ) then do;
m48001m=m8100111m;
m48001y=m8100111y;
m46701=0;
end;
if pubid in ( 3936) then do;
m48001m=m8100111m;
m48001y=m8100111y;
m47001=0;
end;
if pubid in (5803) then do;
m48001m=m8100111m;
m48001y=m8100111y;
m47001=0;
m7900111=-4;
m8100111m=-4;
m8100111y=-4;
end;
if pubid in ( 1818, 7803,4867, 4886, 5027 ,8756,464,
5902) then do;
m48001m=m920011m;
m48001y=m920011y;
m920011m=-4;
m920011y=-4;
m46701=0;
m45001=-4;
m47001=-4;
end;
/* Report end cohabitation day before dli*/
if pubid in
(298,
624,
821,
1436,
2559,
3750,
5321,
5535,
8096,
8100,
8370,
8627) then do;
m31001m=m31002m;
m31001y=m31002y;
m48001m=m48002m;
m48001y=m48002y;
p1=p2;
p2=-4;
m31002m=-4;
m31002y=-4;
m48002m=-4;
m48002y=-4;
m47001=m47002;
m47002=-4;
m46702=-4;
end;
if pubid=8627 then do;
p1=201;
end;
if pubid=8370 then do;
m48001m=-4;
m48001y=-4;
m7900111=1;
m8200111m=m8200211m;
m8200111y=m8200211y;
m7900211=-4;
m8200211m=-4;
m8200211y=-4;
end;
if pubid= 1948 then do;
m48001m=m700011m;
m48001y=m700011y;
end;
/* not married but report legal separation date*/
if pubid=3179 then do;
m540011=-4;
m560011m=-4;
m560011y=-4;
end;
if pubid=6688 then m48001m=m31002m;
array int_cmr {7} int_cmr1 - int_cmr7;
/* Set up initial marital status by using dli created variables. */
if cmarsta7 ne -5 then do;
prevmsta=MARSTAT7;
prevcmst=CMARSTA7;
mar_ttl=mar_ttl7;
coh_ttl=coh_ttl7;
premar_ttl=mar_ttl7;
precoh_ttl=coh_ttl7;
prevmary=FMAR_Yr7;
prevmarm=FMAR_Mr7;
prvmarcm=fmarmr7;
prevcohm=FCOH_Mr7;
prevcohy=FCOH_Yr7;
prvcohcm=FCOHCMr7;
dliym=int_yr7*100+int_mr7;
dlicm=(int_yr7-1980)*12+int_mr7;
mardli=marstat7;
end;
if cmarsta7=-5 and cmarsta6 ne -5 then do;
prevmsta=MARSTAT6;
prevcmst=CMARSTA6;
mar_ttl=mar_ttl6;
coh_ttl=coh_ttl6;
premar_ttl=mar_ttl6;
precoh_ttl=coh_ttl6;
prevmary=FMAR_Yr6;
prevmarm=FMAR_Mr6;
prvmarcm=fmarmr6;
prevcohm=FCOH_Mr6;
prevcohy=FCOH_Yr6;
prvcohcm=FCOHCMr6;
dliym=int_yr6*100+int_mr6;
dlicm=(int_yr6-1980)*12+int_mr6;
mardli=marstat6;
end;
/*Round 6 noninterview, go to round 5*/
else if cmarsta7=-5 and cmarsta6=-5 and cmarsta5 ne -5 then do;
prevmsta=MARSTAT5;
prevcmst=CMARSTA5;
mar_ttl=mar_ttl5;
coh_ttl=coh_ttl5;
premar_ttl=mar_ttl5;
precoh_ttl=coh_ttl5;
prevmary=FMAR_Yr5;
prevmarm=FMAR_Mr5;
prvmarcm=fmarmr5;
prevcohm=FCOH_Mr5;
prevcohy=FCOH_Yr5;
prvcohcm=FCOHCMr5;
dliym=int_yr5*100+int_mr5;
dlicm=(int_yr5-1980)*12+int_mr5;
mardli=marstat5;
end;
/*Round 5 noninterview, go to round 4*/
else if cmarsta7=-5 and cmarsta6=-5 and cmarsta5=-5 and cmarsta4 ne -5 then do;
prevmsta=MARSTAT4;
prevcmst=CMARSTA4;
premar_ttl=mar_ttl4;
precoh_ttl=coh_ttl4;
mar_ttl=mar_ttl4;
coh_ttl=coh_ttl4;
prevmary=FMAR_Yr4;
prevmarm=FMAR_Mr4;
prvmarcm=fmarmr4;
prevcohm=FCOH_Mr4;
prevcohy=FCOH_Yr4;
prvcohcm=FCOHCMr4;
dliym=int_yr4*100+int_mr4;
dlicm=(int_yr4-1980)*12+int_mr4;
mardli=marstat4;
end;
/*Round 4 noninterview, go to round 3*/
else if cmarsta7=-5 and cmarsta6=-5 and cmarsta5=-5 and cmarsta4=-5 and cmarsta3
ne -5 then do;
prevmsta=marstat3;
prevcmst=cmarsta3;
premar_ttl=mar_ttl3;
precoh_ttl=coh_ttl3;
mar_ttl=mar_ttl3;
coh_ttl=coh_ttl3;
prevmary=FMAR_Yr3;
prevmarm=FMAR_Mr3;
prvmarcm=fmarmr3;
prevcohm=FCOH_Mr3;
prevcohy=FCOH_Yr3;
prvcohcm=FCOHCMr3;
dliym=int_yr3*100+int_mr3;
dlicm=(int_yr3-1980)*12+int_mr3;
mardli=marstat3;
end;
/*Round 3 noninterview, go to round 2*/
else if cmarsta7=-5 and cmarsta6=-5 and cmarsta5=-5 and cmarsta4=-5 and
cmarsta3=-5 and cmarsta2 ne -5 then do;
prevmsta=marstat2;
prevcmst=cmarsta2;
premar_ttl=mar_ttl2;
precoh_ttl=coh_ttl2;
mar_ttl=mar_ttl2;
coh_ttl=coh_ttl2;
prevmary=FMAR_Yr2;
prevmarm=FMAR_Mr2;
prvmarcm=fmarmr2;
prevcohm=FCOH_Mr2;
prevcohy=FCOH_Yr2;
prvcohcm=FCOHCMr2;
dliym=int_yr2*100+int_mr2;
dlicm=(int_yr2-1980)*12+int_mr2;
mardli=marstat2;
end;
/*Round5 round4 round3 and round 2 noninterview, go to round 1*/
else if cmarsta7=-5 and cmarsta6=-5 and cmarsta5=-5 and cmarsta4=-5 and
cmarsta3=-5 and cmarsta2=-5 and cmarsta1 ne -5 then do;
prevmsta=marstat1;
prevcmst=cmarsta1;
premar_ttl=mar_ttl1;
precoh_ttl=coh_ttl1;
mar_ttl=mar_ttl1;
coh_ttl=coh_ttl1;
prevmary=FMAR_Yr1;
prevmarm=FMAR_Mr1;
prvmarcm=fmarmr1;
prevcohm=FCOH_Mr1;
prevcohy=FCOH_Yr1;
prvcohcm=FCOHCMr1;
dliym=int_yr1*100+int_mr1;
dlicm=(int_yr1-1980)*12+int_mr1;
mardli=marstat1;
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) or int_m in(-1, -2, -3) then do;
doicm=-3;
iym=-3;
end;
/* Partner flag to check previous partner or new partner*/
array partner {4, 7} p1r1-p1r7 p2r1-p2r7 p3r1-p3r7 p4r1-p4r7;
do i=1 to 4;
do j=1 to 7;
if (p1=partner{i,j}
or p2=partner{i,j}
or p3=partner{i,j}) and partner{i,j}>0 then flagp=1;
end;
end;
if pubid in (518,2502) then flagp=.;
/* create varible START, start a month after dl1. */
if bdate_y>0 and bdate_m>0 then b14cm=(bdate_y+14-1980)*12+bdate_m;
start=dlicm+1;
/*if (prevmary<=0 or prevcohy<=0 or precoh_ttl or premar_ttl) then
start=b14cm;*/
/* set up arrays for r7 partner and spouse*/
array r7mars (l) r7mars001-r7mars307;
array r7co (l) r7co001-r7co307;
array r7link (l) r7link001-r7link307;
array r7pt (l) r7pt001-r7pt307;
array r7sp (l) r7sp001-r7sp307;
/* set up arrays for r7 partner and spouse*/
array r8pt (l) r8pt001-r8pt307;
array r8sp (l) r8sp001-r8sp307;
/* set up marriage arrays for each partner in four period*/
array maf (l) maf001-maf307;
array mas (l) mas001-mas307;
array mat (l) mat001-mat307;
array mafour (l) mafour001-mafour307;
array mbf (l) mbf001-mbf307;
array mbs (l) mbs001-mbs307;
array mbt (l) mbt001-mbt307;
array mbfour (l) mbfour001-mbfour307;
array mcf (l) mcf001-mcf307;
array mcs (l) mcs001-mcs307;
array mct (l) mct001-mct307;
array mcfour (l) mcfour001-mcfour307;
array mdf (l) mdf001-mdf307;
array mds (l) mds001-mds307;
array mdt (l) mdt001-mdt307;
array mdfour (l) mdfour001-mdfour307;
/* array for partner a in first sec third and fourth period*/
array maa (l) maa001-maa307;
array mbb (l) mbb001-mbb307;
array mcc (l) mcc001-mcc307;
array mdd (l) mdd001-mdd307;
/* set up arrays for mar total*/
array mal (l) mal001-mal307;
/* set up cohabition arrays for each partner in four period*/
array cohaf (l) cohaf001-cohaf307;
array cohas (l) cohas001-cohas307;
array cohat (l) cohat001-cohat307;
array cohafour (l) cohafour001-cohafour307;
array cohbf (l) cohbf001-cohbf307;
array cohbs (l) cohbs001-cohbs307;
array cohbt (l) cohbt001-cohbt307;
array cohbfour (l) cohbfour001-cohbfour307;
array cohcf (l) cohcf001-cohcf307;
array cohcs (l) cohcs001-cohcs307;
array cohct (l) cohct001-cohct307;
array cohcfour (l) cohcfour001-cohcfour307;
array cohdf (l) cohdf001-cohdf307;
array cohds (l) cohds001-cohds307;
array cohdt (l) cohdt001-cohdt307;
array cohdfour (l) cohdfour001-cohdfour307;
array cohaa (l) cohaa001-cohaa307;
array cohbb (l) cohbb001-cohbb307;
array cohcc (l) cohcc001-cohcc307;
array cohdd (l) cohdd001-cohdd307;
/*cohabition totla*/
array cohal (l) cohal001-cohal307;
/*arrays for R8 event history */
array mars (l) mars001-mars307;
array cohh (l) cohh001-cohh307;
array link (l) link001-link307;
array dual (l) dual001-dual307;
do l=start to 307;
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 M700013Y;
array yscb (t) M31002Y M700021Y yscb3 yscb4;
array yscc (t) M31003Y yscc2 yscc3 yscc4;
array yscd (t) yscd1 yscd2 yscd3 yscd4;
array msca (t) M31001M M700011M M700012M M700013M;
array mscb (t) M31002M M700021M mscb3 mscb4;
array mscc (t) M31003M mscc3 mscb3 mscb4;
array mscd (t) mscd1 mscd2 mscd3 mscd4;
array ysc (p) ysca yscb yscc yscd;
array msc (p) msca mscb mscc mscd;
/*year end cohabitating (not continuous)*/
array yeca (t) M48001Y M920011Y M920012Y M920013Y ;
array yecb (t) M48002Y M920021Y yecb3 yecb4;
array yecc (t) M48003Y yecc2 yecc3 yecc4;
array yecd (t) yecd1 yecd2 yecd3 yecd4;
array yec (p) yeca yecb yecc yecd;
/*month end cohabitating (not continuous)*/
array meca (t) M48001M M920011M M920012M M920013M;
array mecb (t) M48002M M920021M mecb3 mecb4;
array mecc (t) M48003M mecc2 mecc3 mecc4;
array mecd (t) mecd1 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) M46702 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) cbegd1 cbegd2 cbegd3 cbegd4;
array cbeg (p) cbega cbegb cbegc cbegd;
/* cohabitation continuous - since start (after dli date)*/
array cbeg2a (t) M910011 M910012 M910013 M910014;
array cbeg2b (t) M910021 M910022 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) mbegd1 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 howa22 howa23 howa24;
array howb1 (t) m7900211 howb12 howb13 howb14;
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 hyma12 hyma13 hyma14;
array hmma1 (t) M570011m hmma12 hmma13 hmma14;
array hyma2 (t) m8200111y hyma22 hyma23 hyma24;
array hmma2 (t) m8200111m hmma22 hmma23 hmma24;
array hymb1 (t) m8200211y hymb12 hymb13 hymb14;
array hmmb1 (t) m8200211m hmmb12 hmmb13 hmmb14;
array hyma4 (t) m10100111y hyma42 hyma43 hyma44;
array hmma4 (t) m10100111m 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) M560011Y M560012Y hyssa13 hyssa14;
array hmssa1 (t) M560011M M560012M hmssa13 hmssa14;
array hyssa2 (t) M8100111Y M8100211Y hyssa23 hyssa24;
array hmssa2 (t) M8100111M M8100211M 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;
/*5-14-02 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;
/* 6-23-02 I am going to add this in R5*/
/* month and year relationship ended */
array eyra (t) M117001Y eyra2 eyra3 eyra4;
array eyrb (t) M117002Y 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) M117002M 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) fstatd1 fstatd2 fstatd3 fstatd4;
/*collapse married into array*/
array fstat (p) fstata fstatb fstatc fstatd;
do l=1 to dlicm;
if l=dlicm then do;
cohhr7=r7co;
marsr7=r7mars;
end;
end;
/* Stop cohabiting at dli then back live with previous partner */
if (0<p1<801 or 0<p2<801) and (cohhr7=. or cohhr7=-4) and (m31001y>=-4 or
m31002y>=-4)
and (m47001=1 or m47002=1 or m47003=1 or m46701=1 or m46702=1) then
flagbackold=1;
if cohhr7=-4 and 0<p1<800 and (m31001y=-4 and m31001m=-4) and m48001y>-4 then
flagbackold1=1;
if flagbackold=1 or flagbackold1=1 then do;
do l=169 to 295;
cohhr7=max(of r7co169-r7co295);
end;
end;
/* stop cohabiting at dli*/
if pubid in (624,5535,2559,6095) then cohhr7=-4;
if pubid=864 then cohhr7=102;
if pubid=6665 then cohhr7=101;
if pubid=8627 then cohhr7=201;
if pubid=2448 then cohhr7=101;
if pubid=1428 then cohhr7=101;
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;
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 setting 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;
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 setting it to dli. */
/* If a start year and month are missing,then setting 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 -4<mec<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 (cdli=1 or cbeg=1) then cemc=doicm;
if m910011=1 then cemca2=doicm;
if m910012=1 then cemca3=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 cohhr7 gt 200 then imars=1;
else if mbeg=-4 and cmars ne . and cmars ne -4 and 100 lt cohhr7 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 mardli=7 or mardli=8 then do;
ymss=dliym;
csms=(round(ymss,100)-198000)*.12+(ymss-round(ymss,100));
end;
if csms>0 then cems=doicm;
if csmm>0 then cemm=doicm;
do l=start to doicm; /* 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>0 and hmm>0 then do;
cmars=1;
imars=1;
ymsm=hym*100+hmm;
end;
if -2 le how le -1 and (hym>-4 and hmm>-4 )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(ymsm,100));
/* Marriage ends in legal separation */
if how=3 and hyss>0 and hmss>0 then do;
cmars=2;
imars=2;
ymss=(hyss*100)+hmss;
end;
/* Marriage ends in divorce */
if how=4 and hyss>0 and hmss>0 then do;
cmars=3;
imars=3;
ymss=(hyss*100)+hmss;
end;
/* Marriage ends in divorce */
if how=5 and hyss>0 and hmss>0 then do;
cmars=3;
imars=3;
ymss=(hyss*100)+hmss;
end;
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;
/* YMAR-114000 (fstat in the arrays) collects current status of the
relationship. */
if fstat=2 and eyr>0 and emo>0 then do;
cmars=0; /* fstat=annulment, which translates into never married in collapsed
mar. status */
imars=0;
csms=(eyr-1980)*12 + emo;
end;
if fstat=2 and (-4<eyr<0 or -4<emo<0) then do;
cmars=0;
imars=0;
csms=doicm;
end;
if fstat=3 and eyr>0 and emo>0 then do;
cmars=2; /* separation */
imars=2;
csms=(eyr-1980)*12 + emo;
cems=doicm;
if how=1 and hym>0 and hmm>0 then do;
cmars=1;
imars=1;
ymsm=hym*100+hmm;
cmarsa1=1; /* added in R7 Three R's married Round 7, then legal separated
several month late*/
imarsa1=1;
end;
end;
if fstat=3 and (-4<eyr<0 or -4<emo<0) then do;
cmars=2;
imars=2;
csms=doicm;
cems=doicm;
end;
if fstat=4 and eyr>0 and emo>0 then do;
cmars=3;
imars=3; /* divorce */
csms=(eyr-1980)*12 + emo;
cems=doicm;
end;
if fstat=4 and (-4<eyr<0 or -4<emo<0) then do;
cmars=3;
imars=3; /* divorce */
csms=doicm;
cems=doicm;
end;
if fstat=5 and eyr>0 and emo>0 and csmm>0 then do;
cmars=4;
imars=4; /* widowed */
csms=(eyr-1980)*12 + emo;
widow=1;
end;
if fstat=5 and (-4<eyr<0 or -4<emo<0) and csmm>0 then do;
cmars=4;
imars=4;
csms=doicm;
widow=1;
end;
if csms>0 then cems=doicm;
if -4<fstat<0 then cmars=fstat;
if cemc>=start and (mardli=3 or mardli=4) and p2>800 then do; /*add in R8
9-19-05*/
cemm=csmsa1;
if csmmb1>0 then cemmb1=doicm;
end;
/* divorce in current Round then had new partner
or had partner in current round then divorced later*/
if cemc>=start and (mardli=3 or mardli=4) and p2>800 then
do;
do l=start to doicm ;
if start<=l<csmsa1 then do;
maf=1;
end;
if csmsa1=. and start<=l<csmcb1 then do;
maf=1;
end;
end;
end;
end;
/* find the cases stop cohabitation before dil or at dli*/
if 0<cemc<=dlicm then flagend=1;
/* Now that the start & end dates of marriages/cohabs are created, we can place
that information into the
array. The information from the last week is used to create the variable for
marital status and collapsed marital
status. */
C=0;
do l=1 to doicm; /* loop 1 */ /* start*/
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 = 2 and csms>0 and cems>0 and csms le c le cems then mal=2;
if imars = 2 and csms>0 and cems>0 and csms le c le cems then m=2;
if cmars = 3 and csms>0 and cems>0 and csms le c le cems then mal=3;
if imars = 3 and csms>0 and cems>0 and csms le c le cems then m=3;
if cmars = 4 and csms>0 and cems>0 and csms le c le cems then mal=4;
if imars = 4 and csms>0 and cems>0 and csms le c le cems then m=4;
if -2 le cmars le -1 then mal=cmars;
if -2 le imars le -1 then m=imars;
if cmars=0 then mal=cmars;
if c=doicm then do;
if mal in (-1,-2) then mars=-3;
if mal=0 and cohal=1 then mars=1;
if mal=0 and cohal=0 then mars=2;
if mal=1 and cohal=1 then mars=3;
if mal=1 and cohal=0 then mars=4;
if mal=2 and cohal=1 then mars=5;
if mal=2 and cohal=0 then mars=6;
if mal=3 and cohal=1 then mars=7;
if mal=3 and cohal=0 then mars=8;
if mal=4 and cohal=1 then mars=9;
if mal=4 and cohal=0 then mars=10;
marstat=mars;
end;
end;
end;/* end of loop t*/
end;/*end of loop p*/
/****end;****/
/* Create collapsed marital status from marital status.*/
if 1 le marstat le 2 then cmarstat=0;
if 3 le marstat le 4 then cmarstat=1;
if 5 le marstat le 6 then cmarstat=2;
if 7 le marstat le 8 then cmarstat=3;
if 9 le marstat le 10 then cmarstat=4;
if -2 le marstat le -1 then cmarstat=marstat;
if pubid= 2156 then do;
prevcohy=2003;
prevcohm=5;
prvcohcm=281;
end;
if pubid= 6039 then do;
prevcohy=2003;
prevcohm=7;
prvcohcm=283;
end;
if marstat=-3 then cmarstat=-3;
if csmca1>0 then do;
cohcm=csmca1;
end;
if csmca1>0 and csmca2>0 and csmca1<csmca2 then do;
cohcm=csmca1;
end;
if csmca1>0 and csmca2>0 and csmca1>csmca2 then do ;
cohcm=csmca2;
end;
if csmca1>0 and csmca1<csmcb1 then do ;
cohcm=csmca1;
end;
if csmcb1>0 and csmca1>csmcb1 then do;
cohcm=csmcb1;
end;
if csmcb1>0 and -4<csmca1<0 and prevcohy=-4 then do;
cohcm=csmcb1;
end;
if csmma1>0 then do
marcm=csmma1;
end;
if csmma1>0 and csmma2>0 and csmma1> csmma2 then do ;
marcm=csmma2;
end;
if csmma1>0 and csmmb1>0 and csmma1> csmmb1 then do ;
marcm=csmmb1;
end;
r8marcm=marcm;
r8cohcm=cohcm;
if csmma1<0 and csmmb1>0 then do;
marcm=csmmb1;
end;
r8marcm=marcm;
r8cohcm=cohcm;
/* For respondents,their Round 1 c.v. for first marriage date post-dates a
marriage they report in Round 2.
We need the continuous month min of these two dates. */
if dlimarcm>0 then marcm=dlimarcm;
if r8marcm>0 then marcm=r8marcm;
if dlimarcm>0 and r8marcm>0 then do;
marcm=dlimarcm;
end;
array cvcm cohcm marcm;
array cvy cohy mary;
array cvm cohm marm;
do over cvcm;
if 301 le cvcm le 312 then do;
cvy=2005;
cvm=cvcm-300;
end;
if 289 le cvcm le 300 then do;
cvy=2004;
cvm=cvcm-288;
end;
if 277 le cvcm le 288 then do;
cvy=2003;
cvm=cvcm-276;
end;
if 265 le cvcm le 276 then do;
cvy=2002;
cvm=cvcm-264;
end;
if 253 le cvcm le 264 then do;
cvy=2001;
cvm=cvcm-252;
end;
if 241 le cvcm le 252 then do;
cvy=2000;
cvm=cvcm-240;
end;
if 229 le cvcm le 240 then do;
cvy=1999;
cvm=cvcm-228;
end;
if 217 le cvcm le 228 then do;
cvy=1998;
cvm=cvcm-216;
end;
if 205 le cvcm le 216 then do;
cvy=1997;
cvm=cvcm-204;
end;
if 193 le cvcm le 204 then do;
cvy=1996;
cvm=cvcm-192;
end;
if 181 le cvcm le 192 then do;
cvy=1995;
cvm=cvcm-180;
end;
if 169 le cvcm le 180 then do;
cvy=1994;
cvm=cvcm-168;
end;
if 157 le cvcm le 168 then do;
cvy=1993;
cvm=cvcm-156;
end;
if cvcm=. then do;
cvcm=-4;
cvy=-4;
cvm=-4;
end;
end;
/*to correct for those who don't know the start month for cohabiting*/
if -4<m31001m<0 and m31001y>0 then do;
cohy=m31001y;
cohm=-3;
cohcm=-3;
end;
/*to correct for those who don't know the start year for cohabiting*/
if -4<m31001y<0 and m31001m>0 then do;
cohm=m31001m;
cohy=-3;
cohcm=-3;
end;
/*to correct for those who don't know the start year and month for cohabiting*/
if -4<m31001m<0 and -4<m31001y<0 and prvcohcm=-4 then do;
cohm=-3;
cohcm=-3;
cohy=-3;
end;
if (-4<m31001m<0 and -4<m31001y<0) and (m31002y>0 and m31002y>0 ) and
prvcohcm=-4 then do;
cohm=-3;
cohcm=-3;
cohy=-3;
end;
if ((-4<m31002m<0 and -4<m31002y<0) or (-4<m700011y<0 and -4<m700011m<0))
and (m31001y>0 and m31001m>0 ) then do;
cohm=m31001m;
cohcm=csmca1;
cohy=m31001y;
end;
if -4<m31001m<0 and -4<m31001y<0 and prvcohcm=-4 and m700011m>0 and m700011y>0
then do;
cohm=m700011m;
cohy=m700011y;
cohcm=csmca2;
end;
if m45001=1 and -4<m31001m<0 and -4<m31001y<0 and prvcohcm=-4 and prevmarm=-4
then do; /* need to prove in R8*/
cohm=-4;
cohcm=-4;
cohy=-4;
marcm=-3;
mary=-3;
marm=-3;
end;
/*if old date present and don't deny then use old date*/
if prevcohm ne -4 then do;
cohcm= prvcohcm;
cohy=prevcohy;
cohm= prevcohm;
end;
if prevmarm ne -4 then do;
marcm=prvmarcm;
mary=prevmary;
marm=prevmarm;
end;
if prevcohm =-4 and prevmarm>0 and (m31001y=-4 or m31002y=-4) then do;
cohcm= -4;
cohy=-4;
cohm= -4;
end;
if prevcohm =-4 and prevmarm>0 and (m31001y>-4 and m31002y>-4) then do;
cohcm=csmca1;
cohy=m31001y;
cohm=m31001m;
end;
if prevcohm =-4 and prevmarm>0 and ( m31002y>-4 and m31001y=-4) then
do;/*11-13-2005*/
cohcm=csmcb1;
cohy=m31002y;
cohm=m31002m;
end;
if prevcohm =-3 then do ;
cohcm= prvcohcm;
cohy= prevcohy;
cohm= prevcohm;
end;
if prevcohm =-3 and prevcohy=-3 and m31001y>0 and m31001m>0 then do;
cohcm= csmca1;
cohy=m31001y;
cohm= m31001m;
end;
if prevcohm =-4 and m31001y=-4 and m31002y=-4 and m31003y=-4 then do ;
cohcm= prvcohcm;
cohy= prevcohy;
cohm= prevcohm;
end;
if prevmarm=-3 then do;
marcm=prvmarcm;
mary=prevmary;
marm=prevmarm;
end;
if prevmarm=-3 and m8200111y>0 and m8200111m>0 then do;
marcm=csmma1;
mary=m8200111y;
marm=m8200111m;
end;
else if prevmarm=-3 and m45001=1 then do;
marcm=csmma1;
mary=m31001y;
marm=m31001m;
end;
if (-4<m8200111y<0 and m8200111m>0 ) and prvmarcm=-4 then do; /*11-16-05*/
marcm=-3;
mary=-3;
marm=m8200111m;
end;
if (-4<m8200211y<0 and m8200211m>0 ) and prvmarcm=-4 then do; /*11-16-05*/
marcm=-3;
mary=-3;
marm=m8200211m;
end;
/*Marital status for event history*/
do l=start to doicm;
if -2 le mal le -1 then mars=-3;
if mal=0 and cohal=1 then mars=1;
if mal=0 and cohal=0 then mars=0;
if mal=1 and cohal=1 then mars=2;
if mal=1 and cohal=0 then mars=2;
if mal=2 and cohal=1 then mars=3;
if mal=2 and cohal=0 then mars=3;
if mal=3 and cohal=1 then mars=4;
if mal=3 and cohal=0 then mars=4;
if mal=4 and cohal=1 then mars=5;
if mal=4 and cohal=0 then mars=5;
end;
*For the documentation except the marital status;
do l=start to doicm;
if cohaf=1 or cohas=1 or cohat=1 or cohafour=1 then cohaa=1;
if cohbf=1 or cohbs=1 or cohbt=1 or cohbfour=1 then cohbb=1;
if cohcf=1 or cohcs=1 or cohct=1 or cohcfour=1 then cohcc=1;
if cohdf=1 or cohds=1 or cohdt=1 or cohdfour=1 then cohdd=1;
if maf=1 or mas=1 or mat=1 or mafour=1 then maa=1;
if mbf=1 or mbs=1 or mbt=1 or mbfour=1 then mbb=1;
if mcf=1 or mcs=1 or mct=1 or mcfour=1 then mcc=1;
if mdf=1 or mds=1 or mdt=1 or mdfour=1 then mdd=1;
end;
/* Mar-Cohabitation;*/
do l=start to doicm;
if cohdd=1 then cohh=104;
if cohcc=1 then cohh=103;
if cohbb=1 then cohh=102;
if cohaa=1 then cohh=101;
if mdd=1 then cohh=204;
if mcc=1 then cohh=203;
if mbb=1 then cohh=202;
if maa=1 then cohh=201;
end;
/* Mar_Dual */
do l=start to doicm;
if cohh>0 and cohh ne 204 and cohh ne 104 and cohdd=1 then dual=104;
if cohh>0 and cohh ne 204 and cohh ne 104 and mdd=1 then dual=204;
if cohh>0 and cohh ne 203 and cohh ne 103 and cohcc=1 then dual=103;
if cohh>0 and cohh ne 203 and cohh ne 103 and mcc=1 then dual=203;
if cohh>0 and cohh ne 202 and cohh ne 102 and cohbb=1 then dual=102;
if cohh>0 and cohh ne 202 and cohh ne 102 and mbb=1 then dual=202;
end;
*Mar_Partner_Link;
do l=1 to doicm;
if cohcc=1 or mcc=1 then link=p3;
if cohbb=1 or mbb=1 then link=p2;
if cohaa=1 or maa=1 then link=p1;
end;
if doicm=-5 then do;
do l=start to doicm;
mars=-4;
cohh=-4;
dual=-4;
link=-4;
end;
end;
nump7=precoh_ttl;
nums7=premar_ttl;
if (nump7=. or nump7<0) then nump7=0;/*11-7-03*/
if (nums7=. or nums7<0) then nums7=0;/*11-7-03*/
numr7=max(nump7,nums7);
/* Add the parters and spouses from round 1 to round 7*/
do l=start to 307;
if cohh>0 and 100<cohh<200 then cohh=cohh+nump7;
else if cohh>0 and cohh>200 then cohh=cohh+nums7;
if dual>0 and numr7>0 then dual=dual+numr7;
end;
*Find the number of partners and spouses in round 8;
do l=start to 307;
if 100 lt cohh lt 200 then r8pt=cohh-100;
if cohh gt 200 then r8sp=cohh-200;
end;
/* If the respondent cohabited with the partner or spouse from last interview,
do the following change;*/
if 100 lt cohhr7 lt 200 and flagp=1
then do;
do l=start to doicm;
if 100 lt cohh lt 200 and r8pt=min(of r8pt169-r8pt307) then cohh=cohhr7;
else if 100 lt cohh lt 200 then cohh=cohh-1;
if cohh gt 200 and r8sp=min(of r8sp169-r8sp307) then cohh=200+(cohhr7-100);
else if cohh gt 200 then cohh=cohh-1;
if 100 lt dual lt 200 and r8pt=min(of r8pt169-r8pt307) then dual=cohhr7;
else if 100 lt dual lt 200 then cohh=dual-1;
if dual gt 200 and r8sp=min(of r8sp169-r8sp307) then dual=200+(cohhr7-100);
else if dual gt 200 then dual=dual-1;
end;
end;
if cohhr7>200 and flagp=1
then do;
do l=start to doicm;
if cohh gt 200 and r8sp=min(of r8sp169-r8sp307) then cohh=cohhr7;
else if cohh gt 200 then cohh=cohh-1;
if 100 lt cohh lt 200 and r8pt=min(of r8sp169-r8sp307) then
cohh=100+(cohhr7-200);
else if 100 lt cohh lt 200 then cohh=cohh-1;
if dual gt 200 and r8sp=min(of r8sp169-r8sp307) then dual=cohhr7;
else if dual gt 200 then dual=dual-1;
if 100 lt dual lt 200 and r8pt=min(of r8pt169-r8pt307) then
dual=100+(cohhr7-200);
else if 100 lt dual lt 200 then dual=dual-1;
end;
end;
do l =start to doicm;
if dual=101 or dual=102 or dual=103 or dual=104 then r8dual=1;
else if cohh=101 and r8dual ne 1 then r8dual=0;
else if cohh=102 and r8dual ne 1 then r8dual=0;
else if cohh=103 and r8dual ne 1 then r8dual=0;
else if cohh=104 and r8dual ne 1 then r8dual=0;
else if cohh=201 and r8dual ne 1 then r8dual=0;
else if cohh=202 and r8dual ne 1 then r8dual=0;
else if cohh=203 and r8dual ne 1 then r8dual=0;
else if cohh=204 and r8dual ne 1 then r8dual=0;
else if r8dual ne 1 and r8dual ne 0 then r8dual=-4;
end;
if r8dual=. then r8dual=-4;
*Find the number of partner and spouses in round 8;
do l=start to doicm;
if 100 lt cohh lt 200 then r8pt=cohh-100;
if cohh gt 200 then r8sp=cohh-200;
end;
/*pick up max number of total mar and total cohh*/
nump8=max(of r8pt169-r8pt307);
nums8=max(of r8sp169-r8sp307);
numr8=max(nump8,nums8);
coh_ttl=nump8;
mar_ttl=nums8;
if nump8=. then coh_ttl=precoh_ttl;
if nums8=. then mar_ttl=premar_ttl;
if p1=-4 and p2=-4 and p3=-4 then do;
coh_ttl=precoh_ttl;
mar_ttl=premar_ttl;
end;
/* for R's first time cohh and married at same time */
do p=1 to 4; /* loop for p */
do t=1 to 4; /* loop for t */
if mbeg=1 and Mar_ttl>0
and precoh_ttl<=0 and prvcohcm<0 then do;
coh_ttl=0;
cohcm=-4;
cohy=-4;
cohm=-4;
end;
end;
end;
do p=1 to 4; /* loop for p */
do t=1 to 4; /* loop for t */
do i=1 to 4;
if ((3<=prevmsta<=4 and marstat>3 or prevmsta<3 and marstat>3 )
and yec>-4 and m700011y =-4 and p2=-4) or pubid= 159 then flagm=1;
if (mbeg=1 or 3<=prevmsta<=4 ) and yec>-4 and m700011y =-4
and p2=-4 and how=-4 and ( fstat=1 or fstat>5 )
then flagm=1;
else if (mbeg=1 or 3<=prevmsta<=4 ) and yec>-4 and m700011y >-4
and p2=-4 and how=-4
then flagm1=1;
else if flagm1=1 and m920011y>0 then flagm2=1;
if (csmm>cemc+1 or pubid=3350) then flagm=. and flagm1=. and flagm2=.;
if (flagm=1 or flagm1=1 or flagm2=1) and yec>0 and mec>0 then do;
endm=(yec*100)+mec;
cendm=((round(endm,100)-198000)*.12+(endm-round(endm,100)))-1;
/* married and stop cohibition at same month*/
if csmm=cemc then cendm=(round(endm,100)-198000)*.12+(endm-round(endm,100));
end;
end;
end;
end;
do l=start to doicm;
if flagm=1 and l>cendm and m47002 ne 1 and m47003 ne 1 then cohh=.;
if flagm1=1 and cemca1<l<csmca2 then cohh=.;
if flagm2=1 then do ;
if cemca1<l<csmca2 then cohh=.;
if csmca3=. and cemca2< l<=doicm then cohh=.;
end;
end;
do l=start to doicm;
if flagm2=1 and m920012y>0 then do ;
if cemca2< l<csmca3 then cohh=.;
if cemca3< l<csmca4 then cohh=.;
if cemca4< l<=doicm then cohh=.;
end;
end;
do l=start to doicm;
if (3<=prevmsta<=4 and p2>800) then do;
if cemca1<l<csmcb1 then cohh=.;
end;
end;
/* New partner but does not have cohabitation data*/
/*dual*/
if pubid in ( 4387,663 , 4007 ) then do;
do l=start to doicm;
if 0<cohh<200 then cohh=cohh+1;
if pubid=663 then link=801;
end;
if coh_ttl>0 then coh_ttl=coh_ttl+1;
end;
if pubid=4007 then do;
do l=291 to doicm;
link=801;
end;
end;
if pubid =2653 then do;
do l=290 to 292;
cohh=.;
end;
end;
if pubid= 5677 then marstat=4;
if pubid=6305 then do;
do l=296;
link=801;
cohh=102;
end;
end;
if pubid in (7192,5811) then do;
do l=start to doicm;
cohh=cohh+1;
end;
coh_ttl=coh_ttl+1;
end;
if pubid=6392 then do;
do l=297 to doicm;
cohh=201;
end;
marstat=3;
end;
if pubid=159 then do;
do l=start to doicm;
if cohh=202 then cohh=201;
end;
mar_ttl=1;
end;
if pubid= 7748 then do;
cohcm=-4;
cohm=-4;
cohy=-4;
end;
/* no marriage data reported YMAR-3800.01~C
R8 comments R is answering these questions
from when they married since they haven't lived together*/
if pubid =4779 then do;
marstat=4;
cmarstat=1;
mar_ttl=1;
coh_ttl=2;
marcm=-3;
mary=-3;
marm=-3;
do l=start to doicm;
mars=2;
link=p1;
cohh=201;
end;
do l=doicm;
cohh=.;
end;
end;
do l=start to doicm;
if cohh>=202 and premar_ttl<=0 then do;
cohh=201;
mar_ttl=1;
end;
else if cohh>202 and premar_ttl>0 then do;
mar_ttl=premar_ttl+1;
cohh=200+mar_ttl;
end;
end;
if pubid= 2156 then do;
do l=start to doicm;
if cohh>200 then cohh=202;
end;
mar_ttl=2;
end;
if mar_ttl=-4 then mar_ttl=0;
if coh_ttl=-4 then coh_ttl=0; /*11-16-05*/
if coh_ttl=0 then do;
cohcm=-4;
cohm=-4;
cohy=-4;
end;
/* There are about 30 cases R's report marriage data twice with same partner
or married with new partner without reporting divorced data*/
do l=start to doicm;
if prevmsta>2 and 0<=mars<=1 then flagcheckmars=1;
if flagcheckmars=1 then do;
if 0<=mars<=1 then do;
mars=marsR7;
if marstat<3 and m47002=1 and p2>0 then do;
marstat=3;
cmarstat=1;
end;
else if m47002 ne 1 and p2>0 then do;
marstat=4;
cmarstat=1;
end;
end;
end;
end;
if mar_ttl=0 and prevmsta<3 and marstat>6 then flagdivo=1;
if mar_ttl=0 and prevmsta<3 and 4<marstat<7 then flagsep=1;
if pubid in
(193, 353, 438, 440, 441, 624, 986, 1343, 1356, 1419, 1436, 1576, 1705, 1735,
1928, 1987, 2004, 2323, 2529, 2559, 2795, 2845, 2849, 2903, 2970, 3102, 3321,
3332, 3427, 3442, 3608, 3685, 3778, 3803, 3811, 3825, 3979, 4035, 4046, 4061,
4236, 4255, 4276, 4316, 4350, 4352, 4353, 4495, 4692, 4862, 5047, 5284, 5285,
5304, 5324, 5387, 5417, 5448, 5535, 5556, 5587, 5609, 5651, 5775, 5845, 6039,
6095, 6146, 6168, 6169, 6188, 6199, 6299, 6464, 6575, 6750, 6786, 6880, 6932,
7153, 7168, 7192, 7213, 7392, 7443, 7464, 7530, 7611, 7633, 7681, 7770, 7839,
8095, 8096, 8368, 8370, 8522, 8534, 8556, 8562, 8596, 8611, 8637, 8781, 8968,
9018) then flagcheck=1;
/* If R's answer m620=3 in previous two Rounds, we coded Round 8 marstat status
as divorced*/
if flagcheck=1 and (m620r7=3 and m620=3 or m620=3 and m620r6=3 or m620=3 and
m620r5=3) and p1=-4 or pubid=8095 then do;
do l=start to doicm;
mars=4;
marstat=8;
cmarstat=3;
end;
end;
if flagcheck=1 and (m620r7=3 and m620=3 or m620=3 and m620r6=3 or m620=3 and
m620r5=3) and p1>0 and marstat<=5 then do;
do l=start to doicm;
marstat=7;
cmarstat=3;
mars=4;
end;
end;
/* if R's answer m620=3 in R8 and m620<3 in R7 or R's R's deny marriage. we
coded marstat status
in R8 as -3. We need to rechecked these cases in Round 9*/
if flagcheck=1 and ((m620r7<=2 and m620=3 )or m620=0) and prevmsta ne 5 and
prevmsta ne 6 then do;
do l=start to doicm;
mars=-3;
marstat=-3;
cmarstat=-3;
if link<0 then link=-3;
end;
end;
/* find spouse link*/
/* married in R6 and R7 have same spouse with R6. Then we keep R6 spouselink in
Round 8*/
/* marriedin Round 7 we keep round 7 spouse link in Round 8*/
if flagcheck=1 and ( m620=2 or m620=1 ) and (prevmsta =3 or prevmsta =4)
and ( marstat6 <3 or ( p1r6=p1r7 and marstat6=3 ))then do;
do l=start to doicm;
if link<0 then link=p1r7;
end;
end;
/* married before Round r6 or in R6*/
if flagcheck=1 and (m620=2 or m620=1 ) and (prevmsta =3 or prevmsta =4) and
marstat6 >2
then do;
do l=start to doicm;
if link<0 then link=-3;
end;
end;
do l=start to doicm;
if (3<=marstat<=4) and (3<=prevmsta<=4) and link=. then checklink=1;
if checklink=1 and link=. then link=p1;
if mars=. then checkmar=1;
end;
if pubid in (1385, 1436, 2559,4805, 5323, 5535) then do;
marstat=5;
cmarstat=3;
end;
if int_y>-4 then do;
do l=b14cm;
if (r7mars<=-4 or r7mars=. ) and start>b14cm then flagpfir=1;
end;
end;
if flagpfir=1 then do;
do l=b14cm to dlicm;
if (r7mars=. or r7mars<-3) then mars=0;
end;
end;
do l= 1 to dlicm;
cohh=-4;
link=-4;
if flagpfir ne 1 then do;
mars=-4;
end;
end;
if int_y=-5 then do;
marstat=-5;
cmarstat=-5;
cohcm=-5;
cohm=-5;
cohy=-5;
marcm=-5;
mary=-5;
marm=-5;
coh_ttl=-5;
mar_ttl=-5;
r8dual=-5;
end;
endsas;
Variables Created:
Variables Used
|
Name in Program |
Question Name on CD |
Name in Program |
Question Name on CD |
|
| CV01 | CV_CHILD_BIRTH_MONTH_01_2003 | BD02 | BIOADOPTCHILD_BDATE_02_D_2004 | |
| CV02 | CV_CHILD_BIRTH_MONTH_02_2003 | BM02 | BIOADOPTCHILD_BDATE_02_M_2004 | |
| CV03 | CV_CHILD_BIRTH_MONTH_03_2003 | BY02 | BIOADOPTCHILD_BDATE_02_Y_2004 | |
| CV04 | CV_CHILD_BIRTH_MONTH_04_2003 | BD03 | BIOADOPTCHILD_BDATE_03_D_2004 | |
| CV05 | CV_CHILD_BIRTH_MONTH_05_2003 | BM03 | BIOADOPTCHILD_BDATE_03_M_2004 | |
| CV06 | CV_CHILD_BIRTH_MONTH_06_2003 | BY03 | BIOADOPTCHILD_BDATE_03_Y_2004 | |
| DATE1MR7 | CV_CHILD_DEATH_DATE_01_M_2003 | BD04 | BIOADOPTCHILD_BDATE_04_D_2004 | |
| DATE1YR7 | CV_CHILD_DEATH_DATE_01_Y_2003 | BM04 | BIOADOPTCHILD_BDATE_04_M_2004 | |
| MONTH1R7 | CV_CHILD_DEATH_MONTH_01_2003 | BY04 | BIOADOPTCHILD_BDATE_04_Y_2004 | |
| STAT1R7 | CV_CHILD_STATUS_01_2003 | BD05 | BIOADOPTCHILD_BDATE_05_D_2004 | |
| STAT2R7 | CV_CHILD_STATUS_02_2003 | BM05 | BIOADOPTCHILD_BDATE_05_M_2004 | |
| STAT3R7 | CV_CHILD_STATUS_03_2003 | BY05 | BIOADOPTCHILD_BDATE_05_Y_2004 | |
| STAT4R7 | CV_CHILD_STATUS_04_2003 | BD06 | BIOADOPTCHILD_BDATE_06_D_2004 | |
| STAT5R7 | CV_CHILD_STATUS_05_2003 | BM06 | BIOADOPTCHILD_BDATE_06_M_2004 | |
| STAT5R7 | CV_CHILD_STATUS_06_2003 | BY06 | BIOADOPTCHILD_BDATE_06_Y_2004 | |
| STAT5R7 | CV_CHILD_STATUS_07_2003 | DEAD01 | BIOADOPTCHILD_DEAD_01_2004 | |
| status1 | YFER_1850_01_2004 | DEAD02 | BIOADOPTCHILD_DEAD_02_2004 | |
| status2 | YFER_1850_02_2004 | DEAD03 | BIOADOPTCHILD_DEAD_03_2004 | |
| status3 | YFER_1850_03_2004 | DEAD04 | BIOADOPTCHILD_DEAD_04_2004 | |
| status4 | YFER_1850_04_2004 | DEAD05 | BIOADOPTCHILD_DEAD_05_2004 | |
| status5 | YFER_1850_05_2004 | DEAD06 | BIOADOPTCHILD_DEAD_05_2004 | |
| status6 | YFER_1850_05_2004 | dm01 | BIOADOPTCHILD_DOD_01_M_2004 | |
| status7 | YFER_1850_05_2004 | dy01 | BIOADOPTCHILD_DOD_01_Y_2004 | |
| f4830_1 | YFER_4830_01_2004 | dm02 | BIOADOPTCHILD_DOD_02_M_2004 | |
| f4830_2 | YFER_4830_02_2004 | dy02 | BIOADOPTCHILD_DOD_02_Y_2004 | |
| f5900_1 | YFER_5900_01_2004 | dm03 | BIOADOPTCHILD_DOD_03_M_2004 | |
| f5900_2 | YFER_5900_02_2004 | dy03 | BIOADOPTCHILD_DOD_03_Y_2004 | |
| adopt1 | YFER_5850_01_2004 | bioid01 | BIOADOPTCHILD_ID_01_2004 | |
| adopt2 | YFER_5850_02_2004 | bioid02 | BIOADOPTCHILD_ID_02_2004 | |
| YFER12001 | YFER_1200_01_2004 | bioid03 | BIOADOPTCHILD_ID_03_2004 | |
| YFER12002 | YFER_1200_02_2004 | bioid04 | BIOADOPTCHILD_ID_04_2004 | |
| YFER12003 | YFER_1200_03_2004 | bioid05 | BIOADOPTCHILD_ID_05_2004 | |
| YFER12004 | YFER_1200_04_2004 | bioid06 | BIOADOPTCHILD_ID_05_2004 | |
| YFER12005 | YFER_1200_05_2004 | RESIDE01 | BIOADOPTCHILD_RESIDE_01_2004 | |
| YFER12005 | YFER_1200_06_2004 | RESIDE02 | BIOADOPTCHILD_RESIDE_02_2004 | |
| YFER13001D | YFER_1300_01_D_2004 | RESIDE03 | BIOADOPTCHILD_RESIDE_03_2004 | |
| YFER13001M | YFER_1300_01_M_2004 | RESIDE04 | BIOADOPTCHILD_RESIDE_04_2004 | |
| YFER13001Y | YFER_1300_01_Y_2004 | RESIDE05 | BIOADOPTCHILD_RESIDE_05_2004 | |
| YFER13002D | YFER_1300_02_D_2004 | RESIDE06 | BIOADOPTCHILD_RESIDE_06_2004 | |
| YFER13002M | YFER_1300_02_M_2004 | biouid01 | BIOADOPTCHILD_UID_01_2004 | |
| YFER13002Y | YFER_1300_02_Y_2004 | biouid02 | BIOADOPTCHILD_UID_02_2004 | |
| adopt1 | YFER_5850_01_2004 | biouid03 | BIOADOPTCHILD_UID_03_2004 | |
| adopt2 | YFER_5850_02_2004 | biouid04 | BIOADOPTCHILD_UID_04_2004 | |
| adopt3 | YFER_5850_03_2004 | biouid05 | BIOADOPTCHILD_UID_05_2004 | |
| adopt4 | YFER_5850_04_2004 | biouid06 | BIOADOPTCHILD_UID_06_2004 | |
| BD01 | BIOADOPTCHILD_BDATE_01_D_2004 | pubid | PUBID_2004 | |
| BM01 | BIOADOPTCHILD_BDATE_01_M_2004 | |||
| BY01 | BIOADOPTCHILD_BDATE_01_Y_2004 |
Codes for Created Variables
Date of birth and death variables: Date variables are presented as both the actual month and year and the month number in a continuous month scheme.
| CV_CHILD_STATUS.xx |
|
1 Adopted 2 Deceased 3 Non-resident, foster care 4 Non-resident, not adopted or in foster care 5 Resident 6 Child deleted by Respondent from Roster in survey |
This program creates a number of variables describing the youth's fertility and the current status of the youth's children. For more information on the continuous month system, see appendix 7 in this document.
array cvR1bm (7) cvR1bm1-cvR1bm7 ;
array cvR1by (7) cvR1by1-cvR1by7;
array cvR1mob (7) cvR1mob1-cvR1mob7;
array cvR1sta (7) cvR1sta1-cvR1sta7;
array cvR2bm (7) cvR2bm1-cvR2bm7 ;
array cvR2by (7) cvR2by1-cvR2by7;
array cvR2mob (7) cvR2mob1-cvR2mob7;
array cvR2sta (7) cvR2sta1-cvR2sta7;
array cvR3bm (7) cvR3bm1-cvR3bm7 ;
array cvR3by (7) cvR3by1-cvR3by7 ;
array cvR3mob (7) cvR3mob1-cvR3mob7 ;
array cvR3sta (7) cvR3sta1-cvR3sta7;
array cvR4bm (7) cvR4bm1-cvR4bm7 ;
array cvR4by (7) cvR4by1-cvR4by7;
array cvR4mob (7) cvR4mob1-cvR4mob7;
array cvR4sta (7) cvR4sta1-cvR4sta7;
array cvR5bm (7) cvR5bm1-cvR5bm7;
array cvR5by (7) cvR5by1-cvR5by7;
array cvR5mob (7) cvR5mob1-cvR5mob7;
array cvR5sta (7) cvR5sta1-cvR5sta7;
array cvR6bm (7) cvR6bm1-cvR6bm7;
array cvR6by (7) cvR6by1-cvR6by7 ;
array cvR6mob (7) cvR6mob1-cvR6mob7;
array cvR6sta (7) cvR6sta1-cvR6sta7;
array cvR7bm (7) cvR7bm1-cvR7bm7;
array cvR7by (7) cvR7by1-cvR7by7;
array cvR7mob (7) cv01-cv07;
array cvR7sta (7) cvR7sta1-cvR7sta7;
array prebm (7) prebm1- prebm7;
array preby (7) preby1- preby7;
array premob (7) premob1- premob7;
array preasta (7) preasta1-preasta7;
do i=1 to 7;
prebm(i)=-4;
preby(i)=-4;
premob(i)=-4;
preasta(i)=-4;
end;
do i=1 to 7 ;
if cv01 ne -5 then do;
prebm(i)= cvR7bm(i);
preby(i)= cvR7by(i);
premob(i)=cvR7mob(i);
preasta(i)=cvR7sta(i);
end;
end;
if cv01 = -5 and cvR6bm1>0 then do;
do i=1 to 7 ;
prebm(i)= cvR6bm(i);
preby(i)= cvR6by(i);
premob(i)=cvR6mob(i);
preasta(i)=cvR6sta(i);
end;
end;
else if cv01= -5 and cvR6bm1=-5 and cvR5bm1 ne -5 then do;
do i=1 to 7 ;
prebm(i)= cvR5bm(i);
preby(i)= cvR5by(i);
premob(i)=cvR5mob(i);
preasta(i)=cvR5sta(i);
end;
end;
else if cv01= -5 and cvR6bm1=-5 and cvR5bm1 = -5 and cvR4bm1 ne -5 then do;
do i=1 to 7 ;
prebm(i)= cvR4bm(i);
preby(i)= cvR4by(i);
premob(i)=cvR4mob(i);
preasta(i)=cvR4sta(i);
end;
end;
else if cv01= -5 and cvR6bm1=-5 and cvR5bm1 = -5 and cvR4bm1 = -5 and cvR3bm1 ne
-5 then do;
do i=1 to 7;
prebm(i)= cvR3bm(i);
preby(i)= cvR3by(i);
premob(i)=cvR3mob(i);
preasta(i)=cvR3sta(i);
end;
end;
else if cv01=-5 and cvR6bm1=-5 and cvR5bm1=-5 and cvR4bm1 = -5 and cvR3bm1 ne -5
and cvR2bm1 ne -5 then do;
do i=1 to 7;
prebm(i)= cvR2bm(i);
preby(i)= cvR2by(i);
premob(i)=cvR2mob(i);
preasta(i)=cvR2sta(i);
end;
end;
else if cv01= -5 and cvR6bm1=-5 and cvR5bm1 = -5 and cvR4bm1 = -5 and cvR3bm1 =
-5 and cvR2bm1 = -5 and cvR1bm1 = -5 then do;
do i=1 to 7;
prebm(i)= cvR1bm(i);
preby(i)= cvR1by(i);
premob(i)=cvR1mob(i);
preasta(i)=cvR1sta(i);
end;
end;
/* comments R8: 1559451 YFER-15260.01~C Childe died april 2003.*/
if pubid=5572 then do;
dm02=4;
dy02=2003;
end;
/* Children deleted in previous Round*/
if pubid in (2019, 8057 ) then do;
bm02=prebm1;
by02=preby1;
end;
/* first, create a variable indicating the bmonth(i), birth month, and byear(i),
birth year,
for each biological child. This part I use variable from roster: BIOADOPT, which
is the "clean"
roster for all bio children */
array bmonth(7) bm01-bm07;
array byear (7) by01-by07;
/* second, create a continuous month scheme variable for the month of birth of
the children
using the formula: (12*(byear(i)-1980)+bmonth(i)) */
array mob(7) mob1-mob7;
do i=1 to 7;
mob(i)=-4;
if bmonth(i) gt 0 then mob(i)=12*(byear(i)-1980)+bmonth(i);
if bmonth(i) = -2 or bmonth(i) =-1 then bmonth(i) =-3; /*2-23-04 added*/
if byear(i) = -2 or bmonth(i) =-1 then byear(i)=-3; /*2-23-04 added*/
if bmonth(i) = -3 or byear(i)=-3 then mob(i)=-3;
if bmonth(i) = -5 then mob(i)=-5;
end;
/* third, create an actual date variable for the date of death of the youth's
children */
dm05=-4;
dm06=-4;
dm07=-4;
dy05=-4;
dy06=-4;
dy07=-4;
array dmonth(7) dm01-dm03 dm04 dm05 dm06 dm07;
array dyear(7) dy01-dy03 dy04 dy05 dy06 dy07;
array mod(7) mod01-mod07;
array dead(7) dead01-dead07;
array reside(7) reside01-reside07;
array adoptout(7) adoptout1-adoptout7;
/* fourth, create a continuous month scheme variable for the month of death of
the children
using the formula: (12*(dody(i)-1980)+dodm(i)) */
do i=1 to 7;
if dmonth(i)=-4 then mod(i)=-4;
if dmonth(i) gt 0 and dyear(i) ge 1980 then mod(i)=12*(dyear(i)-1980)+dmonth(i);
if -3<=dmonth(i)<=-1 or -3<=dyear(i)<=-1 then mod(i)=-3; /*added 1-5-06*/
if dmonth(i)=-5 then mod(i)=-5;
end;
/*update status for newly found children*/
if f4830_1>0 then do;
if f4830_1=bioid01 then status1=f5900_1;
else if f4830_1=bioid02 then status2=f5900_1;
else if f4830_1=bioid03 then status3=f5900_1;
else if f4830_1=bioid04 then status4=f5900_1;
else if f4830_1=bioid05 then status5=f5900_1;
else if f4830_1=bioid06 then status6=f5900_1;
else if f4830_1=bioid07 then status7=f5900_1;
end;
if f4830_2>0 then do;
if f4830_2=bioid01 then status1=f5900_2;
else if f4830_2=bioid02 then status2=f5900_2;
else if f4830_2=bioid03 then status3=f5900_2;
else if f4830_2=bioid04 then status4=f5900_2;
else if f4830_2=bioid05 then status5=f5900_2;
else if f4830_2=bioid06 then status6=f5900_2;
else if f4830_2=bioid07 then status7=f5900_2;
end;
if f4830_3>0 then do;
if f4830_3=bioid01 then status1=f5900_3;
else if f4830_3=bioid02 then status2=f5900_3;
else if f4830_3=bioid03 then status3=f5900_3;
else if f4830_3=bioid04 then status4=f5900_3;
else if f4830_3=bioid05 then status5=f5900_3;
else if f4830_3=bioid06 then status6=f5900_3;
else if f4830_3=bioid07 then status7=f5900_3;
end;
if f4830_4>0 then do;
if f4830_4=bioid01 then status1=f5900_4;
else if f4830_4=bioid02 then status2=f5900_4;
else if f4830_4=bioid03 then status3=f5900_4;
else if f4830_4=bioid04 then status4=f5900_4;
else if f4830_4=bioid05 then status5=f5900_4;
else if f4830_4=bioid06 then status6=f5900_4;
else if f4830_4=bioid07 then status7=f5900_4;
end;
array status(7) status1-status7;
array stat_n(7) stat_n1-stat_n7;
do i=1 to 7;
if status(i)=-4 and mob(i)>-4 then status(i)=9999;/* changed from mob>0 to
mob>-4*/
end;
do i=1 to 7;
if status(i)=1 then stat_n(i)=5;
else if status(i)=2 then stat_n(i)=4;
else if status(i)=3 then stat_n(i)=1;
else if status(i)=4 then stat_n(i)=3;
else if status(i)=5 then stat_n(i)=3;
else if status(i)=6 then stat_n(i)=5;
else if status(i)=7 then stat_n(i)=5;
else if status(i)=8 then stat_n(i)=3;
else if status(i)=9 then stat_n(i)=2;
else if status(i)=10 then stat_n(i)=-3;
else if status(i)=11 then stat_n(i)=3;
else if status(i)=12 then stat_n(i)=3;
else if status(i)=9999 then stat_n(i)=-16;
else if status(i)=-1 or status(i)=-2 or status(i)=-3 then stat_n(i)=-3;
else if status(i)=-4 then stat_n(i)=-4;
else if status(i)=-5 then stat_n(i)=-5;
end;
/* correct wrong status including those who died and those who were adopted out
in previous rounds */
flagdeath=0;
array bioid (7) bioid01-bioid07;
do i=1 to 7;
if dmonth(i) gt -4 or dead(i)=1 then do;
stat_n(i)=2;
flagdeath=1;
end;
end;
/* adoptout child*/
do i=1 to 7;
if stat_n(i)=-16 and (preasta(i)=1 or adoptout(i)=1)
then stat_n(i)=1;
end;
do i=1 to 7;
if stat_n(i)=-16 then do;
stat_n(i)=-3 ;
end;
end;
/* set up adopted new child flag. These adopted new children should not be
included
in created variables*/
array biores(7) biores1-biores7;
array adoptin (7) adopt1-adopt7;
array bionres[7] bionres1-bionres7;
flagadoptin=0;
do i=1 to 7;
if adoptin(i)=1 then do;
flagadoptin=1;
bmonth(i)=-4;
byear(i)=-4;
mob(i)=-4;
dmonth(i)=-4;
dyear(i)=-4;
mod(i)=-4;
status(i)=-4;
stat_n(i)=-4;
reside(i)=-4;
end;
end;
/* END OF ROUND 7 FIXES */
/* fixed reside variables */
do i=1 to 7;
if stat_n(i)=5 then reside(i)=1;
else if (stat_n(i)=3 or stat_n(i)=4 or stat_n(i)=1) then reside(i)=0;
else if stat_n(i)=2 then reside(i)=-4;
end;
do i=1 to 7;
biores(i)=0;
if reside(i)=1 and adoptin(i) ne 1 and dead(i) ne 1 then biores(i)=1;
end;
tbiores=biores1+biores2+biores3+biores4+biores5+biores6+biores7;
if (mob1=-4 and mob2=-4 and mob3=-4 and mob4=-4 and mob5=-4 and mob6=-4) then
tbiores=-4;
if mob1=-5 then tbiores=-5;
do i=1 to 7;
bionres(i)=0;
if reside(i)=0 and adoptin(i) ne 1 and dead(i) ne 1
then bionres(i)=1;
end;
tbionres=bionres1+bionres2+bionres3+bionres4+bionres5+bionres6+bionres7;
if (mob1=-4 and mob2=-4 and mob3=-4 and mob4=-4 and mob5=-4 and mob5=-4) then
tbionres=-4;
if mob1=-5 then tbionres=-5;
/* Last, sort created variables by birthdays, so that the first child listed is
the oldest child. */
array smob(7) smob1-smob7;
do i=1 to 7;
smob(i)=mob(i);
end;
do i=1 to 7;
if mob(i)=-3 then smob(i)=1000;
if mob(i)=-4 then smob(i)=9999;
end;
m1=-4;
m2=-4;
m3=-4;
m4=-4;
m5=-4;
m6=-4;
m7=-4;
/* order the children by birthdate, start with oldest */
m1=min(smob1, smob2, smob3, smob4, smob5, smob6, smob7);
/* set min birthdate to missing to remove from potential list */
if m1=smob1 then smob1=9999;
else if m1=smob2 then smob2=9999;
else if m1=smob3 then smob3=9999;
else if m1=smob4 then smob4=9999;
else if m1=smob5 then smob5=9999;
else if m1=smob6 then smob6=9999;
else if m1=smob7 then smob7=9999;
/* move onto second oldest */
m2=min(smob1, smob2, smob3, smob4, smob5, smob6,smob7);
if m2=smob1 then smob1=9999;
else if m2=smob2 then smob2=9999;
else if m2=smob3 then smob3=9999;
else if m2=smob4 then smob4=9999;
else if m2=smob5 then smob5=9999;
else if m2=smob6 then smob6=9999;
else if m2=smob7 then smob7=9999;
/* move onto third oldest */
m3=min(smob1, smob2, smob3, smob4, smob5, smob6,smob7);
if m3=smob1 then smob1=9999;
else if m3=smob2 then smob2=9999;
else if m3=smob3 then smob3=9999;
else if m3=smob4 then smob4=9999;
else if m3=smob5 then smob5=9999;
else if m3=smob6 then smob6=9999;
else if m3=smob7 then smob7=9999;
/* move onto fourth oldest */
m4=min(smob1, smob2, smob3, smob4, smob5,smob6,smob7);
if m4=smob1 then smob1=9999;
else if m4=smob2 then smob2=9999;
else if m4=smob3 then smob3=9999;
else if m4=smob4 then smob4=9999;
else if m4=smob5 then smob5=9999;
else if m4=smob6 then smob6=9999;
else if m4=smob7 then smob7=9999;
/* move onto fifth oldest */
m5=min(smob1, smob2, smob3, smob4, smob5, smob6,smob7 );
if m5=smob1 then smob1=9999;
else if m5=smob2 then smob2=9999;
else if m5=smob3 then smob3=9999;
else if m5=smob4 then smob4=9999;
else if m5=smob5 then smob5=9999;
else if m5=smob6 then smob6=9999;
else if m5=smob7 then smob7=9999;
/* move onto sixth oldest */
m6=min(smob1, smob2, smob3, smob4, smob5, smob6,smob7);
if m6=smob1 then smob1=9999;
else if m6=smob2 then smob2=9999;
else if m6=smob3 then smob3=9999;
else if m6=smob4 then smob4=9999;
else if m6=smob5 then smob5=9999;
else if m6=smob6 then smob6=9999;
else if m6=smob7 then smob7=9999;
/* move onto seventh oldest */
m7=min(smob1, smob2, smob3, smob4, smob5, smob6,smob7);
if m7=smob1 then smob1=9999;
else if m7=smob2 then smob2=9999;
else if m7=smob3 then smob3=9999;
else if m7=smob4 then smob4=9999;
else if m7=smob5 then smob5=9999;
else if m7=smob6 then smob6=9999;
else if m7=smob7 then smob7=9999;
if m1=9999 then m1=-4;
if m2=9999 then m2=-4;
if m3=9999 then m3=-4;
if m4=9999 then m4=-4;
if m5=9999 then m5=-4;
if m6=9999 then m6=-4;
if m7=9999 then m7=-4;
if m1=1000 then m1=-3;
if m2=1000 then m2=-3;
if m3=1000 then m3=-3;
if m4=1000 then m4=-3;
if m5=1000 then m5=-3;
if m6=1000 then m6=-3;
if m7=1000 then m7=-3;
array cv04bm(7) cv04bm1-cv04bm7;
array cv04by(7) cv04by1-cv04by7;
array cv04mob(7) cv04mob1-cv04mob7;
array cv04dm(7) cv04dm1-cv04dm7;
array cv04dy(7) cv04dy1-cv04dy7;
array cv04mod(7) cv04mod1-cv04mod7;
array cv04stat(7) cv04sta1-cv04sta7;
do i=1 to 7;
if m1=mob(i) then do;
cv04bm1 =bmonth(i);
cv04by1 =byear(i);
cv04mob1=mob(i);
cv04dm1 =dmonth(i);
cv04dy1 =dyear(i);
cv04mod1=mod(i);
cv04sta1=stat_n(i);
end;
end;
do i=1 to 7;
if m2=mob(i) then do;
cv04bm2 =bmonth(i);
cv04by2 =byear(i);
cv04mob2=mob(i);
cv04dm2 =dmonth(i);
cv04dy2 =dyear(i);
cv04mod2=mod(i);
cv04sta2=stat_n(i);
end;
end;
do i=1 to 7;
if m3=mob(i) then do;
cv04bm3 =bmonth(i);
cv04by3 =byear(i);
cv04mob3=mob(i);
cv04dm3 =dmonth(i);
cv04dy3 =dyear(i);
cv04mod3=mod(i);
cv04sta3=stat_n(i);
end;
end;
do i=1 to 7;
if m4=mob(i) then do;
cv04bm4 =bmonth(i);
cv04by4 =byear(i);
cv04mob4=mob(i);
cv04dm4 =dmonth(i);
cv04dy4 =dyear(i);
cv04mod4=mod(i);
cv04sta4=stat_n(i);
end;
end;
do i=1 to 7;
if m5=mob(i) then do;
cv04bm5 =bmonth(i);
cv04by5 =byear(i);
cv04mob5=mob(i);
cv04dm5 =dmonth(i);
cv04dy5 =dyear(i);
cv04mod5=mod(i);
cv04sta5=stat_n(i);
end;
end;
do i=1 to 7;
if m6=mob(i) then do;
cv04bm6 =bmonth(i);
cv04by6 =byear(i);
cv04mob6=mob(i);
cv04dm6 =dmonth(i);
cv04dy6 =dyear(i);
cv04mod6=mod(i);
cv04sta6=stat_n(i);
end;
end;
do i=1 to 7;
if m7=mob(i) then do;
cv04bm7 =bmonth(i);
cv04by7 =byear(i);
cv04mob7=mob(i);
cv04dm7 =dmonth(i);
cv04dy7 =dyear(i);
cv04mod7=mod(i);
cv04sta7=stat_n(i);
end;
end;
/* Children deleted by Respondent from Roster in survery and also deleted in
BIOCHO ROSTER
R's went though question YFER1810=1 and YFER1820=1 so we code 6 as deleted by
Respondent and keep
child birthday and let user make decision */
array dchild (7) dchild01-dchild07;
array ddchild (7) ddchild01-ddchild07;
do i=1 to 7 ;
if ddchild(i)=1 and dchild(i) =1 and stat_n(i)=-3 then do;
tbiores =-3;
tbionres=-3;
end;
end;
do i=1 to 7;
if dchild(i)=1 and ddchild(i)=1 then flagdelete=1;
if (flagdelete=1 and (stat_n(i)=-4 or stat_n(i)=-3) and premob(i)>-4)
then flagdeletea=1;
end;
do i=1 to 7;
if flagdeletea =1 then do;
cv04bm(i)= prebm(i);
cv04by(i)= preby(i);
cv04mob(i)= premob(i);
tbiores =-3;
tbionres=-3;
if premob(i)=. then do;
cv04bm(i)=-4;
cv04by(i)=-4;
cv04mob(i)=-4;
end;
end;
end;
if pubid in (361, 2099,7963,9010, 2099 ,6843) then
CV04sta1=6;
if pubid in (5325,441) then cv04sta2=6;
if pubid=8066 then cv04sta3=6;
if pubid=2099 then cv04sta4=-3;
if pubid in (7963) then cv04sta2=4;
if pubid in (2019, 8057) then do;
tbiores =-3;
tbionres=-3;
cv04sta1= 6;
end;
/* No informatiom in BIOCHILD Roster
case1) if child delete by R's in previous Round, we still need keep all child's
information in created variables
case2) if child not deleted by R's and not adopt in. We shoud keep all previous
informations*/
if PUBID in(3977, 7458, 7676, 7737, 8347) then do;
if cv04mob1=-4 and cv01>-4 then do;
cv04bm1= prebm1;
cv04by1= preby1;
cv04mob1= premob1;
cv04sta1= preasta1;
tbiores =-3;
tbionres=-3;
end;
if cv04mob2=-4 and cv02>-4 then do;
cv04bm2= prebm2;
cv04by2= preby2;
cv04mob2= premob2;
cv04sta2= preasta2;
tbiores =-3;
tbionres=-3;
end;
end;
/* Birth year in BIOCHILD Roster is 1980 and 1985 so put -3 in for created
variables*/
if pubid = 7849 then do;
cv04bm1= -3;
cv04by1= -3;
cv04mob1= -3;
end;
if pubid=7878 then do;
cv04bm1= prebm2;
cv04by1= preby2;
cv04mob1= premob2;
end;
/* Incorrect birthday in Biochild Roster bioid=301*/
if pubid=7168 then do;
cv04bm1= 3 ;
cv04by1= 1999;
cv04mob1=231;
CV04sta1=4;
CV04sta2=5;
end;
/* Biochild Roster status changed from missing child to dead child in Round 6
and Round 7 after Round 7 data release.
In Round 8 this child is back alive in biochild Roster(R's neaver have chance to
be asked this childe again in fertility section).
In Round 9 this child is dade again. I think there is in correct status in R8
biochilde Roster*/
if pubid=6169 then do;
cv04dm2=-3;
cv04dy2=-3;
cv04mod2=-3;
CV04sta2=2;
tbionres=0;
end;
if pubid=403 then do;
cv04bm1=7;
cv04by1= 2003 ;
cv04mob1=283;
end;
if pubid=1580 then do;
cv04bm1=9;
cv04by1=1998 ;
cv04mob1=225;
end;
if pubid=1722 then do;
cv04bm1=4;
cv04by1=1999;
cv04mob1=232;
end;
if pubid=2822 then do;
cv04bm2=3 ;
cv04by2=2001 ;
cv04mob2=255;
end;
if pubid=3060 then do;
cv04bm2=7 ;
cv04by2=2003 ;
cv04mob2=283;
end;
if pubid=3310 then do;
cv04bm2=9 ;
cv04by2=2003 ;
cv04mob2=285;
end;
if pubid=3515 then do;
cv04bm1= 3;
cv04by1= 2003;
cv04mob1=279;
end;
if pubid=3707 then do;
cv04bm1=8 ;
cv04by1=1998;
cv04mob1=224;
end;
if pubid=3732 then do;
cv04bm1=4 ;
cv04by1=2000;
cv04mob1=244;
end;
if pubid= 6169 then do;
cv04bm2= 1;
cv04by2=2002;
cv04mob2=265;
end;
if pubid=8792 then do;
cv04bm1=10 ;
cv04by1=2002;
cv04mob1=274;
end;
do i=1 to 7;
if dmonth(i)=-5 or pubid= 1398 then do;
cv04dm[i]=-5;
cv04dy[i]=-5;
cv04mod[i]=-5;
cv04bm[i]=-5 ;
cv04by[i]=-5;
cv04mob[i]=-5;
cv04stat[i]=-5;
tbiores =-5;
tbionres=-5;
end;
end;
Variables Created:
Variables Used
|
Name in Program |
Question Name on CD |
Name in Program |
Question Name on CD |
|
| Round 1 | Round 5 | |||
| dobm | KEY!BDATE_M | y3500r5 | YHHI-3500 | |
| doby | KEY!BDATE_Y | y3600r5 | YHHI-3600 | |
| p8037r1 | PC8-037 | intmr5 | CV_INTERVIEW_DATE 2001 | |
| p8038r1 | PC8-038 | intyr5 | CV_INTERVIEW_DATE 2001 | |
| p8039r1 | PC8-039 | residr5 | CV_TTL_RESIDENCES | |
| p8040r1 | PC8-040 | |||
| p8043r1 | PC8-043 | Round 6 | ||
| p8049r1 | PC8-049 | y3500r6 | YHHI-3500 | |
| intmr1 | CV_INTERVIEW_DATE 1997 | y3600r6 | YHHI-3600 | |
| intyr1 | CV_INTERVIEW_DATE 1997 | intmr6 | CV_INTERVIEW_DATE 2002 | |
| residr1 | CV_TTL_RESIDENCES_r1 | intyr6 | CV_INTERVIEW_DATE 2002 | |
| residr6 | CV_TTL_RESIDENCES | |||
| Round 2 | residnr6 | CV_TTL_RESIDENCES_EDT | ||
| y3500r2 | YHHI-3500 | |||
| y3600r2 | YHHI-3600 | Round 7 | ||
| intmr2 | CV_INTERVIEW_DATE 1998 | y3500r7 | YHHI-3500 | |
| intyr2 | CV_INTERVIEW_DATE 1998 | y3600r7 | YHHI-3600 | |
| residr2 | CV_TTL_RESIDENCES | intmr7 | CV_INTERVIEW_DATE 2003 | |
| intyr7 | CV_INTERVIEW_DATE 2003 | |||
| Round 3 | residr7 | CV_TTL_RESIDENCES | ||
| y3500r3 | YHHI-3500 | residnr7 | CV_TTL_RESIDENCES_EDT | |
| y3600r3 | YHHI-3600 | |||
| intmr3 | CV_INTERVIEW_DATE 1999 | Round 8 | ||
| intyr3 | CV_INTERVIEW_DATE 1999 | y3500r8 | YHHI-3500 | |
| residr3 | CV_TTL_RESIDENCES | y3600r8 | YHHI-3600 | |
| c1070r8 | YCHR-1070 | |||
| Round 4 | c1070ar8 | YCHR-1070a | ||
| y3500r4 | YHHI-3500 | c1080r8 | YCHR-1080 | |
| y3600r4 | YHHI-3600 | c1090r8 | YCHR-1090 | |
| intmr4 | CV_INTERVIEW_DATE 2000 | intmr8 | CV_INTERVIEW_DATE 2004 | |
| intyr4 | CV_INTERVIEW_DATE 2000 | intyr8 | CV_INTERVIEW_DATE 2004 | |
| residr4 | CV_TTL_RESIDENCE | pubid | PUBID |
This program calculates the number of residences in which youth has lived since age 12. In round 1, the variable was created with information from the parent interview. In round 2, information collected from the respondent was combined with the round 1 variable to update the previous information. Subsequent rounds continue to update the variable with respondent-provided data.
array intmR (*) intmr1-intmr8;
array intyR (*) intyr1-intyr8;
array ageyR (*) ageyr1-ageyr8;
array agecmR (*) agecmr1-agecmr8;
array doicmR (*) doicmr1-doicmr8;
array y3600R (*) y3600r1-y3600r8;
do i=1 to dim(intmR);
if intmR(i)~=-5 then do;
agecmR(i)=(intyR(i)-doby)*12+intmR(i)-dobm;
ageyR(i)=round(agecmR(i)/12);
doicmR(i)=(intyR(i)-1980)*12+intmR(i);
end;
end;
resadd1=0; ttlresid1=-4;
if RESID>=0 & residr1>=0 then resadd1=resid-residr1;
if p8037r1>=0 & p8043r1>=0 then ttlresid1=resadd1+p8043r1+p8037r1;
resadd2=0; ttlresid2=-4;
do i=2 to dim(intmR);
if y3600R(i)>=0 then resadd2=resadd2+y3600R(i);
end;
if c1070r8=1 then ttlresid2=resadd2+1;
if c1080r8>=0 then ttlresid2=resadd2+1+c1080r8;
if c1080r8=-2 then do;
if c1090r8=1 then ttlresid2=resadd2+1+2;
if c1090r8=2 then ttlresid2=resadd2+1+5;
if c1090r8=3 then ttlresid2=resadd2+1+8;
if c1090r8=4 then ttlresid2=resadd2+1+11;
end;
if c1090r8=-2 then ttlresid2=-3;
check1=.; if resadd1~=0 & resadd1~=resadd2 then check1=1;
check2=.;
if p8037r1>=0 & p8043r1>=0 & c1080r8>=0 & p8037r1+p8043r1>c1080r8 then
check2=1;
if p8037r1>=0 & p8043r1>=0 & c1080r8>=0 & p8037r1+p8043r1<c1080r8 then
check2=2;
** These cases need to be checked and then either handedited or given a -3;
if check2=2 & c1070ar8>12 then check3=1;
RESIDN=-4;
if c1070r8>-4 then RESIDN=-3;
if c1070r8=1 & ageyr1>=12 then RESIDN=1+resadd2;
if c1070ar8>12 & c1080r8=0 then RESIDN=1+resadd2;
if 0<=c1070ar8<=12 then RESIDN=1+resadd2;
if c1070r8=-5 then RESIDN=-5;
if resid>=0 & residn>=0 then do;
if resid=residn then consis=1;
if resid>residn then consis=2;
if resid<residn then consis=3;
end;
Variables Created: CV_CITIZEN_CURRENT
Variables Used
|
Name in Program |
Question Name on CD |
| usborn | YHHI-55701 |
| sborn | YHHI-55702 |
| cborn | YHHI-55703 |
| citist | YHHI-55704 |
| cciti | YHHI-55705A |
| nocitist1-7 | YHHI-55706~000001-000007 |
| pubid | PUBID |
| CITIZEN97 | CV_CITIZENSHIP 1997 |
| CITIZEN01 | CV_CITIZENSHIP 2001 |
| CITIZEN02 | CV_CITIZENSHIP 2002 |
| CITIZEN03 | PUBID (SYMBOL) 2003 |
Codes for Created Variables
1. Citizen, born in the US
2. Citizen, naturalized
3. Applicant for naturalization
4. Permanent resident
5. Applicant for residence
6. Other
This program creates a variable describing the youth's citizenship status.
if citizen01>-4 then citizen=citizen01;
if citizen02>-4 then citizen=citizen02;
if citizen03>-4 then citizen=citizen03;
if (usborn=1 or citist=1) then citizen=1;
else if citist=2 then citizen=2;
else if citist=3 and cciti=1 then do;
if nocitist1 =1 then citizen=3;
else if nocitist2=1 then citizen=4;
else if nocitist3=1 then citizen=5;
else if (nocitist4=1 or nocitist5=1 or nocitist6=1 or nocitist7=1) then
citizen=6;
end;
if -4<citist<0 then citizen=-3;
if int_y=-5 then citizen=-5;