Tutorial: Matching Cohabiting Partners to Their Characteristics in the NLSY97

Step 3: Find the partner id for the first partner

To find the id for the first partner, you will look at the element of the MAR_PARTNER_LINK array for the first element that contains a partner id. For instance, for respondent id=7525, the first partner id (501) is is found in MAR_PARTNER_LINK_02_01 (February 2001).

In Round 10, the MAR_PARTNER_LINK array is available for the months April 1994 to May 2007.

Using SAS, sample code that is provided below shows how to find the id of the first partner. The code first creates an array with all the MAR_PARTNER_LINK variables. It then loops through the array until SAS finds the first element in which the array contains a partner id. When the array first contains a value for partner id, the value of MAR_PARTNER_LINK is the id for the respondent’s first partner. I made two new variables, called (1) firstpid, that takes the value of the 1st partner id and (2) month1cohab, that indicates the number of the element in array when the respondent first cohabitated.

Array MAR_PARTNER_LINK (163)
MAR_PARTNER_LINK_01_94 MAR_PARTNER_LINK_02_94 MAR_PARTNER_LINK_03_94 MAR_PARTNER_LINK_04_94 MAR_PARTNER_LINK_05_94 MAR_PARTNER_LINK_06_94 MAR_PARTNER_LINK_07_94 MAR_PARTNER_LINK_08_94 MAR_PARTNER_LINK_09_94 MAR_PARTNER_LINK_10_94 MAR_PARTNER_LINK_11_94 MAR_PARTNER_LINK_12_94
MAR_PARTNER_LINK_01_95 MAR_PARTNER_LINK_02_95 MAR_PARTNER_LINK_03_95 MAR_PARTNER_LINK_04_95 MAR_PARTNER_LINK_05_95 MAR_PARTNER_LINK_06_95 MAR_PARTNER_LINK_07_95 MAR_PARTNER_LINK_08_95 MAR_PARTNER_LINK_09_95 MAR_PARTNER_LINK_10_95 MAR_PARTNER_LINK_11_95 MAR_PARTNER_LINK_12_95
MAR_PARTNER_LINK_01_96 MAR_PARTNER_LINK_02_96 MAR_PARTNER_LINK_03_96 MAR_PARTNER_LINK_04_96 MAR_PARTNER_LINK_05_96 MAR_PARTNER_LINK_06_96 MAR_PARTNER_LINK_07_96 MAR_PARTNER_LINK_08_96 MAR_PARTNER_LINK_09_96 MAR_PARTNER_LINK_10_96 MAR_PARTNER_LINK_11_96 MAR_PARTNER_LINK_12_96
MAR_PARTNER_LINK_01_97 MAR_PARTNER_LINK_02_97 MAR_PARTNER_LINK_03_97 MAR_PARTNER_LINK_04_97 MAR_PARTNER_LINK_05_97 MAR_PARTNER_LINK_06_97 MAR_PARTNER_LINK_07_97 MAR_PARTNER_LINK_08_97 MAR_PARTNER_LINK_09_97 MAR_PARTNER_LINK_10_97 MAR_PARTNER_LINK_11_97 MAR_PARTNER_LINK_12_97
MAR_PARTNER_LINK_01_98 MAR_PARTNER_LINK_02_98 MAR_PARTNER_LINK_03_98 MAR_PARTNER_LINK_04_98 MAR_PARTNER_LINK_05_98 MAR_PARTNER_LINK_06_98 MAR_PARTNER_LINK_07_98 MAR_PARTNER_LINK_08_98 MAR_PARTNER_LINK_09_98 MAR_PARTNER_LINK_10_98 MAR_PARTNER_LINK_11_98 MAR_PARTNER_LINK_12_98
MAR_PARTNER_LINK_01_99 MAR_PARTNER_LINK_02_99 MAR_PARTNER_LINK_03_99 MAR_PARTNER_LINK_04_99 MAR_PARTNER_LINK_05_99 MAR_PARTNER_LINK_06_99 MAR_PARTNER_LINK_07_99 MAR_PARTNER_LINK_08_99 MAR_PARTNER_LINK_09_99 MAR_PARTNER_LINK_10_99 MAR_PARTNER_LINK_11_99 MAR_PARTNER_LINK_12_99
MAR_PARTNER_LINK_01_00 MAR_PARTNER_LINK_02_00 MAR_PARTNER_LINK_03_00 MAR_PARTNER_LINK_04_00 MAR_PARTNER_LINK_05_00 MAR_PARTNER_LINK_06_00 MAR_PARTNER_LINK_07_00 MAR_PARTNER_LINK_08_00 MAR_PARTNER_LINK_09_00 MAR_PARTNER_LINK_10_00 MAR_PARTNER_LINK_11_00 MAR_PARTNER_LINK_12_00
MAR_PARTNER_LINK_01_01 MAR_PARTNER_LINK_02_01 MAR_PARTNER_LINK_03_01 MAR_PARTNER_LINK_04_01 MAR_PARTNER_LINK_05_01 MAR_PARTNER_LINK_06_01 MAR_PARTNER_LINK_07_01 MAR_PARTNER_LINK_08_01 MAR_PARTNER_LINK_09_01 MAR_PARTNER_LINK_10_01 MAR_PARTNER_LINK_11_01 MAR_PARTNER_LINK_12_01
MAR_PARTNER_LINK_01_02 MAR_PARTNER_LINK_02_02 MAR_PARTNER_LINK_03_02 MAR_PARTNER_LINK_04_02 MAR_PARTNER_LINK_05_02 MAR_PARTNER_LINK_06_02 MAR_PARTNER_LINK_07_02 MAR_PARTNER_LINK_08_02 MAR_PARTNER_LINK_09_02 MAR_PARTNER_LINK_10_02 MAR_PARTNER_LINK_11_02 MAR_PARTNER_LINK_12_02
MAR_PARTNER_LINK_01_03 MAR_PARTNER_LINK_02_03 MAR_PARTNER_LINK_03_03 MAR_PARTNER_LINK_04_03 MAR_PARTNER_LINK_05_03 MAR_PARTNER_LINK_06_03 MAR_PARTNER_LINK_07_03 MAR_PARTNER_LINK_08_03 MAR_PARTNER_LINK_09_03 MAR_PARTNER_LINK_10_03 MAR_PARTNER_LINK_11_03 MAR_PARTNER_LINK_12_03
MAR_PARTNER_LINK_01_04 MAR_PARTNER_LINK_02_04 MAR_PARTNER_LINK_03_04 MAR_PARTNER_LINK_04_04 MAR_PARTNER_LINK_05_04 MAR_PARTNER_LINK_06_04 MAR_PARTNER_LINK_07_04 MAR_PARTNER_LINK_08_04 MAR_PARTNER_LINK_09_04 MAR_PARTNER_LINK_10_04 MAR_PARTNER_LINK_11_04 MAR_PARTNER_LINK_12_04
MAR_PARTNER_LINK_01_05 MAR_PARTNER_LINK_02_05 MAR_PARTNER_LINK_03_05 MAR_PARTNER_LINK_04_05 MAR_PARTNER_LINK_05_05 MAR_PARTNER_LINK_06_05 MAR_PARTNER_LINK_07_05 MAR_PARTNER_LINK_08_05 MAR_PARTNER_LINK_09_05 MAR_PARTNER_LINK_10_05 MAR_PARTNER_LINK_11_05 MAR_PARTNER_LINK_12_05
MAR_PARTNER_LINK_01_06 MAR_PARTNER_LINK_02_06 MAR_PARTNER_LINK_03_06 MAR_PARTNER_LINK_04_06 MAR_PARTNER_LINK_05_06 MAR_PARTNER_LINK_06_06 MAR_PARTNER_LINK_07_06 MAR_PARTNER_LINK_08_06 MAR_PARTNER_LINK_09_06 MAR_PARTNER_LINK_10_06 MAR_PARTNER_LINK_11_06 MAR_PARTNER_LINK_12_06
MAR_PARTNER_LINK_01_07 MAR_PARTNER_LINK_02_07 MAR_PARTNER_LINK_03_07 MAR_PARTNER_LINK_04_07 MAR_PARTNER_LINK_05_07 MAR_PARTNER_LINK_06_07 MAR_PARTNER_LINK_07_07;

do k=1 to 163;
if MAR_PARTNER_LINK(k) gt 0 and firstpid eq . then do; month1cohab=k; firstpid=MAR_PARTNER_LINK(k);
end;

Step 4: Split 1st partner id (firstpid) into round number and loop number

The values of the MAR_PARTNER_LINK variables are the round followed by the partner number within that round. For instance, for sample member 7525, the MAR_PARTNER_LINK value in February of 2001 is 501, indicating that this partner is first listed in Round 5. You'll need to look in the partner roster in this round. To do this more efficiently, you need to split the partner id into its two components' round and number within that round.

In SAS, code that lets you split the two pieces of information can be:

withinrnd=mod(firstpid,100); /* this command yields the remainder from dividing firstpid by 100*/
round=(firstpid-withinrnd)/100;