Tutorial: Matching Cohabiting Partners to Their Characteristics in the NLSY97

Step 5: Locate partner on partner roster collected in marriage and cohabitation section and link partner to his/her age

Using SAS, I define 3 arrays: (1) lists the partners' ids, (2) lists the partners' unique ids, and (3) lists the partners' ages. The first array, named pid, is made up of the variables that indicate the partner's id. A match between the value of "firstpid" and the value in this array that is needed to find the partner's age. The second array, named puid, is made up of the variables that provide the unique id of the respondent's partners. The third array, named page, is made up of the variables that provide the age of the respondent's partners' for partners who were not living in the respondent's household at the time of the interview. All of three arrays have 40 elements; that is, 10 rows (one for each round of the data) and 4 columns (4 is the maximum number of partners that any respondent reports in a round). In some rounds, all respondents report fewer than 4 partners. In that case, there is no variable for the 4th partner's age or unique id. I use "blank" as a placeholder variable to fill out the array in these cases.

The sample code shows how to loop through the arrays and find the 1st partner. The 1st partner will show up for the first time in the row of the array pid is equal to the variable "round" that you created in step 4. You will need to search over the elements of this array to find the partner id that is equal to "firstpid". At this same location in the puid array, you will find the 1st partner's unique id and at the same location in the page array, you will find the 1st partner's age. You will create 2 new variables in the loop below, "partuid" which is the 1st partner's unique id and "partage" which is the 1st partner's age (again for partner's not living in the household at the date of the interview).

blank=.;
array pid (10,4)
partners_id_1_97 partners_id_2_97 blank blank
partners_id_1_98 partners_id_2_98 partners_id_3_98 blank
partners_id_1_99 partners_id_2_99 blank blank
partners_id_1_00 partners_id_2_00 partners_id_3_00 partners_id_4_00
partners_id_1_01 partners_id_2_01 partners_id_3_01 partners_id_4_01
partners_id_1_02 partners_id_2_02 partners_id_3_02 blank
partners_id_1_03 partners_id_2_03 partners_id_3_03 blank
partners_id_1_04 partners_id_2_04 partners_id_3_04 blank
partners_id_1_05 partners_id_2_05 partners_id_3_05 partners_id_4_05
partners_id_1_06 partners_id_2_06 partners_id_3_06 blank;

array puid (10,4)
partners_uid_1_97 partners_uid_2_97 blank blank
partners_uid_1_98 partners_uid_2_98 partners_uid_3_98 blank
partners_uid_1_99 partners_uid_2_99 blank blank
partners_uid_1_00 partners_uid_2_00 partners_uid_3_00 partners_uid_4_00
partners_uid_1_01 partners_uid_2_01 partners_uid_3_01 partners_uid_4_01
partners_uid_1_02 partners_uid_2_02 partners_uid_3_02 blank
partners_uid_1_03 partners_uid_2_03 partners_uid_3_03 blank
partners_uid_1_04 partners_uid_2_04 partners_uid_3_04 blank
partners_uid_1_05 partners_uid_2_05 partners_uid_3_05 partners_uid_4_05
partners_uid_1_06 partners_uid_2_06 partners_uid_3_06 blank;

array page (10,4)
YMAR3200_01_97 YMAR3200_02_97 blank blank
YMAR3200_01_98 YMAR3200_02_98 YMAR3200_03_98 blank
YMAR3200_01_99 YMAR3200_02_99 blank blank
YMAR3200_01_00 YMAR3200_02_00 YMAR3200_03_00 YMAR3200_04_00
YMAR3200_01_01 YMAR3200_02_01 YMAR3200_03_01 YMAR3200_04_01
YMAR3200_01_02 YMAR3200_02_02 YMAR3200_03_02 blank
YMAR3200_01_03 YMAR3200_02_03 YMAR3200_03_03 blank
YMAR3200_01_04 YMAR3200_02_04 YMAR3200_03_04 blank
YMAR3200_01_05 YMAR3200_02_05 YMAR3200_03_05 YMAR3200_04_05
YMAR3200_01_06 YMAR3200_02_06 YMAR3200_03_06 blank;

** for partners no longer in hh, link to characteristics **;
**link to uid **;
do k=1 to 10;
if round eq k then do;
do l=1 to 4;
if pid(k,l) eq firstpid then do;
partuid=puid(k,l); partage=page(k,l);
end;
end;
end;
end;

Step 6: For partners who were in the household use the unique id to find the partner on the household roster and link partner to his/her age

Thus far, you have found the age of the respondent's first partner for partners with whom the respondent lived between rounds, but who were no longer living with the respondent at the date of the interview. The characteristics of partners with whom the respondents were living at the time of the interview are available on the household roster for that round.

You'll use the partner's unique id to identify him or her on the household roster. To do this make the "hhuid" array of household unique id's. There are up to 17 household members in some Round 1 households. That is the largest household size across rounds, so make the arrays 10 rows (one for each round) by 17 columns (largest household size).

The sample code uses the "round" variable that you created in step 5 to find the round in which the partner is first reported by the respondent. Then check the household unique id's for that round until you find the one that is the same as the partner's unique id. At that same location in the "hhage" array, you'll find the 1st partner's age.

array hhuid (10, 17)
HHI2UID01_97 HHI2UID02_97 HHI2UID03_97 HHI2UID04_97 HHI2UID05_97
HHI2UID06_97 HHI2UID07_97 HHI2UID08_97 HHI2UID09_97 HHI2UID10_97 HHI2UID11_97 HHI2UID12_97 HHI2UID13_97 HHI2UID14_97 HHI2UID15_97 HHI2UID16_97 HHI2UID17_97
HHIUID01_98 HHIUID02_98 HHIUID03_98 HHIUID04_98 HHIUID05_98 HHIUID06_98 HHIUID07_98 HHIUID08_98 HHIUID09_98 HHIUID10_98 HHIUID11_98 HHIUID12_98 HHIUID13_98 HHIUID14_98 blank blank blank
HHIUID01_99 HHIUID02_99 HHIUID03_99 HHIUID04_99 HHIUID05_99 HHIUID06_99 HHIUID07_99 HHIUID08_99 HHIUID09_99 HHIUID10_99 HHIUID11_99 HHIUID12_99 HHIUID13_99 HHIUID14_99 blank blank blank
HHIUID01_00 HHIUID02_00 HHIUID03_00 HHIUID04_00 HHIUID05_00 HHIUID06_00 HHIUID07_00 HHIUID08_00 HHIUID09_00 HHIUID10_00 HHIUID11_00 HHIUID12_00 HHIUID13_00 HHIUID14_00 blank blank blank
HHIUID01_01 HHIUID02_01 HHIUID03_01 HHIUID04_01 HHIUID05_01 HHIUID06_01 HHIUID07_01 HHIUID08_01 HHIUID09_01 HHIUID10_01 HHIUID11_01 HHIUID12_01 HHIUID13_01 HHIUID14_01 HHIUID15_01 HHIUID16_01 blank
HHIUID01_02 HHIUID02_02 HHIUID03_02 HHIUID04_02 HHIUID05_02 HHIUID06_02 HHIUID07_02 HHIUID08_02 HHIUID09_02 HHIUID10_02 HHIUID11_02 HHIUID12_02 HHIUID13_02 blank blank blank blank
HHIUID01_03 HHIUID02_03 HHIUID03_03 HHIUID04_03 HHIUID05_03 HHIUID06_03 HHIUID07_03 HHIUID08_03 HHIUID09_03 HHIUID10_03 HHIUID11_03 HHIUID12_03 HHIUID13_03 blank blank blank blank
HHIUID01_04 HHIUID02_04 HHIUID03_04 HHIUID04_04 HHIUID05_04 HHIUID06_04 HHIUID07_04 HHIUID08_04 HHIUID09_04 HHIUID10_04 HHIUID11_04 HHIUID12_04
blank blank blank blank
HHIUID01_05 HHIUID02_05 HHIUID03_05 HHIUID04_05 HHIUID05_05 HHIUID06_05 HHIUID07_05 HHIUID08_05 HHIUID09_05 HHIUID10_05 HHIUID11_05 HHIUID12_05 HHIUID13_05 blank blank blank blank
HHIUID01_06 HHIUID02_06 HHIUID03_06 HHIUID04_06 HHIUID05_06 HHIUID06_06 HHIUID07_06 HHIUID08_06 HHIUID09_06 HHIUID10_06 HHIUID11_06 HHIUID12_06 HHIUID13_06 HHIUID14_06 blank blank blank
;

array hhage (10, 17)
HHI2AGE01_97 HHI2AGE02_97 HHI2AGE03_97 HHI2AGE04_97 HHI2AGE05_97
HHI2AGE06_97 HHI2AGE07_97 HHI2AGE08_97 HHI2AGE09_97 HHI2AGE10_97 HHI2AGE11_97 HHI2AGE12_97 HHI2AGE13_97 HHI2AGE14_97 HHI2AGE15_97 HHI2AGE16_97 HHI2AGE17_97
HHIAGE01_98 HHIAGE02_98 HHIAGE03_98 HHIAGE04_98 HHIAGE05_98 HHIAGE06_98 HHIAGE07_98 HHIAGE08_98 HHIAGE09_98 HHIAGE10_98 HHIAGE11_98 HHIAGE12_98 HHIAGE13_98 HHIAGE14_98 blank blank blank
HHIAGE01_99 HHIAGE02_99 HHIAGE03_99 HHIAGE04_99 HHIAGE05_99 HHIAGE06_99 HHIAGE07_99 HHIAGE08_99 HHIAGE09_99 HHIAGE10_99 HHIAGE11_99 HHIAGE12_99 HHIAGE13_99 HHIAGE14_99 blank blank blank
HHIAGE01_00 HHIAGE02_00 HHIAGE03_00 HHIAGE04_00 HHIAGE05_00 HHIAGE06_00 HHIAGE07_00 HHIAGE08_00 HHIAGE09_00 HHIAGE10_00 HHIAGE11_00 HHIAGE12_00 HHIAGE13_00 HHIAGE14_00 blank blank blank
HHIAGE01_01 HHIAGE02_01 HHIAGE03_01 HHIAGE04_01 HHIAGE05_01 HHIAGE06_01 HHIAGE07_01 HHIAGE08_01 HHIAGE09_01 HHIAGE10_01 HHIAGE11_01 HHIAGE12_01 HHIAGE13_01 HHIAGE14_01 HHIAGE15_01 HHIAGE16_01 blank
HHIAGE01_02 HHIAGE02_02 HHIAGE03_02 HHIAGE04_02 HHIAGE05_02 HHIAGE06_02 HHIAGE07_02 HHIAGE08_02 HHIAGE09_02 HHIAGE10_02 HHIAGE11_02 HHIAGE12_02 HHIAGE13_02 blank blank blank blank
HHIAGE01_03 HHIAGE02_03 HHIAGE03_03 HHIAGE04_03 HHIAGE05_03 HHIAGE06_03 HHIAGE07_03 HHIAGE08_03 HHIAGE09_03 HHIAGE10_03 HHIAGE11_03 HHIAGE12_03 HHIAGE13_03 blank blank blank blank
HHIAGE01_04 HHIAGE02_04 HHIAGE03_04 HHIAGE04_04 HHIAGE05_04 HHIAGE06_04 HHIAGE07_04 HHIAGE08_04 HHIAGE09_04 HHIAGE10_04 HHIAGE11_04 HHIAGE12_04 blank blank blank blank blank
HHIAGE01_05 HHIAGE02_05 HHIAGE03_05 HHIAGE04_05 HHIAGE05_05 HHIAGE06_05 HHIAGE07_05 HHIAGE08_05 HHIAGE09_05 HHIAGE10_05 HHIAGE11_05 HHIAGE12_05 HHIAGE13_05 HHIAGE14_05 HHIAGE15_05 HHIAGE16_05 HHIAGE17_05
HHIAGE01_06 HHIAGE02_06 HHIAGE03_06 HHIAGE04_06 HHIAGE05_06 HHIAGE06_06 HHIAGE07_06 HHIAGE08_06 HHIAGE09_06 HHIAGE10_06 HHIAGE11_06 HHIAGE12_06 HHIAGE13_06 HHIAGE14_06 blank blank blank
;

do k=1 to 10;
if k eq round then do;
do l=1 to 17;
if partuid gt 0 and partuid eq hhuid(k,l) and partage le 0 then do;
partage=hhage(k,l);
end;
end;
end;
end;