Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: st: RE: resticting the sample?


From   "Clive Nicholas" <[email protected]>
To   [email protected]
Subject   RE: st: RE: resticting the sample?
Date   Fri, 8 Oct 2004 02:57:26 +0100 (BST)

Nick Cox replied:

> I haven't got any gun in my hand, but
> I'm not clear that we need this syntax.
>
> Are you asking for what can be done by
>
> ... if !inlist(_n,10,100,250)

Thanks, Nick: I should have known this. But, in my defence, I don't yet
have the Stata Programming Manual. Disgraceful, I know.

> If that gets tedious, a macro assignment
> cuts the typing
>
> local outliers "inlist(_n,10,100,250)"
>
> regress <whatever> if !`outliers'
>
> Note that this could bite you. Sort
> the data and the observation numbers
> refer to different observations, but
> then -suspendin()- as I understand it suffers from
> exactly the same problem. So I go
> back to my earlier suggestion
> to -generate- an in-sample indicate
> variable, or the other suggestions made.

I agree that simply -generat-ing dummy variables can sort out most
quandaries of this kind. Econometricans often use year dummies in their
datasets not just as variables in regressions, but also for reasons of
simple data management. I do the same.

> See also -inrange()-.

Thanks for this as well. For me, this is probably less useful than
-inlist()- in that the latter is clearly much more designed to take out
rogue observations (as I have in some of my datasets), but - like
Battersea Power Station - it's reassuring to know that it's there.

CLIVE NICHOLAS        |t: 0(044)191 222 5969
Politics              |e: [email protected]
Newcastle University  |http://www.ncl.ac.uk/geps
*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index