Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: RE: using hierarchical data of household and persons, need to copy some variables from parents observations and append to children


From   Nick Cox <[email protected]>
To   "'[email protected]'" <[email protected]>
Subject   st: RE: using hierarchical data of household and persons, need to copy some variables from parents observations and append to children
Date   Tue, 14 Dec 2010 10:15:57 +0000

In addition to the suggestions of Maarten Buis, note that this is an FAQ: 

FAQ     . . Creating variables recording prop. of the other members of a group
        . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  N. J. Cox
        4/05    How do I create variables summarizing for each
                individual properties of the other members of a
                group?
                http://www.stata.com/support/faqs/data/members.html

Nick 
[email protected] 

hilary ligon

I have a household travel survey with 3 levels of data.  I have
households, persons, and trips.  All members of a household share a
household identifier "sampn" such as 20010.  Then each person in the
household is identified with the sampn and a 01, 02, 03, etc.  So, the
first person in the family is 2001001.  Finally, the trips for each
person are identified by adding another 01, 02, 03, 04 for trips to
the end of the person identifier.  The first trip of the first person
in household 20010 would be 200100101.  I have each level of data in a
separate .dta and I have a master file in which I have merged all
levels of data together.  I can also merge just households and persons
and make modifications to that prior to adding in trip data.

I am looking at effects of parent's work flexibility on children's
travel.  So, my regression model and the dataset will only include the
children.  But, I want to include characteristics about the parents.
I want to write some code that will copy the variable for work
flexibility from the parent (person 01) and append it to the
observation for the children (e.g. person 03 and person 04).  I want
to do this for each household.  Not all households have children, so I
need to be able to check if there are children.  If so, then I need to
copy parent information to end of child record.

Some households have one parent and some have two.  Some houses also
have grandparents, older siblings, etc so I can't assume there are the
only 2 adults per family's household.

Can anyone help me get the data on parents appended to the data on
their children?  This is a very large dataset and doing it manually is
not practical.


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index