Dear all,
I got the recommendation to specify the question of my former post and give more detailed information on my data and code.
What I am trying to do is to match potential partners. So I want to partner individuals who have similar characteristics.
I use a panel dataset which looks like that for a specific year (here 1985):
In an earlier step I imputed partners age (part_age) and partners educational level by chained imputation.
Now I want to find a likely partner from the dataset for an individual who is married in 1985, but has no partner id (for example pid number 3 or 5).
There is no need for the matching to be unique, so we can assign one individual to be a "artificial partner" to more than one individual. Also, it does not matter whether the potential partner is single or already in a relationship.
I tried to solve the problem using psmatch2. Since I want to partner individuals of different sex, I thought about doing the partnering for women and men separately. So I generated the variables `gender`_age and ´gender'_edu_highest to be able to differentiate between men and women.
In the next step I tried to run:
Where treat determines the sex of the individual, so that we match a male individual with a female individual.
But the values of _id and _n1 do not really make sense or i can not identify matched partners.
Is there maybe a more straightforward way to deal with this problem of matching/ partnering in Stata?
Any help would be appreciated. Thank you very much in advance,
Toni
I got the recommendation to specify the question of my former post and give more detailed information on my data and code.
What I am trying to do is to match potential partners. So I want to partner individuals who have similar characteristics.
I use a panel dataset which looks like that for a specific year (here 1985):
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input pid syear sex age edu_highest married part_age part_edu_highest partid 1 1985 1 45 2 1 42 3 2 2 1985 2 42 3 1 45 2 1 3 1985 2 24 3 1 27 4 . 4 1985 2 45 2 0 -2 -2 -2 5 1985 1 54 1 1 51 2 . end label values sex sex label def sex 1 "[1] male", modify label def sex 2 "[2] female", modify
Now I want to find a likely partner from the dataset for an individual who is married in 1985, but has no partner id (for example pid number 3 or 5).
There is no need for the matching to be unique, so we can assign one individual to be a "artificial partner" to more than one individual. Also, it does not matter whether the potential partner is single or already in a relationship.
I tried to solve the problem using psmatch2. Since I want to partner individuals of different sex, I thought about doing the partnering for women and men separately. So I generated the variables `gender`_age and ´gender'_edu_highest to be able to differentiate between men and women.
In the next step I tried to run:
Code:
psmatch2 treat if syear==2005, mahalanobis (Female_age Female_education) neighbor(1)
But the values of _id and _n1 do not really make sense or i can not identify matched partners.
Is there maybe a more straightforward way to deal with this problem of matching/ partnering in Stata?
Any help would be appreciated. Thank you very much in advance,
Toni
Comment