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: data management problem
From
Nick Cox <[email protected]>
To
"[email protected]" <[email protected]>
Subject
Re: st: data management problem
Date
Mon, 19 Dec 2011 10:20:27 +0000
This was an allusion to
http://www.stata.com/support/faqs/data/anyall.html
Benjamin Volland was complimentary about
http://www.stata.com/support/faqs/data/members.html
but that doesn't seem to be the problem here.
Nick
On Fri, Dec 16, 2011 at 2:17 PM, Nick Cox <[email protected]> wrote:
> There's an FAQ on such any and all problems.
On 16 Dec 2011, at 14:00, Richard Goldstein <[email protected]> wrote:
>> one way: use -egen- with the "max" function; here is an example:
>>
>> egen atleastone=max(dummy_member_is_pensioner), by(hh_id)
On 12/16/11 8:44 AM, Ivica Rubil wrote:
>>> I have the first four variables in the table below in my dataset, and I
>>> wish to generate the fifth variable. This variable should be such that
>>> it is equal to 1 for all members of a particular household if there is
>>> at least one pensioner in this household. Below is the table with only
>>> two households one of which contains at least one pensioner and I wish
>>> to assign 1 to each member of this household. The other household
>>> doesn't contain any pensioner and I wish to assign 0 to each member of
>>> this household.
>>>
>>> How to do that???
>>>
>>>
>>> hh_id | hh_member | dummy_member_is_pensioner |
>>> dummy_hh_with_at_least_one_pensioner
>>>
>>> ------|-------------|----------------------------|----------------------
>>> ----------------
>>> 1 | 1 | 1 | 1
>>> 1 | 2 | 1 | 1
>>> 1 | 3 | 0 | 1
>>> 1 | 4 | 0 | 1
>>> 2 | 1 | 0 | 0
>>> 2 | 2 | 0 | 0
>>> 2 | 3 | 0 | 0
>>> ... | ... | ... | ...
>>>
*
* 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/