Hi everyone,
I need to loop over the different values of a global to export results in excel using putexcel.
The problem is that I cannot access the letters inside the global. In the following code, the problem is that letter3 can not be displayed.
You can play around by changing the number in the local letter_counter to see that I can actully access the values of the global c(ALPHA), but not the values of master_letters.
Many thanks to anyof you who will help me.
*Loop to define master global of letters to export results in excel with putexcel
global master_letters = ""
global slave = "`c(ALPHA)' "
foreach letter_slave in `c(ALPHA)' {
foreach letter in `c(ALPHA)' {
global master_letters = "$slave" + "`letter_slave'" +"`letter' "
global slave = "$master_letters"
}
}
*These will be the excel columns
display("$master_letters")
local letter_counter= 5
local letter2 : word `=`letter_counter'' of `c(ALPHA)'
local letter3 : word `=`letter_counter'' of `master_letters'
dis "`letter2'"
dis "`letter3'"
I need to loop over the different values of a global to export results in excel using putexcel.
The problem is that I cannot access the letters inside the global. In the following code, the problem is that letter3 can not be displayed.
You can play around by changing the number in the local letter_counter to see that I can actully access the values of the global c(ALPHA), but not the values of master_letters.
Many thanks to anyof you who will help me.
*Loop to define master global of letters to export results in excel with putexcel
global master_letters = ""
global slave = "`c(ALPHA)' "
foreach letter_slave in `c(ALPHA)' {
foreach letter in `c(ALPHA)' {
global master_letters = "$slave" + "`letter_slave'" +"`letter' "
global slave = "$master_letters"
}
}
*These will be the excel columns
display("$master_letters")
local letter_counter= 5
local letter2 : word `=`letter_counter'' of `c(ALPHA)'
local letter3 : word `=`letter_counter'' of `master_letters'
dis "`letter2'"
dis "`letter3'"
Comment