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

Re: st: Dropping Variables - Simple Question

From   "Friedrich Huebler" <>
Subject   Re: st: Dropping Variables - Simple Question
Date   Mon, 13 Aug 2007 10:30:29 -0400


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

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.


On 8/12/07, <> 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:

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