Wednesday, March 01, 2006

st: RE: counting number of children in a household


Please don't be discouraged by the feedback to your message. Sharing your code with other Stata users is a good way to become more proficient in Stata. Your message stimulated an interesting discussion and I am sure no one intended any malice.

That said, in addition to the criticism provided by other list members I would like to mention that there is a fundamental problem with your "relationship" variable. Take the household below, with one male and three female members. A couple has one daughter who is 16 years old. This daughter in turn has a child who is 2 year old. The 16-year-old girl is therefore both a mother and a child, in the legal and biological sense. The "relationship" variable with its simple "father", "mother", "child" structure fails in this case. The situation would be further complicated if one or more of the couple's parents also lived in the household.

hhid lineno age sex 1 1 42 1 1 2 40 2 1 3 16 2 1 4 2 2

Friedrich Huebler

--- Zamira Simkins <> wrote: > The same trick can be used if you want to create variables with > parents' education: let's say you need to create mom_ed and dad_ed, > but your data only allows you to identify parents via a variable > called relationship. Say, relationship 1=dad, 2=mom, 3=children and > you have one variable called educ. Then: > > sort hhid > egen mom_ed=educ if relationship==2 > egen dad_ed=educ if relationship==1 > /*at this point hhid does not matter, as the above variables will > take a missing value if the "if" condition is not satisfied*/ > egen mom_educ=max(mom_ed), by(hhid) > egen dad_educ=max(dad_ed), by(hhid) > /*this assigns mom's and dad's education levels to all members of > the household*/ > drop mom_ed dad_ed

__________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around * * For searches and help try: * * *


Links to this post:

Create a Link

<< Home

This page is powered by Blogger. Isn't yours?