I use stata version 14.2 and run this code in a do-file (normally there is more stuff in the mata-section, but I have taken it out to reduce the code posted here)
tokenize "atlantic BC ON prairies QC"
local j = 0
foreach i of num 1 2 3 4 5 {
local j = `j'+1
// omit North (lack of observations) so adjust local index
if (`i' == 3) {
local j = `j'+1
}
pause
mata:
handle_country = 1
end
}
So, when I run it, I get back:
. tokenize "atlantic BC ON prairies QC"
. local j = 0
. foreach i of num 1 2 3 4 5 {
2. local j = `j'+1
3. // omit North (lack of observations) so adjust local index
. if (`i' == 3) {
4. local j = `j'+1
5. }
6. pause
7.
. mata:
8. handle_country = 1
9. end
--Break--
r(1);
r(1) says :error . . . . . . . . . . . . . . . . . . . . . . . . . Return code 1
You pressed Break. This is not considered an error.
BUT - I did not press Break.
What is going on???
tokenize "atlantic BC ON prairies QC"
local j = 0
foreach i of num 1 2 3 4 5 {
local j = `j'+1
// omit North (lack of observations) so adjust local index
if (`i' == 3) {
local j = `j'+1
}
pause
mata:
handle_country = 1
end
}
So, when I run it, I get back:
. tokenize "atlantic BC ON prairies QC"
. local j = 0
. foreach i of num 1 2 3 4 5 {
2. local j = `j'+1
3. // omit North (lack of observations) so adjust local index
. if (`i' == 3) {
4. local j = `j'+1
5. }
6. pause
7.
. mata:
8. handle_country = 1
9. end
--Break--
r(1);
r(1) says :error . . . . . . . . . . . . . . . . . . . . . . . . . Return code 1
You pressed Break. This is not considered an error.
BUT - I did not press Break.
What is going on???
Comment