Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# Re: st: how to assign an indicator variable to all observation within a group if a condition is satisfied at least twice

 From Nahla Betelmal To statalist@hsphsun2.harvard.edu 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 18:16:06 +0100

```Hi, thank you for your reply. I reread the post and understood what I did wrong.

It works now, thank you for the help again

Nahla

On 28 June 2013 17:51, Nick Cox <njcoxstata@gmail.com> wrote:
> 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
> njcoxstata@gmail.com
>
>
> On 28 June 2013 17:42, Nahla Betelmal <nahlaib@gmail.com> 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
>>
>>
>>
>> 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/
*
*   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/
```