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: How to drop missing values by period? |

Date |
Mon, 11 Feb 2013 15:25:15 +0000 |

Thanks for the example. Stata usually takes care of this for you in that 1. A command uses as many as observations as possible. 2. Most statistical commands ignore missing values. But in your example . drop if missing(x1, x2) will drop observations if either -x1- or -x2- is missing. It's not clear to me that you need to think of this period by period, as that makes no difference to the outcome. Nick On Mon, Feb 11, 2013 at 3:18 PM, Xixi Lin <winnielxx@gmail.com> wrote: > Hi Nick, > > Thanks for the instant reply. What I mean is like: > id period x1 x2 > 1 1 1 4 > 2 1 2 . > 3 1 . 2 > 1 2 4 4 > 2 2 5 3 > 3 2 . 2 > > In period 1, I want to keep id 1 because id 2 and id 3 have missing > values; in period 2, I want to keep id 1 &2, because id 3 has missing > values. > > I have time series data, but I wanna do a cross-sectional regressions > and wanna keep the maximum of observations. So I am wondering if it is > possible to drop obs only in one period while keeping it in another > period. > > Thanks. > Xixi Lin > > On Mon, Feb 11, 2013 at 9:59 AM, Nick Cox <njcoxstata@gmail.com> wrote: >> This sounds to me as if you want -keep- and -drop- the same >> observations. That can't be done. >> >> Perhaps you should show what your data look like with variable names, >> and link your question to such an example. >> >> Nick >> >> On Mon, Feb 11, 2013 at 2:53 PM, Xixi Lin <winnielxx@gmail.com> wrote: >> >>> I tried to drop missing values period by period, in 120 periods. In other >>> words, in period 1, I want to drop the observations if dependent variables >>> have missing values only in period 1; while in period 2, drop the >>> observations if dependent variables have missing values only in period 2, >>> should keep those that missing in period 1 but not missing in period 2. For >>> instance: >>> >>> In period 1, I want to keep id 1; in period 2, I want to keep id 1 &2. >>> >>> Does anyone knows how to do that? Thanks a lot. * * 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/

**Follow-Ups**:**Re: st: How to drop missing values by period?***From:*Xixi Lin <winnielxx@gmail.com>

**References**:**st: How to drop missing values by period?***From:*Xixi Lin <winnielxx@gmail.com>

**Re: st: How to drop missing values by period?***From:*Nick Cox <njcoxstata@gmail.com>

**Re: st: How to drop missing values by period?***From:*Xixi Lin <winnielxx@gmail.com>

- Prev by Date:
**Re: st: How to drop missing values by period?** - Next by Date:
**Re: st: Why do `test' and a`test' make a difference?** - Previous by thread:
**Re: st: How to drop missing values by period?** - Next by thread:
**Re: st: How to drop missing values by period?** - Index(es):