I have a program where a multi-line mata command appears inside an if condition. When the condition evaluates to false I get an error; it seems the closing brace of the multi-line mata statement is misinterpreted by Stata as the closing brace of the if condition. This does not appear to happen with other commands (e.g. nested if conditions, nested multi-line quietly, etc.) Here's a MWE tested in Stata 16/MP and Stata17/MP
Output is
LMK if I am doing something wrong or if this is a mistake with the Stata parser.
Code:
program test args condition if ( `condition' ) { mata { "foo" "bar" } } end test 1 // no error test 0 // error
Code:
. test 1 // no error foo bar . test 0 // error } is not a valid command name r(199);
Comment