Am 06.09.2024 um 22:53 schrieb Summers, Peter:
Hi all,
When trying to use the console to create a new variable, I get an
error message after typing “if (female == 1)” saying “error evaluating
‘if’”. I’ve also tried it with a script and get the same result. This
is on Windows, latest snapshot (office desktop) and also with the
previous win64.zip snapshot (classroom). I’ve tried spacing/no
spacing, parentheses & not, all with no change.
If 'female' is a series, then 'female==1' will also yield a (dummy)
series, and that won't work with a boolean check, because what should
the result be? So an if-block needs a scalar/unique input for
evaluation. Perhaps you should give more context as to what you are
trying to achieve. For example, a ternary statement is often useful.
cheers
sven