# 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.