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 <[email protected]>
To
[email protected]
Subject
Re: st: Generating a Variable
Date
Mon, 14 Feb 2011 02:03:36 +0000
I am not very clear on your definitions. Just because the mother
smokes does not mean her children smoke.
I seem to be answering your questions twice. You can use -rowsort- to
group the same ids if the question is the same as your previous. And
my second FAQ already mentioned today explains technique for what may
be your main need.
Nick
On Mon, Feb 14, 2011 at 1:46 AM, Don Ruby <[email protected]> wrote:
> Ha ha, well, we all have n-tuple personalities. I should clarify,
> because I think this ought to be soluble. The person Sid=2 is the same
> as Mid=2. Thus, Ms and Ss smoking behavior are all contained in this
> data set, but I have only the "Msmoke" variable which refers to Ms
> smoking behavior. I now need a variable that indicates whether the
> sibling also smoked, so the created variable should be "Smoke".
>
> Is it possible to generate "Smoke" given the other columns?
>
>
>
> On Sun, Feb 13, 2011 at 8:21 PM, Nick Cox <[email protected]> wrote:
>> 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 <[email protected]> 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/