SPSS - 使用 if-then 从两个字符串计算新变量

SPSS - calculate new variable from two string using if-then

我需要开发一个语句,根据它们的值和缺失值从两个列中提取字符串值。例如。

我知道这是一个简单的陈述,但我今天似乎无法理解。

应该这样做:

string new_var(a20).
if (COL_A<>"" and COL_B<>"") or COL_B="" new_var=COL_A.
if new_var="" and COL_B<>"" new_var=COL_B.