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

 From "Dev Vencappa" <[email protected]> To <[email protected]> Subject Re: FW: st: calling the value of a scalar into a variable Date Tue, 07 Oct 2003 10:08:05 +0100

```Nick and Ernest,
thank you very much both for your useful suggestions for my modest loop file. Both your solutions are working perfectly allright

Dev

Dev Vencappa
School of Economics
University of Nottingham
University Park
Nottingham
NG7 2RD
U.K.
Tel : +44 (0)115 951 5608
Fax: +44 (0) 115 951 4159
>>> [email protected] 10/06/03 4:34 PM >>>
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/

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