Dear Statalist community,
In the code below, both #review and #delimit are executed although the if condition is not fulfilled.
Is this intended behavior? I know that both #review and #delimit are preprocessor commands, but I couldn't find much information in the documentation.
The issue initially came up when I integrated Python code into my do-file, using # to start a comment.
I am using Stata 18 (update level: 26 Feb 2025) on Windows 11.
In the code below, both #review and #delimit are executed although the if condition is not fulfilled.
Code:
clear all
sysuse auto.dta, clear
local delimchange 0
if `delimchange' == 1 {
#review
#delimit ;
}
tab price
tab weight
The issue initially came up when I integrated Python code into my do-file, using # to start a comment.
Code:
clear all
qui python query
if `r(initialized)' != 1 {
python search
set python_exec "C:my/dummy/path/python.exe" // set path
}
local py 0
if `py' == 1 {
python:
# Here comes a simple print command
print("Hello world")
end
}

Comment