SPSS If

The IF command conditionally assigns a value to a variable.


Usage

if (foo=1) bar = 1.
if (ltrim(rtrim(foo))="") bar = ''.

The parentheses are optional.

When comparing string variables, string literals, and string expressions within a condition, trailing space characters are not truncated. Consider wrapping all variables and expressions with the RTRIM function.

If a string literal or string expression differs in length compared to the target variable, it is truncated or padded with space characters as needed.


Data Model

The IF command is queued as a pending transformation.


See also

PSPP manual for IF


CategoryRicottone

SPSS/If (last edited 2023-06-14 19:44:06 by DominicRicottone)