Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: a question about -if- command


From   "Katsuhide Isa" <[email protected]>
To   <[email protected]>
Subject   st: a question about -if- command
Date   Sun, 19 Jan 2003 04:36:32 +0900

Hello,

I wrote the following two simple statements in the same 
do file. But when executed, the latter ('NG') returned 
nothing, while the former ('OK') returned the desired 
results: 

----------
/*OK*/
l  bonus if age == 58 & year ==2001
pause
l  bonus if age == 59 & year ==2001
pause

/*NG*/
if age == 58 & year ==2001{
 l  bonus
 pause
}
else if age == 59 & year ==2001{
 l  bonus
 pause
}
----------
This may be a preliminary question, but I don't 
understand why.this difference occurs.
If there is any syntax error in the latter statements, 
Stata should stop and gives an error message. But 
they are executed without stopping, which makes me 
all the more perplexed.

Any suggestions welcome.
Thanks in advance.

K.I.


*
*   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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index