Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down on April 23, and its replacement, **statalist.org** is already up and running.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

From |
Nick Cox <njcoxstata@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: Keeping an entire cell based on an observation taking a particular value |

Date |
Mon, 19 Mar 2012 21:21:23 +0000 |

Same recipe. See FAQ . . . . . . . . . . . . . . . . . . . . . . . True and false in Stata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . N. J. Cox 8/05 What is true and false in Stata? http://www.stata.com/support/faqs/data/trueorfalse.html On Mon, Mar 19, 2012 at 9:14 PM, Dooruj Rambaccussing <dooruj.rambaccussing@gmail.com> wrote: > I was wondering if total would be appropriate if I wanted to find > whether Xk==2 now (excluding other values) ? > On Mon, Mar 19, 2012 at 8:57 PM, Dooruj Rambaccussing > <dooruj.rambaccussing@gmail.com> wrote: >> Thank you very much Nick. It is very helpful. >> >> On Mon, Mar 19, 2012 at 8:50 PM, Nick Cox <njcoxstata@gmail.com> wrote: >>> I understand this as follows. You have panel data defined by variables >>> -id- and -time- and a bundle of other variables -X*-. >>> >>> You want to keep any panels such that any value of -Xk- within a panel is 1. >>> >>> egen OK = total(Xk == 1), by(id) >>> edit if OK >>> >>> If and only if that is what you want >>> >>> keep if OK >>> >>> Nick >>> >>> On Mon, Mar 19, 2012 at 8:33 PM, Dooruj Rambaccussing >>> <dooruj.rambaccussing@gmail.com> wrote: >>> >>>> I am a beginner to stata. I was wondering if someone can help me with >>>> the following issue: >>>> >>>> I got a dataset with an id and time, and certain observations say X1, >>>> X2 ...... Xk. My variable Xk has got missing values. I would like to >>>> keep an id when a certain condition holds, suppose Xk(t) ==1, and I >>>> would also like to keep the missing obs. Can anyone help me with this >>>> ? >>> * * 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/

**References**:**st: Keeping an entire cell based on an observation taking a particular value***From:*Dooruj Rambaccussing <dooruj.rambaccussing@gmail.com>

**Re: st: Keeping an entire cell based on an observation taking a particular value***From:*Nick Cox <njcoxstata@gmail.com>

**Re: st: Keeping an entire cell based on an observation taking a particular value***From:*Dooruj Rambaccussing <dooruj.rambaccussing@gmail.com>

**Re: st: Keeping an entire cell based on an observation taking a particular value***From:*Dooruj Rambaccussing <dooruj.rambaccussing@gmail.com>

- Prev by Date:
**Re: st: Keeping an entire cell based on an observation taking a particular value** - Next by Date:
**st: RE: GMM with inequality and equality constraints** - Previous by thread:
**Re: st: Keeping an entire cell based on an observation taking a particular value** - Next by thread:
**st: RE: GMM with inequality and equality constraints** - Index(es):