| |
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: running regressions on only certain sections of the data
Maarten said
I am assuming that you have a variable called section,
which contains the strings A, B, or C.
to do the regression you requested you would type:
reg y x if section == "A"
reg y x if section == "A" | section == "C"
reg y x if section == "A" | section == "B"
For more info see: - help if- and -help operator-
If you have many sections (but need no more than 10, categorized by a
string variable) you could also do
reg y x if inlist(section,"A","C")
reg y x if inlist(section,"A","B")
...
help functions -> programming functions for details. inrange() is
also useful in some cases like this.
Kit Baum, Boston College Economics
http://ideas.repec.org/e/pba1.html
An Introduction to Modern Econometrics Using Stata:
http://www.stata-press.com/books/imeus.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/