# Tutorial: Matching Cohabiting Partners to Their Characteristics in the NLSY97

## Step 7: For non-resident partners from prior to the date of the NLSY97 Round 1 interview, get age from the non-resident roster in Round 1

There is one last possible location to find the age of the respondent's first partner on the Round 1 non-resident roster.

The structure is very similar to that encountered when we used the partner roster or the household roster above. We create 2 arrays: (1) contains the unique ids of all key non-residents that get rostered onto the Round 1 non-resident roster, "nruid" and (2) contains the age of those on the non-resident roster.

Because we are only checking the Round 1 non-resident roster, our arrays have only one row. The longest non-resident roster in Round 1 has 23 people on it, thus we have 23 variables in the NLSY97 that tell unique id, and 23 for age (and other characteristics) of the members of the non-resident roster. Consequently, the arrays used here have 23 elements.

If the variable we made for the 1st partner's unique id (partuid) has a value between 200 and 300, then that partner is on the Round 1 non-resident roster. The first line of the sample code below checks this condition and only executes the lines that loop through the elements in the array if the 1st partner is on the Round 1 non-resident roster. The sample code then checks to find the 1st partner's unique id, and if found fills in the variable "partage" with the corresponding age in the array "nrage".

array nruid (23)
NONHHIUID_01-NONHHIUID_23;

array nrage (23)
NONHHIAGE_01-NONHHIAGE_23;

if partuid gt 200 and partuid lt 300 then do;
do l=1 to 23;
if partuid eq nruid(l) and partage le 0 then do;
partage=nrage(l);
end;
end;
end;

## Output

You've made a variable that tells you the age of respondent's first partner, "partage"
Partage is defined for 4499 observations, has a mean value of 21.6059124, and a standard deviation of 4.2393980.

1. Up until Round 9, cohabitation was collected only for opposite sex couples. Beginning in Round 9, the NLSY97 began collecting spells of cohabitation including those with same-sex partners.
2. Note that the timing of the age of the 1st partner differs for partners currently living in the household and those who are no longer living in the household. For partners currently living in the household, the respondent reports their age in the household section at the date of the interview. For partners no longer living with the respondent, the respondent reports their age when the couple started living together.
3. The variable CV_FIRST_COHAB_MONTH will not necessarily match the information in the event history arrays. Different rules are applied when constructing the created variable versus the event history array.

Extensions: What might be more relevant is the difference in age between the respondent and his or her first partner. This requires a few more steps but is easy to figure out. The respondent's month and year of birth are collected as part of the survey, KEY!BDATE_M and KEY!BDATE_Y. For respondents, whose partner's age is reported as of the date that the couple began living together, you can calculate the respondent's age at that point: (168+month1cohab)-(KEY!BDATE_Y-1980)*12+ KEY!BDATE_M) is the respondent's age in months at that point. Note that 168+month1cohab will give you the month of first cohabitation from the event history variables. A created variable is available (CV_FIRST_COHAB_MONTH), but the value recorded in this variable will not necessarily match the event history. Note you would need to take the integer of this age, since the partner's age is reported in years. For respondents, whose partner's age is reported as of the date the interview, you can use the respondent's age at the interview. The difference between the respondent's age and the 1st partner's age can now easily be calculated.