Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Dropping Variables - Simple Question


From   "Friedrich Huebler" <fhuebler@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Dropping Variables - Simple Question
Date   Mon, 13 Aug 2007 10:30:29 -0400

Tiago,

There have been several answers to your question. If I understand
correctly, you want to keep all 75 observations. The solution is
therefore not to -drop- any observations but to replace Y by missing
values.

replace Y = . if X == .

On the other hand, perhaps your variables are sorted in a certain way
and you want to delete the contents of the first 25 observations of Y.
Again, the solution uses -replace-.

replace Y = . if _n < 26

Or perhaps your dataset is sorted such that the first 25 observations
have missing values in X and you want to remove those observations
from the dataset. In that case you would indeed use -drop-.

drop if _n < 26

To summarize, it is not clear what exactly you are trying to accomplish.

Friedrich

On 8/12/07, tiago.pereira@incor.usp.br <tiago.pereira@incor.usp.br> wrote:
> Dear statalisters,
>
> I have a simple question:
>
> Supose I have two variables, X and Y with 50 and 75 observations,
> respectively. How do I delete the first 25 observations of the variable Y
> without losing the first 25 observations of the X variable?
>
> Although simple, I have not been able to find out a solution.
>
> Thank you again.
>
> Best regards,
>
> Tiago
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index