Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Nick Cox <n.j.cox@durham.ac.uk> |
To | "'statalist@hsphsun2.harvard.edu'" <statalist@hsphsun2.harvard.edu> |
Subject | st: RE: unconventional use of if condition |
Date | Fri, 29 Jun 2012 16:22:21 +0100 |
The parentheses here are cosmetic, but in other circumstances they could force a particular order of evaluation. Otherwise there is nothing at all unconventional here. The help for -if- makes it explicit that if exp single_command is a legal form, so that the braces { } are not needed. Indeed as from version 8 they are not allowed. Before version 8, things were different. See -help whatsnew7to8-. You are asked to say _where_ user-written commands from. I wouldn't infer anything about a program from whether its authors have Ph.D. degrees. Nick n.j.cox@durham.ac.uk tashi lama In the fetchyahooquotes.ado written by Mehmet F. Diche, Ph.D. and John Levendis, Ph.D., I encountered following use of if if ("`start'"!="") drop if date<(date("`start'", "DMY")) if ("`end'"!="") drop if date>(date("`end'", "DMY")) I was under the impression and the documentation rightly says to precede 'if' with braces ("{") followed by command in the next line. Sth like this if x==4 { ..... } Could someone explain me this? * * 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/