[U] 11.1.3 if exp
command if exp
exp in the syntax diagram means an expression, such as age>21. See exp
for an explanation of expressions.
There is another if used in Stata programming; see [P] if.
if at the end of a command means the command is to use only the data
specified. if is allowed with most Stata commands.
. sysuse auto
. list make mpg if mpg>25
. list make mpg if mpg>25 & mpg<30
. list make mpg if mpg>25 | mpg<10
. regress mpg weight displ if foreign==1
Equality tests are performed by two equal signs (==), not one =; see