This is a FAQ and I finger you with probability 0.8 as a sometime SAS
user!
if visit == 1 {
...
}
maps to if visit[1] == 1 {
...
}
which almost never is what anyone wants. The first statement is what you
need and want, I'll bet.
See
FAQ . . . . . . . . . . . . . . . . . . . . . if command vs. if
qualifier
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . J.
Wernow
6/00 I have an if command in my program that only seems
to evaluate the first observation, what's going on?
http://www.stata.com/support/faqs/lang/ifqualifier.html
Nick
[email protected]
lou apicella
I'm trying to convert some logical statements into nested if statements.
I feel the two statements below should give the same result but they do
not. What am I do wrong here?
replace syphilis=1 if visit==1 & lbcd=="SYP_RPR" & (lbresc!="POSITIVE
1:128" | lbresc!="POSITIVE 1:16")
if visit==1 {
if lbcd=="SYP_RPR" & (lbresc!="POSITIVE 1:128" | lbresc!="POSITIVE
1:16" ) {
replace syphilis==1
}
}
*
* 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/