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

FW: st: calling the value of a scalar into a variable


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   FW: st: calling the value of a scalar into a variable
Date   Mon, 6 Oct 2003 16:34:11 +0100

Like Ernest Berkhout, I take the liberty of 
copying private emails to the list. 

Nick 
[email protected] 

-----Original Message-----
From: Nick Cox [mailto:[email protected]]
Sent: 06 October 2003 15:54
To: Dev Vencappa
Subject: RE: st: calling the value of a scalar into a variable


Dev Vencappa 

> thanks for your solution? However stata is returning a 
> message like M not found. Also, if I want to repeat this 
> over several variables within a loop, would that work?
> 

Sorry, I missed out a line of  code 
in matching your code and mine 
on an analogue of this problem. 

gen AIC = . 
gen BIC = . 
 
forvalues x = 1/6 {
 	regress D.netpremmean L.netpremmean L`x'D.netpremmean
 	estimates store whatever 
 	qui estimates stats 
      matrix M = r(S) 
 	qui replace AIC = M[1,5] in `x'
 	qui replace BIC = M[1,6] in `x'
} 

It may well be possible to telescope this a bit. 

It could be made work more generally. 
But what data structure do you envisage for the outputs? 

Nick 
[email protected] 

*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index