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

st: Re: restricting the sample


From   Christopher F Baum <baum@bc.edu>
To   statalist@hsphsun2.harvard.edu
Subject   st: Re: restricting the sample
Date   Thu, 7 Oct 2004 09:07:33 -0400

On Oct 7, 2004, at 2:33, Michael wrote:

	When using -tsset- data (time series or panel), I have often estimated
regressions on a sub-sample of time observations by using:

		reg y x1 x2 if tin(date1,date2)

and even once or twice:

		reg y x1 x2 if ~twithin(date1,date2)

I can see why those working with cross-sectional data would welcome
similar convenience.
I fail to see why those working with cross-sectional data would find

reg y x1 x2 if iwant

to be more onerous than the examples above. Define a dummy variable that points to the cases that you want (or don't want!), and use it!

In response to Clive's proposed solution, anything that _depends_ on observation numbers is IMHO a Very Bad Idea. All too easy to change those without realising it. Better to create

gen byte zap = inlist(_n,10,100,250)
reg whatever if !zap

(for inlist(), Yet Another Useful Function that one uses with generate, whelp progfun)

Kit Baum, Boston College Economics baum@bc.edu
http://ideas.repec.org/e/pba1.html

*
* 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