Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: if programming command


From   lou apicella <louis_apicella@yahoo.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: if programming command
Date   Thu, 9 Oct 2008 08:55:17 -0700 (PDT)

Hello Statalisters,

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?

Thanks in advance.

Lou.

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/



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