trying now since a few hours to fix my problem - I am not able to come up with an adequate solution. I need your help / advise!
I would like to run the blow shown STATA code. My problem is that it will only work for the first observation (example1 @ 1999 and example2 @ 2005).
How can I work with multiple entries? Any ideas?
Code:
tsset ID YEAR
local example1 1999
local example1 2000
local example2 1999
local example2 2005
foreach i in numlist 100005 {
local t `example`i''
replace TEST_variable = 10 if ID == "`i'" & YEAR == `t'
}Konstantin
0 Response to Loop over multiple arrays via foreach
Post a Comment