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 a Variable


From   Don Ruby <[email protected]>
To   [email protected]
Subject   st: Generating a Variable
Date   Sun, 13 Feb 2011 12:23:37 -0500

Suppose I have the following data (excepting Ssmoke which I need to create):

    +--------------------------------------------------------+
    |   Mid   Sid  Famid  Msmoke   Ssmoke |
    |----------------------------------------------------------|
 1. |    1      2      1         0              1         |
 2. |    2      1      1         1              0         |
 3. |    3      4      2         1              0         |
 4. |    4      3      2         0              1         |
    +--------------------------------------------------------+

Where Mid is a mother id, Sid is a sibling id, and Famid is a family
id. Msmoke indicates that the mother smoked.

What is the simplest way to create a variable "Ssmoke" that equals 1
if a sibling smoked, and 0 otherwise? (Note, there are families in
which there are more than 2 siblings.)


Thanks,

Don
*
*   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