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

st: RE: Regression loop and coefficient ooutput


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: Regression loop and coefficient ooutput
Date   Mon, 3 Oct 2005 16:27:27 +0100

Here is half a solution. The other half
is left as an exercise, as the information
is readily accessible in r() and _b[]. 

forval i = 2/100 { 
	qui reg var1 var`i' 
	<print selected results> 
} 

Nick 
n.j.cox@durham.ac.uk 

kelly johnson

> suppose i have 100 variables (var1-var100). how can i write a 
> simple loop to 
> regress all the variables on var1, one at a time?
> 
> specifically, i want:
> 
> reg var1 var2
> reg var1 var3
> .
> .
> .
> reg var1 var100
> 
> additionally, how can i display ONLY the coefficients and 
> their p-values of 
> each regression in my log file? (all i want is a list of the relevent 
> coefficients and their corresponding p-values). thank you!

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