From | Ernest Berkhout <[email protected]> |
To | [email protected] |
Subject | RE: st: calling the value of a scalar into a variable |
Date | Mon, 06 Oct 2003 16:16:46 +0200 |
At 15:48 6-10-2003, Dev Vencappa wrote me privately:
thanks a lot for your tip to this problem. I have implemented it for variable netpremmean and it works fine. Now suppose I have four variables in total, why does it not work? I am copying my loop file below. COuld you spot the mistake please?Better ask all your questions directly to Statalist. Firstly, a lot more people will be able to give you the answer. Secondly, a lot more people are interested in the discussion, so they profit from your question and the answers as well. Third, an maybe most important in this particular case: I myself only just learned this trick today in the Stata NetCourse, so you better have Nick or someone else to read it too... :-)
Also, if I have to do it for 20 different series for each of these variables for each lag length from 1 to 6, could you give a suggestion how this can be shortened within a loop please?
local z "netpremmean disclmmean elrmean solvmean"
foreach k of local z{
postfile myhandle lags aic`k' sic'k' using "c:\unitroot\unitrootlagselection`k'", replace
forvalues x = 1/6 {
regress D.`k' L.`k' L`x'D.`k'
matrix b`x'=get(_b)
scalar AIC`k'`x'=log(_result(4)/_result(1))+(colsof(b`x')/_result(1))*2
scalar SIC'k'`x'=log(_result(4)/_result(1))+(colsof(b`x')/_result(1))*log(_result(1))
post myhandle (`x') (AIC`k'`x') (SIC`k'`x')
}
postclose myhandle
}
The error message I am getting is invalid name. can't spot where the mistake is.
© Copyright 1996–2024 StataCorp LLC | Terms of use | Privacy | Contact us | What's new | Site index |