{smcl} {* 4nov2004}{...} {hline} help for {hi:genif}{right: El } {hline} {title:Generate value by first true condition} {p 8 17 2} {cmdab:genif} {it:newvar} {cmd:= (}{it:value}[,{it:condition}]{cmd:)} [{cmd:(}{it:value}[,{it:condition}]{cmd:)} {it:...}] {p 4 4 2}Where both {it:value} and {it:condition} are valid stata expressions. {title:Description} {p 4 4 2}{cmd:genif} creates a new variable, and determines its values by evaluating, in order, the conditions in the list. If the first condition evaluates to true, the variable takes on the first value. Otherwise, if the second condition evaluates to true, the variable takes on the second value, etc. {p 4 4 2}If a condition is omitted, it is assumed to be true (useful for the final condition). If no condition is true, the value is set to missing. {title:Example} {cmd:. genif happy= (10,sun=="shining") (7,sky=="blue") (3,temp=="warm") (2)} {title:Also see} {pstd}Contact: {browse "mailto:elliott.lowy@va.gov":Elliott Lowy}