[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: running regressions on only certain sections of the data
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
An Introduction to Modern Econometrics Using Stata:
* For searches and help try: