Jeromy Anglim's Blog: Psychology and Statistics


Wednesday, December 10, 2008

Merging Data Files for Dyadic Data Analysis

The following post discusses data management for dyadic data.

Context:
I recently spoke to a researcher who had conducted a study measuring a set of psychological measures and demographics on marital partners (approximately 50 pairs). The researcher had the data files for each partner separate and wanted to know how to merge the two data files.
The dataset included a focal individual who was female and their partner. For simplicity I will label this the female and the partner datasets.

Merging Female with Partner Data Files in SPSS
Data files could be merged in long or wide format. In Long format each row of the data file is an individual. In wide format each row of the data file is a dyad (female and partner). The steps outlined below assume you want to get the data file into wide format and that the female and partner data files are in separate files.

Step 1. PARTNER ID:
Ensure that there is a partner ID field that is common to both the female and the partner data files and that it has the same name in each data file. This field will be used to link the two data files together

Step 2. UNIQUE VARIABLE NAMES:
You will need to be able to discriminate between the same variable (e.g., education or age) for the female and the partner. This requires you to make every variable name unique in the two data files. A standard way of doing this is to change the variable names in the two data files by attaching a prefix. E.g., “age” becomes “p_age” for partner and “f_age” for female.

Step 3. SET UP DATA FILES FOR MERGE:
Sort both data files in ascending order by the partner ID variable.
Save the data files

Step 4. MERGE THE DATA FILES:
Open both partner and female data files in SPSS
Data Merge Files Add - Variables
Select the other data file
Select match cases on key variables in sorted files
Place the partner ID in the “key variables”
Click Okay.

As usual a simple search on Google reveals many additional resources on merging data files:

No comments:

Post a Comment