Dear Listers,
I am trying to compute a new variable from a list of variables. Each of these variables has a value of 1 or missing.The order is important.The first time a 1 is encountered, I want this included in the new variable, with ascending values. I have tried a variety of do, if statements - one follows. Any help would be appreciated.
COMPUTE UIV_P=0.
DO IF (OCC_P=1) UIV_P=1 .
ELSE IF (C1_P=1) UIV_P=2.
ELSE IF (C2_P=1) UIV_P=3.
ELSE IF (C3_P=1) UIV_P=4.
ELSE IF (C4_P=1) UIV_P=5.
ELSE IF (C5_P=1) UIV_P=6.
ELSE IF (C6_P=1) UIV_P=7.
ELSE IF (C7_P=1) UIV_P=8.
END IF.
In advance, thanks.
Jean Hanson