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]

Re: st: Generating a Variable


From   Nick Cox <njcoxstata@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Generating a Variable
Date   Mon, 14 Feb 2011 01:21:08 +0000

This doesn't seem soluble with your example data. The only information
on who smokes concerns the mothers. Perhaps Goof wrote this mail.

However, there is an FAQ detailing technique in this territory.

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

and this also may be useful:

FAQ     . . Creating variables recording whether any or all possess some char.
        . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  N. J. Cox
        2/03    How do I create a variable recording whether any
                members of a group (or all members of a group)
                possess some characteristic?
                http://www.stata.com/support/faqs/data/anyall.html

On Sun, Feb 13, 2011 at 5:23 PM, Don Ruby <goofnmick@gmail.com> wrote:

> 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.)

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