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   Thu, 7 Oct 2004 01:54:52 +0100 (BST)

Dimitriy V. Masterov replied to Shuaizhang Feng:

> Your can use preserve/restore to do this:

> preserve
>         keep if age<40
>         reg ....
> restore

And Nick Cox replied to Shuaizhang Feng with:

> gen mysample = (age < 40) & (nobel_prize == 1) & (extrasensoryperception
> == 1)
> ...
> reg ... if mysample
> See also

Running regressions using restricted samples (or by leaving out
disqualifying observations) is something I've been really keen to do for
quite some time. But solutions such as the ones above seem to be the only
ones available (but that doesn't mean to say that they're bad).

I'm not really one for adding to StataCorp's burden, for they probably
have enough to do in preparing for version 9. But wouldn't it be great if
one could run a regression in the following way:

. reg tomatoes potatoes onions sausages, suspendin(10 100 250)

so that you could simply suspend the observations without having to -drop-
them for that regression and then have to -restore- the dataset
afterwards? Desirably, this option would automatically pick up the
observation numbers as they appear by row in the data editor.

No doubt this idea will be shot down in myriad ways and people would say
that it couldn't work. But, to quote the British comedy duo Armstrong and
Miller, "Yes, but it would be good if it did."

CLIVE NICHOLAS        |t: 0(044)191 222 5969
Politics              |e: [email protected]
Newcastle University  |
*   For searches and help try:

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