Dear All,
I have encountered an unexpected difference in behavior of Stata's -exit- command.
Here is an illustration:
The output of foobar16 is 10 numbers (1,2,...10), while the output of foobar19 is 5 numbers (1,2,...5).
I don't see how the version mentioned for compatibility reasons radically changes the behavior of the loop. (And at the same time I have a dejavu that I may have complained about the wrong behavior earlier already).
A quick conversation with several AIs came out negative - they don't recollect changes in exit behavior between versions 16 and 19, though insist that the only thing that can be causing the difference is the version specification, and thus this difference is due to Stata's changes under the hood.
Observed in: StataNow/MP 19.5 for Windows (64-bit x86-64), Revision 14 Jan 2026
What am I missing? Or is it a bug?
If it is a bug, which versions are affected? (in my trials setting the version to 17 and 18 behaves same as 19, 15 behaves same as 16).
Thank you, Sergiy
I have encountered an unexpected difference in behavior of Stata's -exit- command.
Here is an illustration:
Code:
capture program drop foobar16
capture program drop foobar19
program define foobar16
version 16.0
forvalues i=1/10 {
display `"`i'"'
if (`i'>=5) {
exit
}
}
end
program define foobar19
version 19.0
forvalues i=1/10 {
display `"`i'"'
if (`i'>=5) {
exit
}
}
end
foobar16
foobar19
// END OF FILE
I don't see how the version mentioned for compatibility reasons radically changes the behavior of the loop. (And at the same time I have a dejavu that I may have complained about the wrong behavior earlier already).
A quick conversation with several AIs came out negative - they don't recollect changes in exit behavior between versions 16 and 19, though insist that the only thing that can be causing the difference is the version specification, and thus this difference is due to Stata's changes under the hood.
Observed in: StataNow/MP 19.5 for Windows (64-bit x86-64), Revision 14 Jan 2026
What am I missing? Or is it a bug?
If it is a bug, which versions are affected? (in my trials setting the version to 17 and 18 behaves same as 19, 15 behaves same as 16).
Thank you, Sergiy

Comment