Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Thomas Jacobs <thomasjacobs@gmail.com> |
To | StataList <statalist@hsphsun2.harvard.edu> |
Subject | st: Irritating if...else question for mata vs. stata |
Date | Sun, 6 Jun 2010 12:57:01 -0500 |
I am trying to determine whether an if block is acceptable in mata without an else block even if else is empty. In the Stata manual for if it specifically shows the following - I am ignoring the single line if statement command: if exp { multiple commands } which...MAY be followed by else etc. However in the mata manual only the single line line if(exp) sttmnt 1 is displayed. All the other examples have a trailing else whether in block or single line form. In the description, however, it states "if evaluates the expression, and if it is true, if executes the statement or statement block that immediately follows it; otherwise, if skips the statement or block." I interpret the latter description to be that one can use the if block without a trailing else. The lack of precision is frustrating, however, and I am struggling to interpret odd program behavior. Can anyone definitively state whether the following is proper programming form for mata: if (exp) { multiple statements } with no trailing empty else{ } ? Thanks. Tom -- Thomas Jacobs * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/