Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Is there an equivalent of ACCESS IIF function in STATA?


From   Thomas Trikalinos (.Mac) <[email protected]>
To   [email protected]
Subject   Re: st: Is there an equivalent of ACCESS IIF function in STATA?
Date   Tue, 6 Jul 2004 00:15:18 +0300

doesn't "if" suit your needs?

. gen conditionEvaluationResults = 1 if (<conditions are true>)
. replace conditionEvaluationResults = 0 if (<conditions are not true>)



On Jul 6, 2004, at 0:08, Weiwei Du wrote:

Hi,

In ACCESS the IIF function returns one value if a specified condition
evaluates to TRUE, or another value if it evaluates to FALSE:

IIF (condition, value_if_true, value_if_false)

condition is the value that you want to test.
value_if_true is the value that is returned if condition evaluates to TRUE.
value_if_false is the value that is return if condition evaluates to FALSE

I'm looking for a similar function in STATA in order to set a variable to
two different values based on a condition test.

Is there such a function existing? Or, any other easy way to work this out?

Thank you very much.

Weiwei


*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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