Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Locals inside of a forvalue loop


From   Conor Sontag <[email protected]>
To   [email protected]
Subject   st: Locals inside of a forvalue loop
Date   Tue, 18 Aug 2009 01:56:35 -0400

Dear Statalist,

I am working with three data sets that are created using very similar
situations, but are not exactly the same.  What I am trying to do is
the following:

I want to insheet the data sets one at a time:

forvalues i = 1/3{
insheet file`i'..... comma, clear
run a few regressions and store the results
mat2txt, matrix(biasrmse) saving(bias81609.xls) title(Table 1.`i' Bias
and Root Mean Square Errors when the data is created with
`correlation`i'') `action`i''
}

The problem I am having is getting my locals to pass into the mat2txt command.

Now, before starting the loop, I created the following local variables:
local correlation1 = `"description of how the variables are correlated"'
local correlation2 `"description of how the variables are correlated
using data set 2"'
local correlation3 `"etc"'

I also created locals:
local action1 `"replace" '
local action2 = `"append"'
local action3 = `"append" '

What is my objective?

I wish to replace the table I am creating each time I run the file,
but I want the file to be appended the second and third time that it
runs through the loop.  Thanks!
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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