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

Re: st: using if sentences in Stata

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

--- Linn Renée Naper <> 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

Also see: Kantor, David and Nick Cox (2005) Depending on conditions: a
tutorial on the cond() function, The Stata Journal, 5(3): 413-420.

Hope this helps,

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

*   For searches and help try:

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