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: how to assign an indicator variable to all observation within a group if a condition is satisfied at least twice


From   Nick Cox <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: how to assign an indicator variable to all observation within a group if a condition is satisfied at least twice
Date   Fri, 28 Jun 2013 17:51:11 +0100

These conditions aren't mutually exclusive. Anyone with 80, 200, 300
qualifies on both counts: earnings <= 100 once and earnings >= 100
twice.

Also, watch for = on both sides of inequality.

Either way, posts earlier today explained the techniques of getting an
indicator and summing it over blocks of observations.

Nick
[email protected]


On 28 June 2013 17:42, Nahla Betelmal <[email protected]> wrote:
> Hi again,
>
> I want to identify two groups of managers. Group one represents
> managers who have earnings => 100 at least twice during their tenure
> period. the other group (the reference one) represent manages who have
> earnings less than 100 or achieved 100 only once during their tenure
> period.
>
> for example, I want to assign an indicator variable =1 for manager
> A187, and zero for managers B963 and C425 as the following:
>
> year  manager_ID  Earnings    indicator
> 1995   A187         100              1
> 1996   A187         150               1
> 1997   A187           60              1
> 1998   A187            0                1
>
>
> year  manager_ID  Earnings     indicator
> 1995   B963           30              0
> 1996   B963           20              0
> 1997   B963          100             0
> 1998   B963            0              0
>
> year  manager_ID  Earnings    indicaror
> 1997  C425           70               0
> 1998   C425          90               0
>
>
> Thanks in advance
>
> Nahla Betelmal
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/faqs/resources/statalist-faq/
> *   http://www.ats.ucla.edu/stat/stata/
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index