Re: Create new variables from others (If Condistional or recode)

2017-10-27 Thread Alan Mead
It's hard to test syntax without the data so it's better to post short syntax files and small datafiles. There was a typo (no period after the third compute statement) but even after I fix that it doesn't work. Var0001 is missing when the first DO IF doesn't fire. I am also mystified as to why; po

Re: Create new variables from others (If Condistional or recode)

2017-10-27 Thread Alan Mead
Sorry, I forgot to add "END IF." Here's where it would go: DO IF(P5=2 or P6=2 or P7=2).    COMPUTE Var0001 = 1. ELSE IF (P8=1).    COMPUTE Var0001 = 2. ELSE.    COMPUTE Var0001 = 3 END IF. EXECUTE. On 10/27/2017 11:52 AM, Alan Mead wrote: > You have the syntax wrong. I imagined variable V1.  I ha

Re: Create new variables from others (If Condistional or recode)

2017-10-27 Thread Alan Mead
You have the syntax wrong. I imagined variable V1.  I have no idea is this accomplishes what you want, it just corrects the syntax to illustrate how you have the syntax wrong. The spacing before the RECODE/COMPUTE statements is just to make it easier to read. DO IF(P5=2 or P6=2 or P7=2).    RECODE