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

Re: st: R: if and if

From   Neil Shephard <>
Subject   Re: st: R: if and if
Date   Thu, 13 Nov 2008 10:52:42 +0000

Ashim Kapoor wrote:
> Hello Carlo,
> cond would not be useful cos it can do ONLY 2 conditions. I want to be
> able to use it in MANY conditions. Is there a SUPER cond which can do
> that ?
I'm not aware, nor am I clear on what you mean by a "SUPER cond", but
its straight-forward and permissible to nest -cond()- statements along
the lines of...

gen t = cond(a == 1, 1, cond(b == 1, 2, cond(c == 1, 3, 0, .), .), .)


"We should make things as simple as possible, but not simpler" - Anon (not Albert Einstein)

This  message  may  contain  confidential and  privileged  information.
If you  are not the  intended recipient  you should not  disclose, copy
or distribute information in this e-mail or take any action in reliance
on its contents.  To do so is strictly  prohibited and may be unlawful.
Please  inform  the  sender that  this  message has  gone astray before
deleting it.  Thank you.

2008 marks the 60th anniversary of the NHS.  It's an opportunity to pay
tribute to the NHS staff and volunteers who help shape the service, and
celebrate their achievements.

If you work for the NHS  and  would like  an NHSmail  email account, go

*   For searches and help try:

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