Hello, I am trying to understand why the first set of code works: Just copy the code between "this works", select, and run in a do file to use....
but the seemingly identical code in a program block, selected, and run in a do file doesn't work. Any explanation of why would be greatly welcome.
The intended outcome is:
Code:
. di "`list1' `list2' `list3'" (len_start1[ m ] != 10)
Code:
. forval f = 1/3 {
2. di "`list`f''"
3. }
(len_start1[
m
] != 10)
Code:
**************** this works (put in do file, select, and run) ***************
clear all
local list1 "(len_start1["
local list2 "m"
local list3 "] != 10)"
di "`list1' `list2' `list3'"
di "`list2'"
forval f = 1/3 {
di "`list`f''"
}
********************************************
*********** this doesn't work (put in do file, select, and run) *************
clear all
capture program drop test
program test
args list1 list2 list3
di "`list1' `list2' `list3'"
forval f = 1/3 {
di "`list`f''"
}
end
local list1 "(len_start1["
local list2 "m"
local list3 "] != 10)"
test `list1' `list2' `list3'
******************************************


Comment