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 Name in Data |
|
PUBID |
PUBID |
| HAGE01-HAGE13 | HHI_AGE.01-.13 |
| HAGEST01-HAGEST11 | HHI_AGEEST.01-.11 |
| HUID01-HUID13 | HHI_UID.01-.13 |
| 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-HAGE13;
ARRAY HUID HUID01-HUID13;
ARRAY HAGEST HAGEST01-HAGEST13;
/* 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-HHDUM13;
ARRAY DUM6 DUM601-DUM613;
ARRAY DUM18 DUM1801-DUM1813;
DO I=1 TO 13;
HHDUM[I]=0;
DUM6[I]=0;
DUM18[I]=0;
END;
DO I=1 TO 13;
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 variables UNDER6 AND UNDER18 by adding up the other two
dummies.*/
HHSIZE=1;
UNDER6=RDUM6;
UNDER18=RDUM18;
DO I=1 TO 13;
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]<-1 THEN PRT1=-3;
END;
/*Revised in Rd 9 prt3 accounts for cases that have a -1 answer to age of
household respondent they were then skipped on estimated age; they will be coded
-3*/
Do I=1 TO 13;
IF -4<HAGEST[I]<0 AND PRT1=-3 THEN PRT2=-3;
IF HAGEST[I]=-4 AND HAGE[I]=-1 THEN PRT3=-3;
END;
IF PRT2=-3 OR HHSIZE=-3 OR PRT3=-3 THEN DO;
UNDER6=-3;
UNDER18=-3;
END;
IF UND6=-3 THEN DO;
UNDER6=-3;
END;
endsas;
Variables Created: CV_MARSTAT (marstat)
CV_MARSTAT_COLLAPSED
(cmarstat)
CV_FIRST_COHAB_DATE_M
(cohm)
CV_FIRST_COHAB_DATE_Y
(cohy)
CV_FIRST_MARRY_DATE_M
(marm)
CV_FIRST_MARRY_DATE_Y
(mary)
CV_FIRST_COHAB_MONTH
(cohcm)
CV_FIRST_MARRY_MONTH
(marcm)
CV_COHAB_TTL
(och_ttl)
CV_MARRIAGES_TTL
(mar_ttl)
Variables Used
| Name in Program | Question Name in Data | Name in Program | Question Name in Data | Name in Program | Question Name in Data | ||
|
Round 1: |
|
Round 5: |
|
Round 9: |
|
||
|
FCOH_Mr1 |
CV_FIRST_COHAB_DATE~M |
FCOH_Mr5 |
CV_FIRST_COHAB_DATE~M |
M620 |
YMAR-620 |
||
|
FCOH_Yr1 |
CV_FIRST_COHAB_DATE~Y |
FCOH_Yr5 |
CV_FIRST_COHAB_DATE~Y |
M650 |
YMAR-650 |
||
|
FCOHCMr1 |
CV_FIRST_COHAB_MONTH |
FCOHCMr5 |
CV_FIRST_COHAB_MONTH |
M710 |
YMAR-710 |
||
|
FMAR_Mr1 |
CV_FIRST_MARRY_DATE~M |
FMAR_Mr5 |
CV_FIRST_MARRY_DATE~M |
M712 |
YMAR-712 |
||
|
FMAR_Yr1 |
CV_FIRST_MARRY_DATE~Y |
FMAR_Yr5 |
CV_FIRST_MARRY_DATE~Y |
M714 |
YMAR-714 |
||
|
FMARMr1 |
CV_FIRST_MARRY_MONTH |
FMARMr5 |
CV_FIRST_MARRY_MONTH |
M718 |
YMAR-718 |
||
|
INT_Dr1 |
CV_INTERVIEW_DATE_D |
INT_Dr5 |
CV_INTERVIEW_DATE_D |
M729D |
YMAR-729D |
||
|
INT_Mr1 |
CV_INTERVIEW_DATE~M |
INT_Mr5 |
CV_INTERVIEW_DATE~M |
M730 |
YMAR-730 |
||
|
INT_Yr1 |
CV_INTERVIEW_DATE~Y |
INT_Yr5 |
CV_INTERVIEW_DATE~Y |
M740 |
YMAR-740 |
||
|
MARSTAT1 |
CV_MARSTAT |
MARSTAT5 |
CV_MARSTAT |
M760 |
YMAR-760 |
||
|
CMARSTA1 |
CV_MARSTAT_COLLAPSED |
CMARSTA5 |
CV_MARSTAT_COLLAPSED |
M2900 |
YMAR-2900 |
||
|
COH_TTL1 |
CV_MARRIAGES_TTL |
COH_TTL5 |
CV_COHAB_TTL |
M31001M |
YMAR-3100.01~M |
||
|
MAR_TTL1 |
CV_MARRIAGES_TTL |
MAR_TTL5 |
CV_MARRIAGES_TTL |
M31001Y |
YMAR-3100.01~Y |
||
|
|
|
|
|
M31002M |
YMAR-3100.02~M |
||
|
Round 2: |
|
Round 6: |
|
M31002Y |
YMAR-3100.02~Y |
||
|
FCOH_Mr2 |
CV_FIRST_COHAB_DATE~M |
FCOH_Mr6 |
CV_FIRST_COHAB_DATE~M |
M31003M |
YMAR-3100.03~M |
||
|
FCOH_Yr2 |
CV_FIRST_COHAB_DATE~Y |
FCOH_Yr6 |
CV_FIRST_COHAB_DATE~Y |
M31003Y |
YMAR-3100.03~Y |
||
|
FCOHCMr2 |
CV_FIRST_COHAB_MONTH |
FCOHCMr6 |
CV_FIRST_COHAB_MONTH |
M45001-M45004 |
YMAR-4500.01-.04 |
||
|
FMAR_Mr2 |
CV_FIRST_MARRY_DATE~M |
FMAR_Mr6 |
CV_FIRST_MARRY_DATE~M |
M46501-M46503 |
YMAR-4650.01-.03 |
||
|
FMAR_Yr2 |
CV_FIRST_MARRY_DATE~Y |
FMAR_Yr6 |
CV_FIRST_MARRY_DATE~Y |
M47001-M47003 |
YMAR-4700.01-.03 |
||
|
FMARMr2 |
CV_FIRST_MARRY_MONTH |
FMARMr6 |
CV_FIRST_MARRY_MONTH |
M48001M |
YMAR-4800.01~M |
||
|
INT_Dr2 |
CV_INTERVIEW_DATE_D |
INT_Dr6 |
CV_INTERVIEW_DATE_D |
M48001Y |
YMAR-4800.01~Y |
||
|
INT_Mr2 |
CV_INTERVIEW_DATE~M |
INT_Mr6 |
CV_INTERVIEW_DATE~M |
M48002M |
YMAR-4800.02~M |
||
|
INT_Yr2 |
CV_INTERVIEW_DATE~Y |
INT_Yr6 |
CV_INTERVIEW_DATE~Y |
M48002Y |
YMAR-4800.02~Y |
||
|
MARSTAT2 |
CV_MARSTAT |
MARSTAT6 |
CV_MARSTAT |
M48003M |
YMAR-4800.03~M |
||
|
CMARSTA2 |
CV_MARSTAT_COLLAPSED |
CMARSTA6 |
CV_MARSTAT_COLLAPSED |
M48003Y |
YMAR-4800.03~Y |
||
|
COH_TTL2 |
CV_COHAB_TTL |
COH_TTL6 |
CV_COHAB_TTL |
M540011-M540013 |
YMAR-5400.01.01-.03 |
||
|
MAR_TTL2 |
CV_MARRIAGES_TTL |
MAR_TTL6 |
CV_MARRIAGES_TTL |
M560012M |
YMAR-5600.01.01~M |
||
|
|
|
|
|
M560012Y |
YMAR-5600.01.02~Y |
||
|
Round 3: |
|
Round 7: |
|
M560013Y |
YMAR-5600.01.03~Y |
||
|
FCOH_Mr3 |
CV_FIRST_COHAB_DATE~M |
FCOH_Mr7 |
CV_FIRST_COHAB_DATE~M |
M570011M |
YMAR-5700.01.01~M |
||
|
FCOH_Yr3 |
CV_FIRST_COHAB_DATE~Y |
FCOH_Yr7 |
CV_FIRST_COHAB_DATE~Y |
M570011Y |
YMAR-5700.01.01~Y |
||
|
FCOHCMr3 |
CV_FIRST_COHAB_MONTH |
FCOHCMr7 |
CV_FIRST_COHAB_MONTH |
M700011M |
YMAR-7000.01.01~M |
||
|
FMAR_Mr3 |
CV_FIRST_MARRY_DATE~M |
FMAR_Mr7 |
CV_FIRST_MARRY_DATE~M |
M700011Y |
YMAR-7000.01.01~Y |
||
|
FMAR_Yr3 |
CV_FIRST_MARRY_DATE~Y |
FMAR_Yr7 |
CV_FIRST_MARRY_DATE~Y |
M700012M |
YMAR-7000.01.02~M |
||
|
FMARMr3 |
CV_FIRST_MARRY_MONTH |
FMARMr7 |
CV_FIRST_MARRY_MONTH |
M700012y |
YMAR-7000.01.02~Y |
||
|
INT_Dr3 |
CV_INTERVIEW_DATE_D |
INT_Dr7 |
CV_INTERVIEW_DATE_D |
M700021M |
YMAR-7000.02.01~M |
||
|
INT_Mr3 |
CV_INTERVIEW_DATE~M |
INT_Mr7 |
CV_INTERVIEW_DATE~M |
M700031Y |
YMAR-7000.03.01~Y |
||
|
INT_Yr3 |
CV_INTERVIEW_DATE~Y |
INT_Yr7 |
CV_INTERVIEW_DATE~Y |
M7900111 |
YMAR-7900.01.01.01 |
||
|
MARSTAT3 |
CV_MARSTAT |
MARSTAT7 |
CV_MARSTAT |
M7900211 |
YMAR-7900.02.01.01 |
||
|
CMARSTA3 |
CV_MARSTAT_COLLAPSED |
CMARSTA7 |
CV_MARSTAT_COLLAPSED |
M810111M |
YMAR-8100.01.01.01~M |
||
|
COH_TTL3 |
CV_COHAB_TTL |
COH_TTL7 |
CV_COHAB_TTL |
M810111Y |
YMAR-8100.01.01.01~Y |
||
|
MAR_TTL3 |
CV_MARRIAGES_TTL |
MAR_TTL7 |
CV_MARRIAGES_TTL |
M8200111M |
YMAR-8200.01.01.01~M |
||
|
|
|
|
|
M8200111Y |
YMAR-8200.01.01.01~Y |
||
|
Round 4: |
|
Round 8: |
|
M8200112M |
YMAR-8200.01.01.02~M |
||
|
FCOH_Mr4 |
CV_FIRST_COHAB_DATE~M |
FCOH_Mr8 |
CV_FIRST_COHAB_DATE~M |
M8200112Y |
YMAR-8200.01.01.02~Y |
||
|
FCOH_Yr4 |
CV_FIRST_COHAB_DATE~Y |
FCOH_Yr8 |
CV_FIRST_COHAB_DATE~Y |
M8200211M |
YMAR-8200.02.01.01~M |
||
|
FCOHCMr4 |
CV_FIRST_COHAB_MONTH |
FCOHCMr8 |
CV_FIRST_COHAB_MONTH |
M8200211Y |
YMAR-8200.02.01.01~Y |
||
|
FMAR_Mr4 |
CV_FIRST_MARRY_DATE~M |
FMAR_Mr8 |
CV_FIRST_MARRY_DATE~M |
M910011 |
YMAR-9100.01.01 |
||
|
FMAR_Yr4 |
CV_FIRST_MARRY_DATE~Y |
FMAR_Yr8 |
CV_FIRST_MARRY_DATE~Y |
M910012 |
YMAR-9100.01.02 |
||
|
FMARMr4 |
CV_FIRST_MARRY_MONTH |
FMARMr8 |
CV_FIRST_MARRY_MONTH |
M910021 |
YMAR-9100.02.01 |
||
|
INT_Dr4 |
CV_INTERVIEW_DATE_D |
INT_Dr8 |
CV_INTERVIEW_DATE_D |
M920011M |
YMAR-9200.01.01~M |
||
|
INT_Mr4 |
CV_INTERVIEW_DATE~M |
INT_Mr8 |
CV_INTERVIEW_DATE~M |
M920011Y |
YMAR-9200.01.01~Y |
||
|
INT_Yr4 |
CV_INTERVIEW_DATE~Y |
INT_Yr8 |
CV_INTERVIEW_DATE~Y |
M920021M |
YMAR-9200.02.01~M |
||
|
MARSTAT4 |
CV_MARSTAT |
MARSTAT8 |
CV_MARSTAT |
M920021Y |
YMAR-9200.02.01~Y |
||
|
CMARSTA4 |
CV_MARSTAT_COLLAPSED |
CMARSTA8 |
CV_MARSTAT_COLLAPSED |
m11700011y |
YMAR-11700.01~Y |
||
|
COH_TTL4 |
CV_COHAB_TTL |
COH_TTL8 |
CV_COHAB_TTL |
m11700011m |
YMAR-11700.02~M |
||
|
MAR_TTL4 |
CV_MARRIAGES_TTL |
MAR_TTL8 |
CV_MARRIAGES_TTL |
M114001-M114003 |
YMAR-11400.01-.03 |
||
|
|
|
|
|
INT_D |
CV_INTERVIEW_DATE~D |
||
|
|
|
|
|
INT~M |
CV_INTERVIEW_DATE~M |
||
|
|
|
|
|
INT~Y |
CV_INTERVIEW_DATE~Y |
||
|
|
|
|
|
p1-p3 |
PARTNERS_ID.01-.03 |
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 |
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 m3100B1y>-4 then do;
M31001Y= M3100B1Y ;
M31001M= M3100B1M ;
M3100B1Y =-4;
M3100B1M =-4;
end;
if m3100B2y>-4 then do;
M31002Y= M3100B2Y ;
M31002M= M3100B2M ;
M3100B2Y=-4;
M3100B2M=-4;
end;
if m3100B3y>-4 then do;
M31003Y= M3100B3Y ;
M31003M= M3100B3M ;
M3100B3Y=-4;
M3100B3M=-4;
end;
if m3100B4y>-4 then do;
M31004Y= M3100B4Y ;
M31004M= M3100B4M ;
M3100B4Y=-4;
M3100B4M=-4;
end;
/*People who answer m63001=4 (widowed) set up spouse death time as the time they
stop living together*/
if m63001=4 then do;
m114001=5;
m117001m=m48001m;
m117001y=m48001y;
end;
/* Four loops delete first two Duplicate loops */
if pubid= 7483 then do;
m700011m=m700013m;
m700012m=m700014m;
m700013m=-4;
m700014m=-4;
m700011y=m700013y;
m700012y=m700014y;
m700013y=-4;
m700014y=-4;
m920011m=m920013m;
m920011y=m920013y;
m920012y=-4;
m920012m=-4;
m920013m=-4;
m920013y=-4;
m910011=0;
m910012=1;
m910013=-4;
m910014=-4;
end;
/* Two loops in ymar-5700 - delete the second Duplicate loop*/
if pubid= 6378 then do;
m540012=-4;
m570012y=-4;
m570012m=-4;
end;
if m31001y=-4 & m700011y>0 & m46701=-4 & m910011=1 & m48001m=-4 then do;
m31001y=m700011y;
m31001m=m700011m;
m700011m=-4;
m700011y=-4;
m910011=-4;
m46701=1;
end;
/* Hand edits using information from all available sources */
if pubid in (2865) then do;
M8100111M=-4;
M8100111Y=-4;
m7900111=-4;
M560011M=-4;
M560011Y=-4;
m540011=-4;
end;
if pubid= 4031 then do;
M8100111M=-4;
M8100111Y=-4;
m7900111=-4;
end;
if pubid in (4658, 8303) then do;
M8100111M=-4;
M8100111Y=-4;
m7900111=-4;
end;
if pubid in (3540, 3989, 3564) then do;
M560011M=-4;
M560011Y=-4;
M540011=-4;
m114001=-4;
m117001m=-4;
m117001y=-4;
end;
if pubid= 4608 then do;
m7900211=-4;
m8100211m=-4;
m8100211y=-4;
end;
if pubid in (3778, 6188, 4276, 6474, 4350) then do;
m114001=-4;
m117001m=-4;
m117001y=-4;
p1=p2;
p2=-4;
m46702=-4;
m46701=1;
end;
if pubid= 5775 then do;
m114001=-4;
m117001m=-4;
m117001y=-4;
m560011m=-5;
m560011y=-4;
m540011=-4;
m48001y=-4;
m48001m=-4;
end;
if pubid in (6474) then do;
p1=p3;
p2=-4;
p3=-4;
end;
if pubid in (3442) then do;
M4350A1 =-4;
M4360A1M =-4;
M4360A1Y =-4;
p1=p2;
p2=-4;
m46701=m46702;
end;
if pubid= 6575 then do;
p1=p2;
p2=-4;
m46702=-4;
m46701=1;
end;
if pubid= 3685 then do;
m31001m=m31002m;
m31001y=m31002y;
m31002y=-4;
m31002m=-4;
p1=p2;
p2=-4;
m47001=1;
m47002=-4;
m7900111=1;
m7900211=-4;
m8200111m=m8200211m;
m8200211m=-4;
m8200111y=m8200211y;
m8200211y=-4;
end;
if pubid= 8138 then do;
m46701=m46702;
m46702=-4;
m48001m=-4;
m48001y=-4;
m7900111=1;
m7900211=-4;
m8200111m=m8200211m;
m8200211m=-4;
m8200111y=m8200211y;
m8200211y=-4;
p1=p2;
p2=-4;
end;
if pubid= 2849 then do;
m46701=m46702;
m46702=1;
p1=p2;
p2=-4;
end;
if pubid in (2302, 4042) then do;
p1=p2;
p2=-4;
m48001y=-4;
m48001m=-4;
m46701=m46702;
m46702=-4;
m47001=m47002;
m47002=-4;
end;
/* 34 cases in R9:
R’s have new partners in R9. The first
cohabitation month and year for the new partner are missing so
use one month after dli month as starting month*/
if p1>900 & m31001y=-4 & m3100A1y=-4
then do;
m31001y=-2;
m31001m=-2;
end;
if p2>900 & m31002y=-4
then do;
m31002y=-2;
m31002m=-2;
end;
if p3>900 & m31003y=-4
then do;
m31003y=-2;
m31003m=-2;
end;
if p4>900 & m31004y=-4
then do;
m31004y=-2;
m31004m=-2;
end;
if m45001=1 & m31001y=-4 & p1>900
then do;
m31001y=-2;
m31001m=-2;
end;
if m45002=1 & m31002y=-4 & p2>900
then do;
m31002y=-2;
m31002m=-2;
end;
/* Hand edits using information from all available sources */
if pubid = 4061 then do;
p1=501;
end;
if pubid = 4779 then p1=801;
if pubid = 3438 then do;
m45002=0;
m45001=1;
end;
if pubid= 3936 then pMARSTAT8=3;
/* Duplicate loops */
if pubid= 2903 then do;
m31002y=-4;
m31002m=-4;
m47002 =-4;
m45001 = 1;
end;
if m46701=1 & m8100111m>-4 & m48001m=-4
then do;
m48001m=m8100111m;
m48001y=m8100111y;
m46701=0;
end;
if pubid= 7089 then do;
m47001=0;
m48001m=m8100112m;
m48001y=m8100112y;
end;
/* Bad stop and start dates*/
if pubid in (6161, 6406) then do;
m480011y=-4;
m480011m=-4;
m700011y=-4;
m700011m=-4;
m47001=1;
end;
/* Partner & spouse arrays */
array r8mars (l) r8mars001-r8mars320;
array r8co (l) r8co001-r8co320;
array r8link (l) r8link001-r8link320;
array r8pt (l) r8pt001-r8pt320;
array r8sp (l) r8sp001-r8sp320;
/* Created variables arrays*/
%let n=8 ;
array pMARSTAT(&n); array pCMARSTA(&n);
array pmar_ttl(&n); array pcoh_ttl(&n);
array FMAR_Yr(&n) ; array FMAR_Mr(&n) ; array fmarcmr(&n);
array FCOH_Mr(&n) ; array FCOH_Yr(&n) ; array FCOHCMr(&n) ;
array pint_mr(&n) ; array pint_yr(&n) ; array pint_cmr(&n); array m620r(&n);
do i=1 to (&n);
if pint_cmr(i)>0 then do;
dlicm=pint_cmr(i);
dlimarstat=pMARSTAT(i);
dlicmarstat=pCMARSTA(i);
premar_ttl=pmar_ttl(i);
precoh_ttl= pcoh_ttl(i);
dlimarm=FMAR_Mr(i);
dlimary= FMAR_Yr(i);
dlimarcm= fmarcmr(i);
dlicohm= FCOH_Mr(i);
dlicohy =FCOH_Yr(i);
dlicohcm =FCOHCMr(i);
dliym=pint_yr(i)*100+pint_mr(i);
dlim620=m620r(i);
mardli=pMARSTAT(i);
end;
end;
drop i;
do i=2 to (&n);
if FCOHCMr(i-1)=-3 & FCOHCMr(i)>0 & FCOHCMr(i)>pint_cmr(i-1) then flagcoh=1;
if flagcoh=1 then do;
FCOHCMr(i)=FCOHCMr(i-1);
FCOH_Mr(i)=FCOH_Mr(i-1);
FCOH_Yr(i)=FCOH_Yr(i-1);
end;
end;
do i=2 to (&n);
if FMARCMr(i-1)=-3 & FMARCMr(i)>0 & FMARCMr(i)>pint_cmr(i-1) then flagcoh=1;
if flagcoh=1 then do;
FMARCMr(i)=FMARCMr(i-1);
FMAR_Mr(i)=FMAR_Mr(i-1);
FMAR_Yr(i)=FMAR_Yr(i-1);
end;
end;
if pubid= 8562 then do;
FCOH_Mr8 = 11 ;
FCOH_Yr8 = 2004;
FCOHCMr8 = 299;
end;
if precoh_ttl<-3 then precoh_ttl=0;
if premar_ttl<-3 then premar_ttl=0;
/* Create interview date & previous interview date in continuous
months & months/years;*/
/* create varible START, start is one month after dli.*/
if bdate_y>0 & bdate_m>0 then b14cm=(bdate_y+14-1980)*12+bdate_m;
start=dlicm+1;
if int_y >0 & int_m >0 then do;
iym=int_y*100+int_m;
doicm=(int_y-1980)*12+int_m;
end;
else if int_y = -5 | int_m = -5 then do;
doicm=-5;
iym=-5;
end;
/* Partner match, matching Round 9 partner to previous (round 1-8) partners */
array par {4} p1-p4;
array partner {4, 8} p1r1-p1r8 p2r1-p2r8 p3r1-p3r8 p4r1-p4r8;
array parname{4} pname1-pname4;
array Npartner {4, 8} p1namer1-p1namer8 p2namer1-p2namer8 p3namer1-p3namer8
p4namer1-p4namer8;
array Hspouse8 {8} spouse1-spouse8;
array Hpartner8 {8} partner1-partner8;
array dlipar {4,8} p1r1-p1r8 p2r1-p2r8 p3r1-p3r8 p4r1-p4r8; /* dli partner */
array M11400 {3,9} m114001r1-m114001r9 m114002r1-m114002r9 m114003r1-m114003r9;
death=0;
Annulment=0;
do i=1 to 3;
do j=1 to 9;
if M11400{ i, j}=5 then death=1;
else if M11400{ i, j}=2 then Annulment=1;
end;
end;
flagp=0;
do t=1 to 4;
do i=1 to 4;
do j=1 to 8;
if par(t)=partner{i,j}
& partner{i,j}>0
then flagp=1;
end;
end;
end;
if pubid= 2642 then flagp=1;
flagp1=0;
if -4<m48001y<0 |-4<m48001m<0 then do; /*loop 1*/
do t=1 to 4;
if( par(t) ne p1r8 & par(t) ne p2r8 & par(t) ne p3r8
| ( par(t) = p1r8 | par(t) = p2r8 | par(t)= p3r8) & dlimarstat=2
| pubid= (1550)
& (m700011y=-4 & m700012y=-4 & m700013y=-4 & 0<par(t)<900) then flagp1=1;
end;
end;
/* Finding spouse in household Roster(r1-r8). for reference only */
array hhrely8 {14, 8} RELY01R1-RELY01R8
RELY02R1-RELY02R8
RELY03R1-RELY03R8
RELY04R1-RELY04R8
RELY05R1-RELY05R8
RELY06R1-RELY06R8
RELY07R1-RELY07R8
RELY08R1-RELY08R8
RELY09R1-RELY09R8
RELY10R1-RELY10R8
RELY11R1-RELY11R8
RELY12R1-RELY12R8
RELY13R1-RELY13R8
RELY14R1-RELY14R8 ;
count=0;
do i=1 to 14;
do j=1 to 8 until (hhrely8{i, j}=1 | hhrely8{i, j}=2);
if (hhrely8{i, j}=1 | hhrely8{i, j}=2) then do;
Hspouse8 {j}=1;
count=count+1;
end;
else if hhrely8{i,j}=69 then do;
Hpartner8 {j}=1;
countp=countp+1;
end;
end;
end;
/* Finding spouse in household Roster R9*/
array hhrely {13} rely01-rely13;
do i=1 to 13;
if hhrely{i}=1 | hhrely{i}=2 then Hspouse9=1;
else if hhrely{i}=69 then Hpartner9=1;
end;
/* set up arrays for r9 partner & spouse*/
array r9pt (l) r9pt001-r9pt320;
array r9sp (l) r9sp001-r9sp320;
/* set up Mar arrays for each partner in four period*/
array maf (l) maf001-maf320;
array mas (l) mas001-mas320;
array mat (l) mat001-mat320;
array mafour (l) mafour001-mafour320;
array mbf (l) mbf001-mbf320;
array mbs (l) mbs001-mbs320;
array mbt (l) mbt001-mbt320;
array mbfour (l) mbfour001-mbfour320;
array mcf (l) mcf001-mcf320;
array mcs (l) mcs001-mcs320;
array mct (l) mct001-mct320;
array mcfour (l) mcfour001-mcfour320;
array mdf (l) mdf001-mdf320;
array mds (l) mds001-mds320;
array mdt (l) mdt001-mdt320;
array mdfour (l) mdfour001-mdfour320;
/* array for partner a in first sec third & fourth period*/
array maa (l) maa001-maa320;
array mbb (l) mbb001-mbb320;
array mcc (l) mcc001-mcc320;
array mdd (l) mdd001-mdd320;
/* set up arrays for mar total*/
array mal (l) mal001-mal320;
/* set up cohabitation arrays for each partner in four period*/
array cohaf (l) cohaf001-cohaf320;
array cohas (l) cohas001-cohas320;
array cohat (l) cohat001-cohat320;
array cohafour (l) cohafour001-cohafour320;
array cohbf (l) cohbf001-cohbf320;
array cohbs (l) cohbs001-cohbs320;
array cohbt (l) cohbt001-cohbt320;
array cohbfour (l) cohbfour001-cohbfour320;
array cohcf (l) cohcf001-cohcf320;
array cohcs (l) cohcs001-cohcs320;
array cohct (l) cohct001-cohct320;
array cohcfour (l) cohcfour001-cohcfour320;
array cohdf (l) cohdf001-cohdf320;
array cohds (l) cohds001-cohds320;
array cohdt (l) cohdt001-cohdt320;
array cohdfour (l) cohdfour001-cohdfour320;
array cohaa (l) cohaa001-cohaa320;
array cohbb (l) cohbb001-cohbb320;
array cohcc (l) cohcc001-cohcc320;
array cohdd (l) cohdd001-cohdd320;
/*cohabitation total*/
array cohal (l) cohal001-cohal320;
/*arrays for R9 event history */
array mars (l) mars001-mars320;
array cohh (l) cohh001-cohh320;
array link (l) link001-link320;
array dual (l) dual001-dual320;
do l=start to 320;
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;
/* year start cohabitating*/
array ysca (t) M31001Y M700011Y M700012Y M700013Y;
array yscb (t) M31002Y M700021Y M700022Y yscb4;
array yscc (t) M31003Y M700031Y yscc3 yscc4;
array yscd (t) M31004Y yscd2 yscd3 yscd4;
array msca (t) M31001M M700011M M700012M M700013M;
array mscb (t) M31002M M700021M M700022M mscb4;
array mscc (t) M31003M M700031M mscb3 mscb4;
array mscd (t) M31004M mscd2 mscd3 mscd4;
array ysc (p) ysca yscb yscc yscd;
array msc (p) msca mscb mscc mscd;
array ycoa (t) M31001Y ycoa2 ycoa3 ycoa4;
array ycob (t) M31002Y yscb2 yscb3 yscb4;
array ycoc (t) M31003Y yscc2 yscc3 yscc4;
array ycod (t) M31004Y ycod2 ycod3 ycod4;
array mcoa (t) M31001M mcoa2 mcoa3 mcoa4;
array mcob (t) M31002M mcob2 mcob3 mcob4;
array mcoc (t) M31003M mcoc2 mcoc3 mcoc4;
array mcod (t) M31004M mcod2 mcod3 mcod4;
array yco (p) ycoa ycob ycoc ycod;
array mco (p) mcoa mcob mcoc mcod;
array ymcoa (t) ymcoa1 ymcoa2 ymcoa3 ymcoa4;
array ymcob (t) ymcob1 ymcob2 ymcob3 ymcob4;
array ymcoc (t) ymcoc1 ymcoc2 ymcoc3 ymcoc4;
array ymcod (t) ymcod1 ymcod2 ymcod3 ymcod4;
array ymco (p) ymcoa ymcob ymcoc ymcod;
array yspa (t) M3100A1Y yspa2 yspa3 yspa4;
array yspb (t) yspb1 yspb2 yspb3 yspb4;
array yspc (t) yspc1 yspc2 yspc3 yspc4;
array yspd (t) yspd1 yspd2 yspd3 yspd4;
array mspa (t) M3100A1M mspa2 mspa3 mspa4;
array mspb (t) mspb1 mspb2 mspb3 mspb4;
array mspc (t) mspc1 mspc2 mspc3 mspc4;
array mspd (t) mspd1 mspd2 mspd3 mspd4;
array ysp (p) yspa yspb yspc yspd;
array msp (p) mspa mspb mspc mspd;
array ymspa (t) ymspa1 ymspa2 ymspa3 ymspa4;
array ymspb (t) ymspb1 ymspb2 ymspb3 ymspb4;
array ymspc (t) ymspc1 ymspc2 ymspc3 ymspc4;
array ymspd (t) ymspd1 ymspd2 ymspd3 ymspd4;
array ymsp (p) ymspa ymspb ymspc ymspd;
array yBsca (t) M3100B1Y yBscb2 yBsca3 yBsca4;
array yBscb (t) M3100B2Y yBscb2 yBscb3 yBscb4;
array yBscc (t) M3100B3Y yBscc2 yBscc3 yBscc4;
array yBscd (t) M3100B4Y yBscd2 yBscd3 yBscd4;
array mBsca (t) M31001BM mBsca2 mBsca3 mBsca4;
array mBscb (t) M31002BM mBscb2 mBscb3 mBscb4;
array mBscc (t) M31003BM mBscc2 mBscc3 mBscc4;
array mBscd (t) M31004BM mBscd2 mBscd3 mBscd4;
array yBsc (p) yBsca yBscb yBscc yBscd;
array mBsc (p) mBsca mBscb mBscc mBscd;
/*year end cohabitation */
array yeca (t) M48001Y M920011Y M920012Y M920013Y ;
array yecb (t) M48002Y M920021Y yecb3 yecb4;
array yecc (t) M48003Y M920031Y yecc3 yecc4;
array yecd (t) M48004Y yecd2 yecd3 yecd4;
array yec (p) yeca yecb yecc yecd;
/*month end cohabitation */
array meca (t) M48001M M920011M M920012M M920013M;
array mecb (t) M48002M M920021M mecb3 mecb4;
array mecc (t) M48003M M920031m 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 & 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 & 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) M46703 cdlic2 cdlic3 cdlic4;
array cdlid (t) M46704 cdlid2 cdlid3 cdlid4;
array cdli (p) cdlia cdlib cdlic cdlid;
/*dummy for cohabitation continuous - since start (after dli date for new
partners)*/
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)*/
array cbeg2a (t) cbeg2a1 M910011 M910012 cbeg2a4;
array cbeg2b (t) cbeg2b1 M910021 M910022 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 | next change in status.
Read "cstata2" as change in marital status for partner a, period 2. */
array cstata1 (t) m540011 m540012 cstata13 cstata14;
array cstata2 (t) m7900111 m7900112 cstata23 cstata24;
array cstatb1 (t) m7900211 cstatb12 cstatb13 cstatb14;
array cstata4 (t) m9800111 cstata42 cstata43 cstata44;
/*collapse into cstat status changed*/
array cstat1 (p) cstata1 cstatb1 cstatc1 cstatd1;
array cstat2 (p) cstata2 cstatb2 cstatc2 cstatd2;
array cstat3 (p) cstata3 cstatb3 cstatc3 cstatd3;
array cstat4 (p) cstata4 cstatb4 cstatc4 cstatd4;
array cstat (i) cstat1 cstat2 cstat3 cstat4 ;
/*month & year change is marry*/
array cyma1 (t) M570011y M570012y cyma13 cyma14;
array cmma1 (t) M570011m M570012m cmma14 cmma14;
array cyma2 (t) m8200111y cyma22 cyma23 cyma24;
array cmma2 (t) m8200111m cmma22 cmma23 cmma24;
array cymb1 (t) m8200211y cymb12 cymb13 cymb14;
array cmmb1 (t) m8200211m cmmb12 cmmb13 cmmb14;
array cyma4 (t) m10100111y cyma42 cyma43 cyma44;
array cmma4 (t) m10100111m cmma42 cmma43 cmma44;
/*collaspse into month & year change is marry*/
array cym1 (p) cyma1 cymb1 cymc1 cymd1;
array cmm1 (p) cmma1 cmmb1 cmmc1 cmmd1;
array cym2 (p) cyma2 cymb2 cymc2 cymd2;
array cmm2 (p) cmma2 cmmb2 cmmc2 cmmd2;
array cym3 (p) cyma3 cymb3 cymc3 cymd3;
array cmm3 (p) cmma3 cmmb3 cmmc3 cmmd3;
array cym4 (p) cyma4 cymb4 cymc4 cymd4;
array cmm4 (p) cmma4 cmmb4 cmmc4 cmmd4;
array cym (i) cym1 cym2 cym3 cym4;
array cmm (i) cmm1 cmm2 cmm3 cmm4;
/*month and year change=separation, divorce, annulment*/
array cyssa1 (t) M560011Y M560012Y cyssa13 cyssa14;
array cmssa1 (t) M560011M M560012M cmssa13 cmssa14;
array cyssa2 (t) M8100111Y M8100112Y cyssa23 cyssa24;
array cmssa2 (t) M8100111M M8100112M cmssa23 cmssa24;
array cyssa3 (t) M8100211Y cyssa32 cyssa33 cyssa34;
array cmssa3 (t) M8100211M cmssa32 cmssa33 cmssa34;
array cyssa4 (t) cyssa41 cyssa42 cyssa43 cyssa44;
array cmssa4 (t) cmssa41 cmssa42 cmssa43 cmssa44;
/*collapse into month and year change=separation, divorce, annulment*/
array cyss1 (p) cyssa1 cyssb1 cyssc1 cyssd1;
array cmss1 (p) cmssa1 cmssb1 cmssc1 cmssd1;
array cyss2 (p) cyssa2 cyssb2 cyssc2 cyssd2;
array cmss2 (p) cmssa2 cmssb2 cmssc2 cmssd2;
array cyss3 (p) cyssa3 cyssb3 cyssc3 cyssd3;
array cmss3 (p) hmsas3 cmssb3 cmssc3 cmssd3;
array cyss4 (p) cyssa4 cyssb4 cyssc4 cyssd4;
array cmss4 (p) cmssa4 cmssb4 cmssc4 cmssd4;
array cyss (i) cyss1 cyss2 cyss3 cyss4;
array cmss (i) cmss1 cmss2 cmss3 cmss4;
/* Current staus of relationship */
array fstata (t) M114001 fstata2 fstata3 fstata4;
array fstatb (t) M114002 fstatb2 fstatb3 fstatb4;
array fstatc (t) fstatc1 fstatc2 fstatc3 fstatc4;
array fstatd (t) M9800111 fstatd2 fstatd3 fstatd4;
/*collapse married into array*/
array fstat (p) fstata fstatb fstatc fstatd;
/* month & 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) M10000111Y eyrd2 eyrd3 eyrd4;
array emoa (t) M117001M emoa2 emoa3 emoa4;
array emob (t) M117002M emob2 emob3 emob4;
array emoc (t) emoc2 emoc2 emoc3 emoc4;
array emod (t) M1000111M emod2 emod3 emod4;
/*collapse all start years & months into arrays*/
array eyr (p) eyra eyrb eyrc eyrd;
array emo (p) emoa emob emoc emod;
array divoa (t) M4350A1 divoa2 divoa3 divoa4;
array divob (t) divob1 divob2 divob3 divob4;
array divoc (t) divoc1 divoc2 divoc3 divoc4;
array divod (t) divod1 divod2 divod3 divod4;
/*collapse divorced into array*/
array divo (p) divoa divob divoc divod;
/* month & year divorced */
array divoya (t) M4360A1y divoya2 divoya3 divoya4;
array divoyb (t) divoyb1 divoyb2 divoyb3 divoyb4;
array divoyc (t) divoyc1 divoyc2 divoyc3 divoyc4;
array divoyd (t) divoyd1 divoyd2 divoyd3 divoyd4;
array divoma (t) M4360A1M divoma2 divoma3 divoma4;
array divomb (t) divomb1 divomb2 divomb3 divomb4;
array divomc (t) divomc1 divomc2 divomc3 divomc4;
array divomd (t) divomd1 divomd2 divomd3 divomd4;
/*collapse all divorced years & months into arrays*/
array divoy (p) divoya divoyb divoyc divoyd;
array divom (p) divoma divomb divomc divomd;
/* 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;
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;
do l=1 to dlicm;
if l=dlicm then
do;
cohhr8=r8co;
marsr8=r8mars;
end;
end;
if pubid in (2148) then cohhr8=-4;
/* Find spouse & partner link from Round 1 to Round 8 */
%let n=4;
array slink(&n); array sco(&n); array plink(&n); array pco(&n);
do i=1 to &n;
slink{i}= 0;
plink{i}=0;
sco{i}=0;
pco{i}=0;
end;
drop i;
do i=1 to 4;
do l=169 to dlicm until (r8mars=2 & r8co=200+i);
if r8mars=2 & r8co=200+i
then
do ;
slink{i}=r8link;
sco{i}=r8co;
end;
end;
do l=169 to dlicm until (r8mars=1 & r8co=100+i);
if r8mars=1 & r8co=100+i
then
do ;
plink[i}=r8link;
Pco{i}=r8co;
end;
end;
/* married, but cohabiting with someone else */
do l=169 to dlicm until(r8mars=2 & r8co=100+i+1);
if r8mars=2 & r8co=100+1+i
then
do ;
plink[i}=r8link;
Pco{i}=r8co;
end;
end;
end;
do l=169 to dlicm ;
if (slink1=0 | slink1=-4) & premar_ttl>0 then
do;
slink1=p1;
sco1=201;
cohhr8=sco1;
end;
end;
/* Spouses or partner were missing in previous Rounds. They are back in current
Round
flagcohhr8=1 means Spouses or partner were brought back in r9. */
do i=1 to 4; /* loop i */
if ((cohhr8<=-4 or cohhr8=. ) & flagp=1 ) then flagcohhr8=1;
if flagcohhr8=1 then do;
if par{i}=slink{i} & premar_ttl>0 then cohhr8=sco{i};
else if par{i}=Plink{i} then cohhr8=pco{i};
else if par{i} ^= Plink{i} & Plink{i}>0 then cohhr8=100+precoh_ttl;
else if par{i} ^= slink{i} & slink{i}>0 then cohhr8=sco{i};
else if par{i}=Plink{i} & cohhr8^=max(of pco1- pco4) then cohhr8=max(of
pco1-pco4);
end;
end;
if pubid= 2642 then flagp=1;
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 -4<cdli<0 then cdli=0;
if cdli=0 then ymsc=dliym;
if( mdli=1 | mdli=2) then cmars=0;
if (mdli=3 | mdli=4) then
do;
cmars=1;
ymsm=dliym;
end;
if mdli=5 | mdli=6 then
do;
cmars=2;
ymss=dliym;
end;
if mdli=7 | mdli=8 then cmars=3;
if mdli=9 | mdli=10 then cmars=4;
if cmars=4 then do;
imars=4;
ymss=dliym;
cems=doicm;
end;
if mdli<0 & mdli ^= -4 then cmars=mdli;
if mdli=-3 & premar_ttl>0 then
do;
cmars=1;
ymsm=dliym;
end;
if ysc>0 & msc>0 & ysc gt bdate_y then ymsc=(ysc*100)+msc;
/* If a start year | month is missing & flagp ^= 1 then set it to dli.
*/
if (-3 le ysc le 0 | -3 le msc le 0) then ymsc=dliym;
if (-3 le ysc le 0 & -3 le msc le 0) then ymsc=dliym;
csmc=(round(ymsc,100)-198000)*.12+(ymsc-round(ymsc,100));
/* If a start year & month are missing, then set it to dli. */
if -3 <= ysc <= 0 | -3 le msc <= 0 then ymsc=dliym;
if -3 <= ysc <= 0 & -3 le msc <= 0 then ymsc=dliym;
if ysc > 0 & -3 <= msc <= 0 then ymsc=(ysc*100)+1;
if yec>0 & mec>0 & yec gt bdate_y then ymec=(yec*100)+mec;
if (-3 <=yec <= 0 | -3 <= mec <= 0)
& (cbeg ^= 1 &/* cbeg2 ^=1 &*/ cdli^= 1) then ymec=iym;
if (-3 <=yec <= 0 | -3 <= mec <= 0)
& (fstat=3 | fstat=4) & eyr >0 & emo >0 then ymec=(eyr*100)+emo;
if yec>0 & -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 |cbeg=1) then cemc=doicm;
if m910011=1 then cemca2=doicm;
if m910012=1 then cemca3=doicm;
if m910013=1 then cemca4=doicm;
if m910021=1 then cemcb2=doicm;
if m910022=1 then cemcb3=doicm;
if flagp1=1 then cemca1=start-1;
if mbeg=1 then do;
cmars=1;
imars=1;
ymsm=ymsc;
ymsc=.;
end;
if -4<mbeg<0 then mbeg=-4;
if mbeg=0 then imars=0;
if mbeg=-4 & cmars ^= . & cohhr8 gt 200 then imars=1;
else if mbeg=-4 & cmars ^= . & cmars ^= -4 & 100 < cohhr8 < 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 | 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;
/* Loop 1 will help to preserve the information from last round, without
this loop,
the old information could be overwritten. */
C =0;
do l=1 to doicm; /* loop 1 */
C=C+1;
if csmc>0 & cemc>0 & csmc LE C LE cemc then cohal=1;
if csmc>0 & cemc>0 & csmc LE C LE cemc then coh=1;
if cmars=1 & csmm>0 & cemm>0 & csmm le c le cemm then mal=1;
if imars=1 & csmm>0 & cemm>0 & csmm le c le cemm then m=1;
if 2 le cmars le 3 & csms>0 & cems>0 & csms le c le cems then mal=cmars;
if 2 le imars le 3 & csms>0 & cems>0 & csms le c le cems then m=imars;
if cmars =4 & csms>0 & cems>0 & csms le c le cems then mal=cmars;
if imars =4 & csms>0 & cems>0 & 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 */
if divo=1 & divoy>0 & divom>0 then
do;
cmars=3;
imars=3;
csms=( divoy-1980)*12 +divom;
cems=doicm;
end;
if divo=1 & (-4<divoy<0 | -4<divom<0) then
do;
cmars=3;
imars=3;
csms=start;
cems=doicm;
end;
if divo=1 & (divoy>0 & -4<divom<0) then
do;
cmars=3;
imars=3;
csms=( divoy-1980)*12 +1; /* set divorce month as Jan */
cems=doicm;
end;
do i=1 to 4; /* Loop 2 */
if cstat=1 & cym>0 & cmm>0 then
do;
cmars=1;
imars=1;
ymsm=cym*100+cmm;
end;
if -2 le cstat le -1 & (cym>-4 & cmm>-4 )then
do;
cmars=cstat;
imars=cstat;
end;
if cstat=1 & (-4<cym<0 | -4<cmm<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 cstat=3 & cyss>0 & cmss>0 then
do;
cmars=2;
imars=2;
ymss=(cyss*100)+cmss;
end;
/* Marriage ends in divoice */
if cstat=4 & cyss>0 & cmss>0 then
do;
cmars=3;
imars=3;
ymss=(cyss*100)+cmss;
end;
/* Get an annulment */
if cstat=5 & cyss>0 & cmss>0 then
do;
cmars=3;
imars=3;
ymss=(cyss*100)+cmss;
end;
csmm=(round(ymsm,100)-198000)*.12+(ymsm-round(ymsm,100));
if divo<-3 then
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 & 0<dlimarstat<3 then
do;
cmars=0; /* fstat=annulment, which translates into never married in collapsed
mar. status */
imars=0;
end;
if fstat=3 & eyr>0 & emo>0 then
do;
cmars=2; /* separation */
imars=2;
csms=(eyr-1980)*12 + emo;
cems=doicm;
end;
if cstat=1 & cym>0 & cmm>0 then
do;
cmars=1;
imars=1;
ymsm=cym*100+cmm;
cmarsa1=1;
imarsa1=1;
end;
if fstat=3 & (-4<eyr<0 | -4<emo<0) then
do;
cmars=2;
imars=2;
csms=doicm;
cems=doicm;
end;
if fstat=4 & eyr>0 & emo>0 then
do;
cmars=3;
imars=3;
csms=(eyr-1980)*12 + emo;
cems=doicm;
end;
if fstat=4 & (-4<eyr<0 | -4<emo<0) then
do;
cmars=3;
imars=3;
csms=doicm;
cems=doicm;
end;
if fstat=4 & ( eyr>0 & -4<emo<0) then
do;
cmars=3;
imars=3;
csms= doicm; /* set Jan*/
cems=doicm;
end;
if fstat=5 & eyr>0 & emo>0 & csmm>0 then
do;
cmars=4;
imars=4;
csms=(eyr-1980)*12 + emo;
widow=1;
end;
if fstat=5 & (-4<eyr<0 | -4<emo<0) & csmm>0 then
do;
cmars=4;
imars=4;
csms=doicm;
widow=1;
end;
if csms>0 then cems=doicm;
if -4<fstat<0 & -4<m620<0 then cmars=fstat;
/* spouse living ourside the household*/
do l=start to doicm;/*loop 1 */
if ysp>0 & msp>0 then
do;
csmm = (ysp-1980)*12+msp;
cemm=doicm;
cmars=1;
imars=1;
marcm=csmm ;
end;
if -4<ysp<0 & -4<msp<0 then
do;
csmm=start;
cemm=doicm;
cmars=1;
imars=1;
marcm=-3;
marm=-3;
mary=-3;
end;
end;/*end of loop l */
if cemc>=start & (mardli=3 | mardli=4) & (p2>900 | p3>900) then
do;
cemm=csmsa1;
if 0<p2<900 & mardli=3 then csmmb1=start;
if csmmb1>0 then cemmb1=doicm;
end;
if cemc>=start & (mardli=3 | mardli=4) & p2>900 then do;
do l=start to doicm ;
if start<=l<csmsa1 then do;
maf=1;
end;
if csmsa1=. & start<=l<csmcb1 then do;
maf=1;
end;
if csmsa1=. & csmcb1<start then do;
maf=1;
mal=1;
end;
end;
end;
end;
/* 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 & collapsed marital
status. */
C=0;
do l=1 to doicm; /* loop 1 */
C=C+1;
if csmc>0 & cemc>0 & csmc LE C LE cemc then cohal=1;
if csmc>0 & cemc>0 & csmc LE C LE cemc then coh=1;
if cmars>=1 & csmm>0 & cemm>0 & csmm le c le cemm then mal=1;
if imars>=1 & csmm>0 & cemm>0 & csmm le c le cemm then m=1;
/*if 2 le cmars le 3 & csms>0 & cems>0 & csms le c le cems then mal=cmars;
if 2 le imars le 3 & csms>0 & cems>0 & csms le c le cems then m=imars;*/
if cmars = 2 & csms>0 & cems>0 & csms le c le cems then mal=2;
if imars = 2 & csms>0 & cems>0 & csms le c le cems then m=2;
if cmars = 3 & csms>0 & cems>0 & csms le c le cems then mal=3;
if imars = 3 & csms>0 & cems>0 & csms le c le cems then m=3;
if cmars = 4 & csms>0 & cems>0 & csms le c le cems then mal=4;
if imars = 4 & csms>0 & cems>0 & 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 & cohal=1 then mars=1;
if mal=0 & cohal=0 then mars=2;
if mal=1 & cohal=1 then mars=3;
if mal=1 & cohal=0 then mars=4;
if mal=2 & cohal=1 then mars=5;
if mal=2 & cohal=0 then mars=6;
if mal=3 & cohal=1 then mars=7;
if mal=3 & cohal=0 then mars=8;
if mal=4 & cohal=1 then mars=9;
if mal=4 & cohal=0 then mars=10;
marstat=mars;
end; /* end of loop C */
end; /* end of loop l */
end;/* end of loop t*/
end;/*end of loop p*/
/* 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 marstat=-3 then cmarstat=-3;
/* Finding continue month of first cohabitation & first marriage */
do p=1 to 4; /* loop for p */
do t=1 to 4; /* loop for t */
do i=1 to 4; /* loop for i */
if yco>0 & mco>0 then do;
ymco=((yco-1980)*12)+mco;
cohcm= min (ymcoa1, ymcoa2, ymcoa3, ymcoa4,
ymcob1, ymcob2, ymcob3, ymcob4,
ymcoc1, ymcoc2, ymcoc3, ymcoc4,
ymcod1, ymcod2, ymcod3, ymcod4);
end;
if cym >0 & cmm>0 then do;
marcm= min( csmma1, csmma2, csmma3, csmma4,
csmmb1, csmmb2, csmmb3, csmmb4,
csmmc1, csmmc2, csmmc3, csmmc4,
csmmd1, csmmd2, csmmd3, csmmd4);
end;
if mbeg=1 then do;
if dlicohcm<=-4 & dlimarcm<=-4 then do;
marcm=cohcm;
cohcm=-4;
end;
else if dlicohcm>=-3 and dlimarcm<=-4 then do;
marcm=cohcm;
end;
end;
end;
end;
end;
if dlicohcm>0 then cohcm=dlicohcm;
if dlimarcm>0 then marcm=dlimarcm;
array cvcm cohcm marcm;
array cvy cohy mary;
array cvm cohm marm;
array fir firstc324-firstc157;
do over cvcm;
do i=324 to 157 by -12;
fir=i;
if fir-11<=cvcm<=fir then do;
cvm=cvcm-(fir-12);
cvy=(cvcm-cvm)/12+1980;
end;
end;
if cvcm=. then do;
cvcm=-4;
cvy=-4;
cvm=-4;
end;
end;
do p=1 to 4;
do t=1 to 4;
do i=1 to 4;
if -4<ysc<0 & -4<msc<0 then do;
cohm=-3;
cohy=-3;
cohcm=-3;
end;
if -4<ysc<0 & msc>0 then do;
cohm=msc;
cohy=-3;
cohcm=-3;
end;
if ysc>0 & -4<msc<0 then do;
cohm=-3;
cohy=ysc;
cohcm=-3;
end;
if -4<cym<0 & -4<cmm<0 & marcm<0 then do;
marm=-3;
mary=-3;
marcm=-3;
end;
if -4<cym<0 & cmm>0 & marcm<0 then do;
marm=cmm;
mary=-3;
marcm=-3;
end;
if cym>0 & -4<cmm<0 & marcm<0 then do;
marm=-3;
mary=cym;
marcm=-3;
end;
end;
end;
end;
do p=1 to 4;
do t=1 to 4;
if mbeg=1 & -3<ysc<0 & -3<msc<0 & dlicohcm=-4 & dlimarm=-4 then
do;
cohm=-4;
cohcm=-4;
cohy=-4;
marcm=-3;
mary=-3;
marm=-3;
end;
if mbeg=1 & ysc>0 & -3<msc<0 & dlicohcm=-4 & dlimarm=-4 then
do;
cohm=-4;
cohcm=-4;
cohy=-4;
marcm=-3;
mary=ysc;
marm=-3;
end;
end;
end;
/*if old date present & don't deny then use old date*/
if dlicohm >-4
then do;
cohcm= dlicohcm;
cohy= dlicohy;
cohm= dlicohm;
end;
if dlimarcm>-4
then do;
marcm=dlimarcm;
mary=dlimary;
marm=dlimarm;
end;
/*Marital status for event history*/
do l=start to doicm;
if -2 le mal le -1 then mars=-3;
if mal=0 & cohal=1 then mars=1;
if mal=0 & cohal=0 then mars=0;
if mal=1 & cohal=1 then mars=2;
if mal=1 & cohal=0 then mars=2;
if mal=2 & cohal=1 then mars=3;
if mal=2 & cohal=0 then mars=3;
if mal=3 & cohal=1 then mars=4;
if mal=3 & cohal=0 then mars=4;
if mal=4 & cohal=1 then mars=5;
if mal=4 & cohal=0 then mars=5;
end;
*for the documentation except the marital status;
do l=start to doicm;
if cohaf=1 | cohas=1 | cohat=1 | cohafour=1 then cohaa=1;
if cohbf=1 | cohbs=1 | cohbt=1 | cohbfour=1 then cohbb=1;
if cohcf=1 | cohcs=1 | cohct=1 | cohcfour=1 then cohcc=1;
if cohdf=1 | cohds=1 | cohdt=1 | cohdfour=1 then cohdd=1;
if maf=1 | mas=1 | mat=1 | mafour=1 then maa=1;
if mbf=1 | mbs=1 | mbt=1 | mbfour=1 then mbb=1;
if mcf=1 | mcs=1 | mct=1 | mcfour=1 then mcc=1;
if mdf=1 | mds=1 | mdt=1 | 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 & cohdd=1 then cohh=204;
if mcc=1 & cohcc=1 then cohh=203;
if mbb=1 & cohbb=1 then cohh=202;
if maa=1 & cohaa=1 then cohh=201;
end;
/* Mar_Dual */
do l=start to doicm;
if cohh>0 & cohh ^= 204 & cohh ^= 104 & cohdd=1 then dual=104;
if cohh>0 & cohh ^= 204 & cohh ^= 104 & mdd=1 then dual=204;
if cohh>0 & cohh ^= 203 & cohh ^= 103 & cohcc=1 then dual=103;
if cohh>0 & cohh ^= 203 & cohh ^= 103 & mcc=1 then dual=203;
if cohh>0 & cohh ^= 202 & cohh ^= 102 & cohbb=1 then dual=102;
if cohh>0 & cohh ^= 202 & cohh ^= 102 & mbb=1 then dual=202;
end;
*Mar_partner_Link;
do l=1 to doicm;
if cohdd=1 | mdd=1 then link=p4;
if cohcc=1 | mcc=1 then link=p3;
if cohbb=1 | mbb=1 then link=p2;
if cohaa=1 | maa=1 then link=p1;
if p1<900 & p2>900 and (cohbb=1 | mbb=1) then link=p2;
end;
do l=start to 290 ;
if pubid= 3430 then link=p1;
end;
nump8=precoh_ttl;
nums8=premar_ttl;
if (nump8=. | nump8<0) then nump8=0;
if (nums8=. | nums8<0) then nums8=0;
numr8=max(nump8,nums8);
/* Add the parters & spouses from round 1 to round 9*/
do l=start to doicm;
if cohh>0 & 100<cohh<200 then cohh=cohh+nump8;
else if cohh>200 then cohh=cohh+nums8;
if dual>0 & numr8>0 then dual=dual+numr8;
end;
*Find the number of partners & spouses in round 9;
do l=start to doicm;
if 100 lt cohh lt 200 then r9pt=cohh-100;
if cohh gt 200 then r9sp=cohh-200;
end;
/* stop cohabitation before dli*/
if 0<p1<900 & p2>900 & cemca1<start then flagpcount=1;
if pubid in
(2845, 4276, 594, 3438, 3678, 5695, 4335, 4608, 2642) then flagpcount=1;
if pubid in(4040, 4998, 5226) then flagp=0;
/* If the respondent cohabited with the partner/spouse from last interview */
if 100 lt cohhr8 lt 200 & flagp=1
then do;
do l=start to doicm;
if 100 lt cohh lt 200 & r9pt=min(of r9pt169-r9pt320) & flagpcount ^=1 then
cohh=cohhr8;
else if 100 lt cohh lt 200 then cohh=cohh-1;
if 100 lt cohh lt 200 & 0<p1<900 & 0<p2<900 & p3=-4 then cohh=cohhr8;
if 100 lt cohh lt 200 & (0<p1<900 & 0<p2<900 & p3>900 | P1<900 & p2<900 & p3<900
& p4>900) then do;
if cohh> cohhr8 then cohh=cohhr8+1;
end;
if cohh gt 200 & r9sp=min(of r9sp169-r9sp320) & flagpcount ^=1 then
cohh=200+(cohhr8-100) ;
else if cohh gt 200 then cohh=cohh-1;
if 100 lt dual lt 200 & r9pt=min(of r9pt169-r9pt320) then dual=cohhr8;
else if 100 lt dual lt 200 then cohh=dual-1;
if dual gt 200 & r9sp=min(of r9sp169-r9sp320) then dual=200+(cohhr8-200);
else if dual gt 200 then dual=dual-1;
end;
end;
if cohhr8>200 & flagp=1
then do;
do l=start to doicm;
if cohh gt 200 & r9sp=min(of r9sp169-r9sp319) & flagpcount ^=1 then cohh=cohhr8;
else if cohh gt 200 then cohh=cohh-1;
if 100 lt cohh lt 200 & ( r9pt=min(of r9pt169-r9pt319) & flagpcount ^=1 |
0<p1<900 & 0<p2<900 & p3=-4) & nump8>0
then cohh=100+nump8;
else if 100 lt cohh lt 200 then cohh=cohh-1;
if 100 lt cohh lt 200 & (0<p1<900 & 0<p2<900 & p3>900 | P1<900 & p2<900 & p3<900
& p4>900)
then cohh=nump8+1+100;
if dual gt 200 & r9sp=min(of r9sp169-r9sp319) then dual=cohhr8;
else if dual gt 200 then dual=dual-1;
if 100 lt dual lt 200 & r9pt=min(of r9pt169-r9pt319) then dual=100+(cohhr8-200);
else if 100 lt dual lt 200 then dual=dual-1;
end;
end;
do l =start to doicm;
if (dual=101 | dual=102 | dual=103 | dual=104) then r9dual=1;
else if cohh=101 & r9dual ^= 1 then r9dual=0;
else if cohh=102 & r9dual ^= 1 then r9dual=0;
else if cohh=103 & r9dual ^= 1 then r9dual=0;
else if cohh=104 & r9dual ^= 1 then r9dual=0;
else if cohh=201 & r9dual ^= 1 then r9dual=0;
else if cohh=202 & r9dual ^= 1 then r9dual=0;
else if cohh=203 & r9dual ^= 1 then r9dual=0;
else if cohh=204 & r9dual ^= 1 then r9dual=0;
else if r9dual ^= 1 & r9dual ^= 0 then r9dual=-4;
end;
if r9dual=. then r9dual=-4;
if p2=-4 & r9dual=1 then r9dual=0;
/**Find the number of partners & spouses in round 9; */
do l=start to 320;
if 100 lt cohh lt 200 then r9pt=cohh-100;
if cohh gt 200 then r9sp=cohh-200;
end;
/* pick up max number of total mar & total cohh */
nump9=max(of r9pt169-r9pt320);
nums9=max(of r9sp169-r9sp320);
numr9=max(nump9,nums9);
coh_ttl=nump9;
mar_ttl=nums9;
if nump9=. then coh_ttl=precoh_ttl;
if nums9=. then mar_ttl=premar_ttl;
if p1=-4 & p2=-4 & p3=-4 & p4=-4 then do;
coh_ttl=precoh_ttl;
mar_ttl=premar_ttl;
end;
do l=start to doicm;
do i=1 to 4;
if cohh>=200+i & premar_ttl=i-1 then
do;
cohh=200+i;
mar_ttl=i;
end;
end;
end;
/* for R's first time cohh & married at same time */
do p=1 to 4; /* loop for p */
do t=1 to 4; /* loop for t */
if mbeg=1 & Mar_ttl>0
& precoh_ttl<=0 & dlicohcm<-3 then
do;
coh_ttl=0;
cohcm=-4;
cohy=-4;
cohm=-4;
end;
if ysp>-4 & msp>-4 then mar_ttl=1;
end;
end;
if mar_ttl>0 & coh_ttl=0 & cohcm>-4 then do;
cohy=-4;
cohm=-4;
cohcm=-4;
end;
if precoh_ttl>coh_ttl & coh_ttl>0 then coh_ttl=precoh_ttl;
/*Spouse is missing in household Roster add in r9*/
do p=1 to 4; /* loop for p */
do t=1 to 4; /* loop for t */
if dlimarstat=-3 and premar_ttl>0 and m620 in (-1, -2) and fstat=-4
then do;
do l=start to doicm;
marstat=dlimarstat;
cmarstat=dlimarstat;
mars=dlimarstat;
end;
end;
end;
end;
/* Married but living with someone else.
Have to find out who is spouse and who is partner if there are more then one
loop in current round.
coded marstat=4, married spouse absent
slink is the spouse link. only one exception. If the spouse is living outside of
household then slink=0*/
matchlink=0;
flagslink=0;
do i=1 to 4;
do l=start to doicm until(mars=2 & cohh=200+i);
if mars=2 & cohh=200+i
then do ;
slink{i}=link;
end;
end;
end;
do l=doicm;
if marstat=3 then r9link=link;
end;
/* Find partner link in R9. */
do i=1 to 4;
if slink{i}=r9link & r9link>0 then matchlink=1;
end;
if matchlink ne 1 & marstat=3 then flagslink=1;
if flagslink=1 then marstat=4 ;
/* The code below is finding the missing spouse if the
spouse is missing in household & partner rosters,
respondent is cohabiting with someone else*/
spouse=0;
cspouse=0;
do t=1 to 4;
do i=1 to 4;
if slink{i}>0 & par{t}>0 then do;
if par{t}=slink{i} & marstat>2 then spouse=1 ;
end;
end;
end;
if mar_ttl>0 & 2<marstat <7 & spouse =0 & slink1>0 then cspouse=1;
/** If R's answer m620=3 in previous two rounds, we coded current marstat status
as divorced*/
if cspouse=1 and ((dlim620=3 | dlim620=2) & m620=3 ) then do;
do l=start to doicm;
if p1=-4 | pubid= 2970 then do;
mars=4;
marstat=8;
cmarstat=3;
end;
end;
end;
if cspouse=1 and ((dlim620=3 | dlim620=2)& m620=3 & p1>0 & marstat<=5) then do;
do l=start to doicm;
mars=4;
marstat=7;
cmarstat=3;
end;
end;
if cspouse=1 and ((dlim620<2 & m620=3) | m620=0) & dlimarstat ne 5 and
dlimarstat ne 6 |
pubid= 6056| pubid = 5323 then do;
do l=start to doicm;
mars=-3;
marstat=-3;
cmarstat=-3;
if link=. then link=-3;
end;
end;
/* if m620=2 in current round and m620=2 in previous round then code current marstat
status
as separated. */
if cspouse=1 and (dlim620=2 & m620=2) then do;
do l=start to doicm;
if p1=-4 | (m46701 ne 1 & m47001 ne 1) then do;
mars=3;
marstat=6;
cmarstat=2;
end;
end;
end;
if cspouse=1 and (dlim620=2 & m620=2) then do;
do l=start to doicm;
if p1>0 & (m47001=1 | m46701=1) then do;
mars=3;
marstat=5;
cmarstat=2;
end;
end;
end;
/* Annulment*/
if pubid= 7443 then do;
do l=start to doicm;
mars=0;
marstat=2;
cmarstat=0;
end;
end;
/* Married but living with someone else - fill in with spouse link if spouse
link is missing */
do l=start to doicm;
do i=1 to 4;
if (3<=marstat<=4) & (3<=dlimarstat<=4) then do;
if link=. & slink{i}>0 then do;
link= slink{i};
end;
end;
end;
end;
/* m4359a1=3 */
do l=start to doicm;
if m4350a1=3 & mar_ttl>0 then do;
mars=2;
if link=-4 | link=. then link=slink1;
marstat=4;
cmarstat=1;
end;
end;
if pubid = 7392 then do;
do l=start to doicm;
cohh=-4;
marstat=4;
end;
end;
if pubid= 5076 then do;
coh_ttl=1;
cohcm=313;
cohy=2006;
cohm=1;
end;
if pubid= 5775 then do;
do l=303 to 310 ;
link=801;
end;
end;
if pubid= 3685 then do;
do l=start to 306;
mars=-3;
end;
do l=301 ;
link=-3;
end;
end;
do l=start to doicm ;
if pubid = 4061 then do;
if mars=0 then mars=3;
end;
if pubid = 4779 then do;
if mars=0 then mars=2;
end;
end;
/* Annulment M11400=2 */
if pubid in (353, 3350) then do;
do l=start to doicm;
if mars>-4 then mars=-3;
if link>-4 then link=-3;
end;
marstat=-3;
cmarstat=-3;
end;
if int_y=-5 then do;
mar_ttl =-5;
marstat =-5;
cmarstat=-5;
coh_ttl =-5;
marm=-5;
mary=-5;
marcm =-5;
cohcm=-5;
cohm=-5;
cohy=-5;
r9dual=-5;
end;
do l=start to doicm;
if dual=. then dual=-4;
if mars=. then mars=-4;
if link=. then link=-4;
if cohh=. then cohh=-4;
end;
if doicm=-5 then do;
do l=start to doicm;
mars=-4;
cohh=-4;
dual=-4;
link=-4;
end;
end;
do l=169 to 320;
if mars=. then mars=-4;
if link=. then link=-4;
if cohh=. then cohh=-4;
end;
endsas;
Variables Created:
Variables Used
| Data from Previous Rounds: Created Variables from all loops (x) in past rounds (y) | ||||
| Name in Program | Question Name in Data | |||
| CVMOBxRy | CV_CHILD_BIRTH_MONTH.0x | |||
| CVBMxRy | CV_CHILD_BIRTH_DATE.0x~M | |||
| CVBYxRy | CV_CHILD_BIRTH_DATE.0x~Y | |||
| DMy | CV_CHILD_DEATH_DATE.0x~M | |||
| DYy | CV_CHILD_DEATH_DATE.0x~Y | |||
| MODy | CV_CHILD~DEATH_MONTH.0x | |||
| CVSTATxRy | CV_CHILD_STATUS.0x | |||
|
Data from Round 9: |
||||
| Name in Program | Question Name in Data | Name in Program | Question Name in Data | |
|
status1-status7 |
YFER-1850.01-.07 |
BD01, BM01, BY01 |
BIOADOPTCHILD_BDATE.01~D, ~M, ~Y |
|
|
f4830_1, f4830_2 |
YFER-4830.01, .02 |
BD02, BM02, BY02 |
BIOADOPTCHILD_BDATE.02~D, ~M, ~Y |
|
|
f5900_1, f5900_2 |
YFER-5900.01, .02 |
BD03, BM03, BY03 |
BIOADOPTCHILD_BDATE.03~D, ~M, ~Y |
|
|
YFER12001-YFER12006 |
YFER-1200.01-.06 |
BD04, BM04, BY04 |
BIOADOPTCHILD_BDATE.04~D, ~M, ~Y |
|
|
YFER13001D |
YFER-1300.01~D |
BD05, BM05, BY05 |
BIOADOPTCHILD_BDATE.05~D, ~M, ~Y |
|
|
YFER13001M |
YFER-1300.01~M |
BD06, BM06, BY06 |
BIOADOPTCHILD_BDATE.06~D, ~M, ~Y |
|
|
YFER13001Y |
YFER-1300.01~Y |
DEAD01-DEAD06 |
BIOADOPTCHILD_DEAD.01-.06 |
|
|
YFER13002D |
YFER-1300.02~D |
dm01, dy01 |
BIOADOPTCHILD_DOD.01~M, ~Y |
|
|
YFER13002M |
YFER-1300.02~M |
dm02, dy02 |
BIOADOPTCHILD_DOD.02~M, ~Y |
|
|
YFER13002Y |
YFER-1300.02~Y |
dm03, dy03 |
BIOADOPTCHILD_DOD.03~M, ~Y |
|
|
adopt1-adopt4 |
YFER-5850.01-.04 |
bioid01-bioid06 |
BIOADOPTCHILD_ID.01-.06 |
|
|
biouid01-biouid06 |
BIOADOPTCHILD_UID.01-.06 |
RESIDE01-RESIDE06 |
BIOADOPTCHILD_RESIDE.01-.06 |
|
Codes for Created Variables
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.
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 |
/* delete extra loop*/
if pubid in (1790, 2026, 2535, 6640, 8460, 8577, 8757,
2415, 6856) then do;
F18101 =-4;
F18201 =-4;
F18102 =-4;
F18202 =-4;
F18103 =-4;
F18203=-4;
F18104=-4;
F18204=-4;
F18105=-4;
F18205=-4;
F18106=-4;
F18206=-4;
end;
/* Hand edits using all available information */
if pubid = 7596 then do;
F18101 =-4;
F18201 =-4;
F18102 =1;
F18202 =1;
end;
if pubid = 5496 then do;
bm3=5;
by3=2005;
dm3=5;
dy3=2005;
bioid3=921;
end;
if pubid = 1409 then do;
by1=-3;
bm1=-3;
end;
if pubid = 7849 then do;
by3=-3;
bm3=-3;
end;
if pubid = 8620 then do;
dead4=1;
end;
if pubid = 2516 then do;
status1 =f59001;
end;
if pubid = 6124 then bm3=4;
array cv_prebm (7, 8) cvbm1R1-cvbm1R8 cvbm2R1-cvbm2R8 cvbm3R1-cvbm3R8
cvbm4R1-cvbm4R8
cvbm5R1-cvbm5R8 cvbm6R1-cvbm6R8 cvbm7R1-cvbm7R8;
array cv_preby (7, 8) cvby1R1-cvby1R8 cvby2R1-cvby2R8 cvby3R1-cvby3R8
cvby4R1-cvby4R8
cvby5R1-cvby5R8 cvby6R1-cvby6R8 cvby7R1-cvby7R8;
array cv_premob (7, 8) cvmob1R1-cvmob1R8 cvmob2R1-cvmob2R8 cvmob3R1-cvmob3R8
cvmob4R1-cvmob4R8
cvmob5R1-cvmob5R8 cvmob6R1-cvmob6R8 cvmob7R1-cvmob7R8;
array cv_prestat (7, 8) cvstat1R1-cvstat1R8 cvstat2R1-cvstat2R8
cvstat3R1-cvstat3R8 cvstat4R1-cvstat4R8
cvstat5R1-cvstat5R8 cvstat6R1-cvstat6R8 cvstat7R1-cvstat7R8;
%let n=8;
array dlibm(&n);
array dliby(&n);
array dlimob(&n) ;
array dlistat(&n);
array pint_cmr(&n);
%let n=8;
do i=1 to (&n);
do t=1 to 7;
if pint_cmr(i)>0 then do;
dlibm(t)= cv_prebm (t,i);
dliby(t)= cv_preby (t,i);
dlimob(t)= cv_premob (t,i);
dlistat(t)=cv_prestat(t,i);
end;
end;
end;
drop i;
drop t;
/* create a variable indicating the bmonth(i), birth month, and byear(i),
birth year,
for each biological child. */
array bmonth (8) bm1-bm8;
array byear (8) by1-by8;
array mob (8) mob1-mob8;
array f1200 (8) f12001-f12008;
array f1300m (8) f1300m1-f1300m8;
array f1300y (8) f1300y1-f1300y8;
array f1300mob (8) f1300mob1-f1300mob8;
/* create a continuous month scheme variable for the month of birth of
the children
using the formula: (12*(byear(i)-1980)+bmonth(i)) */
do i=1 to 8;
mob(i)=-4;
if bmonth(i) > 0 & byear(i)>0 then mob(i)=12*(byear(i)-1980)+bmonth(i);
if f1300m(i) > 0 & f1300y(i)>0 then f1300mob(i)=12*(f1300y(i)-1980)+f1300m(i);
if -4<bmonth(i) <0 then bmonth(i) =-3;
if -4<byear(i) <0 then byear(i) =-3;
if bmonth(i) = -3 | byear(i)=-3 then mob(i) =-3;
if -4<f1300m(i)<0 | -4<f1300y(i)<0 then f1300mob(i) =-3;
if bmonth(i) = -5 then mob(i)=-5;
end;
/* create an actual date variable for the date of death of the youth's
children */
array dmonth(8) dm1-dm8;
array dyear(8) dy1-dy8;
array modeath (8) mod1-mod8;
array dead(8) dead1-dead8;
array reside(8) reside1-reside8;
array adoptout(8) ADOPTEDOUT1-ADOPTEDOUT8;
array adoptin (8) ADOPTED1-ADOPTED8;
array f4830 (3) f48301-f48303;
array bioid (8)bioid1-bioid8;
array f5900 (3) f59001-f59003;
array status (8) status1-status8;
array stat_n(8) stat_n1-stat_n8;
array biores(8) biores1-biores8;
array bionres(8) bionres1-bionres8;
array dchild (8) f18101-f18108;
array ddchild (8) f18201-f18208;
do i=5 to 8;
dmonth(i)=-4;
dyear(i)=-4;
end;
/* delete extra loops in key variables */
do i=1 to 8;
if bioid(i)=-4 & status(i)>=0 then do;
deletea=1;
reside(i)=-4;
status(i)=-4;
end;
end;
/* 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 8;
if dmonth(i)=-4 then modeath(i)=-4;
if dmonth(i) gt 0 and dyear(i) ge 1980 then
modeath(i)=12*(dyear(i)-1980)+dmonth(i);
if -3<=dmonth(i)<=-1 | -3<=dyear(i)<=-1 then modeath(i)=-3;
if dmonth(i)=-5 then modeath(i)=-5;
end;
/*update status for newly born children*/
do j=1 to 8;
do i=1 to 3;
if f4830(i)>900 then do;
if f4830(i)=bioid(j) then status(j)=f5900(i);
end;
end;
end;
do i=1 to 8;
if (status(i)=-4 | status(i)=.) and mob(i)>-4 then status(i)=9999;
end;
do i=1 to 8;
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 | status(i)=-2 | 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;
do i=1 to 8;
if dmonth(i)> -4 | dead(i)=1 then do;
stat_n(i)=2;
flagdeath=1;
end;
if stat_n(i)=-16 and (dlistat(i)=1 or adoptout(i)=1)
then do;
stat_n(i)=1;
end;
if stat_n(i)=-16 then do;
stat_n(i)=-3 ;
end;
end;
/* set up adopted new child(ren) flag. */
flagadoptin=0;
do i=1 to 8;
if adoptin(i)=1 then do;
flagadoptin=1;
bmonth(i)=-4;
byear(i)=-4;
mob(i)=-4;
dmonth(i)=-4;
dyear(i)=-4;
modeath(i)=-4;
status(i)=-4;
stat_n(i)=-4;
reside(i)=-4;
end;
end;
do i=1 to 8;
if stat_n(i)=5 then reside(i)=1;
else if (stat_n(i)=3 | stat_n(i)=4 | stat_n(i)=1) then reside(i)=0;
else if stat_n(i)=2 then reside(i)=-4;
else if stat_n(i)=-3 then reside(i)=-3;
end;
do i=1 to 8;
biores(i)=0;
bionres(i)=0;
if reside(i)=1 & adoptin(i) ^= 1 & dead(i) ^= 1 then biores(i)=1;
if reside(i)=0 & adoptin(i) ^= 1 & dead(i) ne 1 then bionres(i)=1;
end;
do i=1 to 7;
if (dchild(i)=1 & ddchild(i)=1 | dlistat(i)=6)
& (status(i)=-4 | status(i) =10 ) & adoptin(i) ^= 1 | pubid = 7672 then do;
bmonth(i)= dlibm(i);
byear(i)= dliby(i);
mob(i)= dlimob(i);
stat_n(i)=6;
tbiores =-3;
tbionres=-3;
end;
end;
/** END OF ROUND8 FIXES */
/* Children deleted by respondent. We
keep all previous information */
do i=1 to 7 until (dlistat(i)=-4);
if pubid in (2099, 8057, 7596, 440, 2019, 3977) then do;
bmonth(i) = dlibm(i);
byear(i) = dliby(i);
mob(i) = dlimob(i);
stat_n(i)=dlistat(i);
if pubid = 2099 & stat_n(i) ne 6 then stat_n(i)=4;
if pubid = 7596 then do;
stat_n1=6;
stat_n2=5;
end;
if pubid = 440 then do;
stat_n1=-3;
stat_n2=6;
end;
if pubid = 8057 then stat_n2=5;
end;
end;
tbiores = SUM(of biores1-biores8);
tbionres = SUM(of bionres1-bionres8);
do i=1 to 8;
if -4<reside(i)<0 & adoptin(i) ^= 1 & dead(i) ^= 1 then do;
tbionres=-3;
tbiores=-3;
end;
end;
if (mob1=-4 & mob2=-4 & mob3=-4 & mob4=-4 & mob5=-4 & mob6=-4 ) then tbiores=-4;
if mob1=-5 then tbiores=-5;
if (mob1=-4 & mob2=-4 & mob3=-4 & mob4=-4 & mob5=-4 & mob5=-4) then tbionres=-4;
if mob1=-5 then tbionres=-5;
/*Hand edits based on all available information */
if pubid = 403 then do;
bm1= dlibm1;
by1= dliby1;
mob1 = dlimob1;
end;
if pubid = 1722 then do;
bm1= dlibm1;
by1= dliby1;
mob1 = dlimob1;
end;
if pubid = 1763 then do;
bm4= dlibm1;
by4= dliby1;
mob4 = dlimob1;
stat_n4=6;
end;
if pubid = 1791 then do;
bm2= dlibm2;
by2= dliby2;
mob2 = dlimob2;
stat_n2=2;
dm2= 5;
dy2= 2003;
mod2 = 281;
end;
if pubid = 2426 then do;
bm3= dlibm1;
by3= dliby1;
mob3 = dlimob1;
stat_n3=2;
dm3= 8 ;
dy3= 1999 ;
mod3 = 236;
end;
if pubid = 1927 then do;
bm2= -4;
by2= -4;
mob2 = -4;
stat_n2=-4;
tbiores =1;
tbionres=0;
end;
if pubid in (3732, 3889) then do
bm1= dlibm1;
by1= dliby1;
mob1 = dlimob1;
end;
if pubid = 3126 then do;
bm2= -4;
by2= -4;
mob2 = -4;
stat_n2=-4;
tbiores =2;
tbionres=0;
end;
if pubid = 5848 then do;
bm1= dlibm1;
by1= dliby1;
mob1 = dlimob1;
stat_n1=1;
tbiores =0;
tbionres=1;
end;
end;
if pubid = 3826 then do;
bm1= dlibm1;
by1= dliby1;
mob1 = dlimob1;
end;
if pubid = 7458 then do;
bm1= dlibm1;
by1= dliby1;
mob1 = dlimob1;
stat_n1=-3;
bm2= dlibm2;
by2= dliby2;
mob2 = dlimob2;
stat_n2=-3;
tbiores =-3;
tbionres=-3;
end;
if pubid in (7676, 7905) then do;
bm2= dlibm1;
by2= dliby1;
mob2 = dlimob1;
stat_n2=6;
end;
if pubid = 7838 then do;
bm2= dlibm2;
by2= dliby2;
mob2 = dlimob2;
stat_n2=6;
end;
if pubid in (7963, 8338) then do;
bm3= dlibm1;
by3= dliby1;
mob3 = dlimob1;
stat_n3=6;;
end;
if pubid = 8448 then do;
bm4= dlibm3;
by4= dliby3;
mob4 = dlimob3;
stat_n4=6;
end;
if pubid = 8460 then do;
bm1= dlibm1;
by1= dliby1;
mob1 = dlimob1;
end;
if pubid = 8637 then do;
bm4= dlibm4;
by4= dliby4;
mob4 = dlimob4;
stat_n4=6;
end;
if pubid = 8792 then do;
bm1= dlibm1;
by1= dliby1;
mob1= dlimob1;
end;
if pubid = 7672 then do;
bm4 =3;
by4 =2005;
mob4=303;
stat_n4=4;
end;
/* Last, sort created variables by birthdays, so that the first child listed is
the oldest child. */
array smob (8) smob1-smob8;
do j=1 to 8;
smob(j)=mob(j);
end;
do j=1 to 8;
if smob(j)=-4 then smob(j)=1000;
if smob(j)=-3 then smob(j)=999;
end;
call sortn(of smob1-smob8);
do j=1 to 8;
if smob(j)=1000 then smob(j)=-4;
if smob(j)=999 then smob(j)=-3;
end;
array cv05bm(8) cv05bm1-cv05bm8;
array cv05by(8) cv05by1-cv05by8;
array cv05mob(8) cv05mob1-cv05mob8;
array cv05dm(8) cv05dm1-cv05dm8;
array cv05dy(8) cv05dy1-cv05dy8;
array cv05mod(8) cv05mod1-cv05mod8;
array cv05stat(8) cv05stat1-cv05stat8;
do i=1 to 8;
do j=1 to 8;
if smob(j)= mob(i) then do;
cv05bm(j) = bmonth(i);
cv05by(j) = byear(i);
cv05mob(j)= mob(i);
cv05dm(j) = dmonth(i);
cv05dy(j) = dyear(i);
cv05mod(j)= modeath(i);
cv05stat(j)= stat_n(i);
end;
end;
end;
/* Hand edits based on all available information */
if pubid = 7672 then do;
cv05dm3 = -4;
cv05dy3 = -4;
cv05mod3= -4;
end;
if pubid = 4627 then do;
cv05stat1=-3;
tbiores =-3;
tbionres=-3;
end;
if pubid = 2019 then do;
cv05dm1 = -3;
cv05dy1 = -3;
cv05mod1= -3;
cv05stat1=2;
end;
endsas;
Variable Created:
Variables Used
| Name in Program | Question Name in Data |
| residr1-residr8 | CV_TTL_RESIDENCES from rounds 1-8 |
| y3500r9 | YHHI-3500 |
| y3600r9 | YHHI-3600 |
| 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. This variable has valid data only for respondents whose parents were interviewed in round 1; respondents with no parent interview are assigned a -3 (invalid skip).
** Initialize RESID;
RESID=-4;
** If R interviewed in Round 9;
array residX (*) residr1-residr8;
do i=1 to dim(residX);
if residX(i)~=-5 then do;
residP=residX(i);
dli_rnd=i;
end;
end;
** Invalid Responses;
if residP=-1|y3600r9=-1 then RESID=-3; * refusal in DLI or in Current Round;
if residP=-2|y3600r9=-2 then RESID=-3; * dont know in DLI or in Current
Round;
if residP=-3 then RESID=-3; * Invalid BCOS parents not intd in Round 1;
if dli_rnd=1 & residP=-4 then RESID=-3; * parents not intd in Round 1 & DLI
is Round 1;
** parents intd in Round 1 & all responses valid;
if residP>=0 & y3600r9>=0 then RESID=residP+y3600r9; * Moved since DLI;
if residP>=0 & y3500r9=0 then RESID=residP; * Did not move since DLI;
** If R not interviewed in Current Round;
if y3500r9=-5 then RESID=-5;
endsas;
Variable Created:
Variables Used
| Name in Program | Question Name in Data | Name in Program | Question Name in Data | Name in Program | Question Name in Data | ||
|
Round 1: |
|
Round 4: |
|
Round 7: |
|
||
|
dobm |
KEY!BDATE_M |
y3500r4 |
YHHI-3500 |
y3500r7 |
YHHI-3500 |
||
|
doby |
KEY!BDATE_Y |
y3600r4 |
YHHI-3600 |
y3600r7 |
YHHI-3600 |
||
|
p8037r1 |
PC8-037 |
intmr4 |
CV_INTERVIEW_DATE2000 |
intmr7 |
CV_INTERVIEW_DATE2003 |
||
|
p8038r1 |
PC8-038 |
intyr4 |
CV_INTERVIEW_DATE2000 |
intyr7 |
CV_INTERVIEW_DATE2003 |
||
|
p8039r1 |
PC8-039 |
residr4 |
CV_TTL_RESIDENCE |
residr7 |
CV_TTL_RESIDENCES |
||
|
p8040r1 |
PC8-040 |
|
|
residnr7 |
CV_TTL_RESIDENCES_EDT |
||
|
p8043r1 |
PC8-043 |
Round 5: |
|
|
|
||
|
p8049r1 |
PC8-049 |
y3500r5 |
YHHI-3500 |
Round 8: |
|
||
|
intmr1 |
CV_INTERVIEW_DATE1997 |
y3600r5 |
YHHI-3600 |
y3500r8 |
YHHI-3500 |
||
|
intyr1 |
CV_INTERVIEW_DATE1997 |
intmr5 |
CV_INTERVIEW_DATE2001 |
y3600r8 |
YHHI-3600 |
||
|
residr1 |
CV_TTL_RESIDENCES_r1 |
intyr5 |
CV_INTERVIEW_DATE2001 |
intmr8 |
CV_INTERVIEW_DATE2004 |
||
|
|
|
residr5 |
CV_TTL_RESIDENCES |
intyr8 |
CV_INTERVIEW_DATE2004 |
||
|
Round 2: |
|
|
|
residr8 |
CV_TTL_RESIDENCES |
||
|
y3500r2 |
YHHI-3500 |
Round 6: |
|
residnr8 |
CV_TTL_RESIDENCES_EDT |
||
|
y3600r2 |
YHHI-3600 |
y3500r6 |
YHHI-3500 |
|
|
||
|
intmr2 |
CV_INTERVIEW_DATE1998 |
y3600r6 |
YHHI-3600 |
Round 9: |
|
||
|
intyr2 |
CV_INTERVIEW_DATE1998 |
intmr6 |
CV_INTERVIEW_DATE2002 |
y3500r9 |
YHHI-3500 |
||
|
residr2 |
CV_TTL_RESIDENCES |
intyr6 |
CV_INTERVIEW_DATE2002 |
y3600r9 |
YHHI-3600 |
||
|
|
|
residr6 |
CV_TTL_RESIDENCES |
c1070r9 |
YCHR-1070 |
||
|
Round 3: |
|
residnr6 |
CV_TTL_RESIDENCES_EDT |
c1070ar9 |
YCHR-1070a |
||
|
y3500r3 |
YHHI-3500 |
|
|
c1080r9 |
YCHR-1080 |
||
|
y3600r3 |
YHHI-3600 |
|
|
c1090r9 |
YCHR-1090 |
||
|
intmr3 |
CV_INTERVIEW_DATE1999 |
|
|
intmr9 |
CV_INTERVIEW_DATE2005 |
||
|
intyr3 |
CV_INTERVIEW_DATE1999 |
|
|
intyr9 |
CV_INTERVIEW_DATE2005 |
||
|
residr3 |
CV_TTL_RESIDENCES |
|
|
pubid |
PUBID |
This program calculates the number of residences in which youth has lived since age 12. This variable is only calculated for respondents who went through the childhood retrospective section in round 9.
c1090r9=-4;
array intmR (*) intmr1-intmr9;
array intyR (*) intyr1-intyr9;
array ageyR (*) ageyr1-ageyr9;
array agecmR (*) agecmr1-agecmr9;
array doicmR (*) doicmr1-doicmr9;
array y3600R (*) y3600r1-y3600r9;
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 c1070r9=1 then ttlresid2=resadd2+1;
if c1080r9>=0 then ttlresid2=resadd2+1+c1080r9;
if c1080r9=-2 then do;
if c1090r9=1 then ttlresid2=resadd2+1+2;
if c1090r9=2 then ttlresid2=resadd2+1+5;
if c1090r9=3 then ttlresid2=resadd2+1+8;
if c1090r9=4 then ttlresid2=resadd2+1+11;
end;
if c1090r9=-2 then ttlresid2=-3;
check1=.; if resadd1~=0 & resadd1~=resadd2 then check1=1;
check2=.;
if p8037r1>=0 & p8043r1>=0 & c1080r9>=0 & p8037r1+p8043r1>c1080r9 then
check2=1;
if p8037r1>=0 & p8043r1>=0 & c1080r9>=0 & p8037r1+p8043r1<c1080r9 then
check2=2;
** These cases need to be checked and then either hand edited or given a -3;
if check2=2 & c1070ar9>12 then check3=1;
RESIDN=-4;
if c1070r9>-4 then RESIDN=-3;
if c1070r9=1 & ageyr1>=12 then RESIDN=1+resadd2;
if c1070ar9>12 & c1080r9=0 then RESIDN=1+resadd2;
if 0<=c1070ar9<=12 then RESIDN=1+resadd2;
if c1070r9=-5 then RESIDN=-5;
endsas;