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

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


From   "Farmer, Robert M" <[email protected]>
To   <[email protected]>
Subject   st: RE: Is there an equivalent of ACCESS IIF function in STATA?
Date   Tue, 6 Jul 2004 09:43:33 -0400

Without programming the IIF statment  {x=IIF(ConditionalStatement),TrueValue,FalseValue}, the easiest way to mimic it would be to generate the variable using the FalseValue, then set the variable to the TrueValue if ConditionalStatement.

Good Luck
RFarmer

-----Original Message-----
From: [email protected]
[mailto:[email protected]]On Behalf Of Weiwei Du
Sent: Monday, July 05, 2004 4:09 PM
To: [email protected]
Subject: st: Is there an equivalent of ACCESS IIF function in STATA?


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