I experienced a quirk with Stata. It appears that if statements read (and evaluate) the entire line, even if the condition is false. For example:

Code:
local    c=0

forval j=1(1)100{
  /* this below statement is true for 10(10)100 */
  if      mod(`j',10)==0        local `++c'
}

di     "The count is `c'"
displays
Code:
 The count is 100
Instead of 10, which would be the result of Stata didn't read increment c when the condition is false. Is this an error or should we expect Stata to read (and evaluate) the rest of the line after the if statement?

Having an if block avoids this problem. Please let me know if there any any other workarounds, or if this is an issue I should contact Stata about.