I typically work in another text editor and simply copy and paste my work into Stata's command prompt. However, I have noticed a difference between the way the command prompt and the do
file editor handle comments.
The code below reproduces the things I have discovered:
mata
//test comment
/* test comment 2 */
end
//test comment 3
*test comment 4
/* test comment 5*/
When run from the do
file editor, the code runs without issue.
But when I run it after copying and pasting into the command prompt, I receive a number of r(3000)
errors in mata
and r(199)
errors in Stata.
The sole exception is that the *
comments in regular Stata work fine in both interfaces.
I also see that the //
comment in mata
gives an "expression invalid" error message along with the r(3000)
notification, but I only receive the r(3000)
message when I use the /* text */
comment. In regular Stata, both comment types that are not *
give "/ is not a valid command name" messages along with the r(199)
.
My main question is:
- What is the reason behind this difference? Is there anything I can do to suppress these errors?
Also, this is something like a red flag for me:
- Are there other behaviors that differ when I run things via the command prompt rather than the
do
file editor?