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: Generating dummy variable with information of household survey from different observations


From   Sumiko Hayasaka <sumi.hayasaka@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: Generating dummy variable with information of household survey from different observations
Date   Sun, 6 May 2012 22:34:13 -0500

I am trying to generate a dummy variable, with information from a
household survey, which can tell if a member of the household is a
father or not. I have a household id, an individual id (per
household), and a variable that tells me which individual id is marked
as being a father (members of the family are asked if their father
lives in the household and to give their father's individual id).
Therefore, I need to assign a 1 at the row in which someone at the
household said that was a father. To illustrate this, the data is
something like this (I am trying to get the "father" variable):

household_id   individual_id   father_row   father
------------------------------------------------------------------------
  1011                 1                      .                1
  1011                 2                      .                0
  1011                 3                      1               0
  1011                 4                      1               0

  1012                 1                       2               0
  1012                 2                       .                1

  1013                  1                      .                1
  1013                  2                      .                1
  1013                  3                      2               0
  1013                  4                      1               0
  1013                  5                      1               0


So, for example, members number 3 and 4 of household number 1011
stated that their father is individual number 1 in that household.
This means that I have to put the 1 of "father" (meaning the household
member is a father) at the row where father_row indicates (no matter
how many times this is done).

Is there any way in which I can do this? I really appreciate your
help! Thank you!
*
*   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