There are other ternary operators, as well: inrange() inlist()
1
votes
Previous answer focuses helpfully on cond() but contains some minor errors.
loc avgIncDec = cond(`avginc' > 0, "increased", "decreased")
Note that Stata, like many other languages, uses = for assignment and == to test for equality.
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.OkRead more