Statalist


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

Re: st: using if sentences in Stata


From   Maarten buis <[email protected]>
To   [email protected]
Subject   Re: st: using if sentences in Stata
Date   Thu, 27 Nov 2008 17:58:59 +0000 (GMT)

--- Linn Renée Naper <[email protected]> wrote:
> I am trying to program a "double if-sentence" in Stata.
> Is this possible? And what do I do wrong here?

see -help ifcmd-: I think you are looking for -if else-. If you have
three conditions it should look something like this:

if expression1 {
    do something
}
else if expression2 {
    do something else
}
else if expression3{
    do something weird
}

(This does nothing when expression1, expression2, and expression3 are
false)

Also see: Kantor, David and Nick Cox (2005) Depending on conditions: a
tutorial on the cond() function, The Stata Journal, 5(3): 413-420.
http://www.stata-journal.com/article.html?article=pr0016

Hope this helps,
Maarten



-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands

visiting address:
Buitenveldertselaan 3 (Metropolitan), room N515

+31 20 5986715

http://home.fsw.vu.nl/m.buis/
-----------------------------------------


      
*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index