[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: about deleting variables
--- Hailing Zang <email@example.com> wrote:
> I have a question about deleting variables that have
> a certain character. I know if I want to drop, then
> simply use
> .drop if<character>
> But if I want to keep the first observation that has
> that character, what should I do?
Remember that the observations are indexed by _n. That
is, the first observation is _n=1, the second _n=2 and
When you sort observations and use the -by- statement
the first observation in each of the possible values
of the "by-variable" is index by _n=1 and so on.
So if you are able to sort your data by the variable,
say x, you can keep the first occurrence of each of
the x values with the statement:
. by x: keep if _n==1
Ricardo Ovaldia, MS
Oklahoma City, OK
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
* For searches and help try: