Maoyong Fan wrote:
> First of all, I run a OLS regression. The reg command automatically drop
> some variables which cause multicolinearity.
>
> Secondly, I want to use the covariates which OLS just used to run other
> regressions.
>
> I know e(depvar) gives the name of dependent variable. But I can not find
> some command in Stata to give me the name list of dependent variables (not
> include the dropped variables). Could you give me some hint?
The names of the independent variables are put as colnames/rownames in the
result matrices e(b) and e(V), and can be extracted from there. However,
these matrices also contain the names of the dropped variables. Fortunetelly
it is easy to spot these matrices for the dropped variables, as all entries
for the dropped variables are zero.
Here is one way to proceed:
--------------------------------------
sysuse auto
reg mpg weight length weight turn
matrix B = e(b)
local k = colsof(B) // See -help matrix functions-
forvalues i = 1/`k' {
if el(B,1,`i') ~= 0 { // See -help matrix functions-
matrix b = B[1,`i'..`i'] // See -help matrix extraction-
local name: colname(b) // See -help matmacfunc-
local names "`names' `name'"
}
}
di "`names'"
---------------------------------------
hope this helps
uli
--
kohler@wz-berlin.de
+49 (030) 25491-361
*
* 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/