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

st: RE: Re: basic question about varlist


From   "Nick Winter" <nwinter@policystudies.com>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: Re: basic question about varlist
Date   Tue, 5 Nov 2002 15:30:22 -0500

> -----Original Message-----
> From: Radu Ban [mailto:rban@nber.org] 
> Sent: Tuesday, November 05, 2002 3:01 PM
> To: statalist@hsphsun2.harvard.edu
> Subject: st: Re: basic question about varlist
> 
> 
> thanks a lot for the prompt replies. however, i think i 
> didn't explain my
> problem accurately.
> 
> i'll start from the end result perhaps it makes more sense 
> this way. please
> bear with me.
> in the end, i would like to have a matrix (to be exported in 
> excel) with
> columns:
> 
> varname    coeff1    stderr1    coeff2    stderr2....
> 
> the variables under varname come from the varlist `outcomes' 
> i described in
> the previous email (i.e. local outcomes " an_abbreviated_varlist ").
> to obtain the above mentioned matrix, i'm thinking of implementing the
> following loop:
> 
> foreach var of varlist `outcomes' {
>     reg `var' x1 x2...
>     now somehow generate a scalar indexed by the position of `var' in
> varlist (i.e. scalar1         for first variable, scalar2 for 
> second), equal
> to the coefficient of x1
>     do the same for the stderror of x1, coeff of x2, and so on
>     }
> 
> after the loop is done take these scalars and put them into the above
> mentioned matrix. the part i don't know how to do is to generate those
> scalars

You could do

	capture matrix drop full
	foreach var of varlist `outcomes' {
	   reg `var' x1 x2 ...
	   matrix full = nullmat(full) \
(_b[x1],_se[x1],_b[x2],_se[x2]...)
	}
	matrix list full

However, there are myriad utilities out there to present the results of
model estimation; you might look around a bit.  See, for example,
-outreg-, -mktab-, -parmest-.

-_nick Winter

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