Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: question about defining a local
From
Daifeng He <[email protected]>
To
[email protected]
Subject
st: question about defining a local
Date
Sat, 12 Nov 2011 18:08:34 -0500
Hi there,
This is driving me nuts, but I just cannot see what's going wrong with
my simple code. Basically, I am defining a local to do sample
restriction so that I can quicky switch from one sample restriction to
another in my regressions. Can anyboday tell me why my code below is
wrong?
. local state & st=="CA"
. di "`state'"
& st==CA"" invalid name
r(198);
But then this local is valid when I put it in a regression! (But I
cannot use this local as an argument in a sub-program which is called
by the main program. I am running many repeated sets of regressions so
it's much easier to put the set of regressions into a sub-program and
call the sub-program. The error message similar to the above. )
. xtreg `depvar' `indepvar' `ctr' i.year i.qtr if keep6_all==1
`inrange' & capped==0 `state' , i(id) fe
Fixed-effects (within) regression Number of obs = 173493
Group variable: id Number of groups = 7025
R-sq: within = 0.0757 Obs per group: min = 13
between = 0.7942 avg = 24.7
overall = 0.7349 max = 25
F(15,166453) = 909.48
corr(u_i, Xb) = 0.7029 Prob > F = 0.0000
------------------------------------------------------------------------------
cenmcaid | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
qmavgz_post | .729194 .2207647 3.30 0.001 .2964999 1.161888
qmavgz | -1.728832 .1877174 -9.21 0.000 -2.096754 -1.36091
govt | 1.379419 .5905301 2.34 0.019 .2219923 2.536845
nfprofit | .5900255 .2484427 2.37 0.018 .1030833 1.076968
llc | -22.47875 12.24045 -1.84 0.066 -46.46976 1.512259
lbeds | .3015509 .0027418 109.98 0.000 .2961771 .3069247
(the rest of results supressed)
Thanks for your help!
Daifeng
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/