I wish to extend my analysis of panel data to include information about the responding person's partner so I began the process of merging this extra data to my original (Responding Person) data file. The variables of interest are the same (e.g. age, sex, educ, inc, emp, ...). I collect the data from two separate data files of the HILDA survey. I collect the 'Responding person' data from the "Combined" data file (I think this is correct) and the 'Partner' data from the 'Rperson' data file (where I run a loop to append selected vars for all waves). I believe the 'unique identifier' is xwaveid (destringed), which I obtain for the responding person data. Based on HILDA suggested code (
https://melbourneinstitute.unimelb.e...rogram-library) I use the 'unique identifier' hhpxid for the partner data and then rename to xwaveid. There are about 300,000 obs in the responding person data and about 150,000 obs for the partner data. When I merged these two data files it showed I had only about 150,000 obs, which appears as though I have unintentionally deleted all non-partnered 'responding person' obs. I want information on all responding persons and about those with partners. I would appreciate assistance with the code to ensure I am not unintentionally deleting obs from the new data file. My code follows:
Code:
clear all
set memory 1g
set maxvar 32000
set more off
// Merge 'rperson' file with 'partner' file
use "C:\data\rpersondata.dta", clear
merge 1:m id wave using "C:\data\partnerdata.dta"
order id wave
sort id wave
tsset id wave
save "C:\data\rperson-partner", replace
.
I appreciate any help with the process and data.
0 Response to Adding partner data to responding person data in a panel data file
Post a Comment