[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: single-line vs multiple-line -if- command
Dear all,
I encountered a strange behavior -if- and/or macro inline incrementation
operators and was wandering what's going on.
Lets consider this example:
local a=1
local b=1
if 0 local a1=`a++'
if 0 {
local b1=`b++'
}
display `a', `b'
2 1
Although both expressions are false an therefore neither a1 nor b1 will be
created, `a' is incremented anyways. If we say that two versions of -if-
statement are equivalent then I'd expect exactly same outcome no matter what
type of commands and operations (like inline macro substitution) is used. Am
I confusing something here?
I would appreciate any thoughts about the issue,
Thanks,
Zurab
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/