Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Linking parents information


From   David Kantor <[email protected]>
To   [email protected]
Subject   Re: st: Linking parents information
Date   Mon, 14 Mar 2005 11:13:20 -0500

At 03:40 PM 3/9/2005 -0500, Sibel Selcuk wrote:
Hi everyone,

I am trying to create variables for parents' education and age based on
parents and kids who live in the same household.  The only question that
relates the individuals' within a household is "the relationship to the
head of household".   Therefore, I have been unable to use the method
described in STATA's FAQs.

Basically, I am trying to create parents education and age variables for
all possible parent child pairs.  The possibilities are:
Head/ spouse +resident parents (grandparents/in laws)
Resident child+ Head/Spouse (mother, father)

I'd appreciate your suggestions and advice on this.  Thank you.

 Best Regards,
Sibel
[...]
...and further clarified (on 3-10-2005) ...

I have a single dataset which has the following
format.
hhnumber idcode relationship gender age_yrs educ
1 1 Head Female 52 8
1 2 Son Male 26 0
2 1 Head Male 66 10
2 2 Wife/Husband Female 66 4
2 3 Son/daughter Female 45 8
2 4 Grandchildren Male 22 11
3 1 Head Male 77 11
3 2 Wife/Husband Female 66 8
4 1 Head Male 55 15
4 2 Wife/Husband Female 51 14
4 3 Son/daughter Male 27 12
where Hhnumber is the unique household id, idcode is the person id within
the household, relationship is the relationship to the head of household
and educ is years of schooling variable.

----
If this issue is still open, I would suggest this:
Suppose your dataset is named households.

use households
ren gender c_gender
ren age_yrs c_age
ren educ c_educ
ren relationship c_relationship
ren idcode c_idcode

/* And you may want to drop cases that are Head or Wife/Husband (optional): */
drop if c_relationship == "Head" | c_relationship == "Wife/Husband"
/* -- or do whatever fits the actual encoding of c_relationship. */

/* You now have a set of potential children, though some members may not actually be children.
the "c_" distinguishes the variables as pertaining to "children".
*/
sort hhnumber
tempfile children
save `children' //

use households
sort hhnumber
joinby hhnumber using `children'

/*
Now you have all possible/potential pairs within household (and if you did the filter of heads and spouses, you will not have heads and spouses as "children") . You can now filter them as you please. You may want, for example, to drop cases of a person matched to him/herself. But other combinations may also be appropriate to drop.

Then, educ is the parental education; c_educ is the child's own education, and so forth.
*/

I hope this is what you were looking for.
You may want to look at -help joinby-.

-- David

David Kantor
Institute for Policy Studies
Johns Hopkins University
[email protected]
410-516-5404
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/




© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index