Create new variable based on if statement Options 2 seconds ago Hi, I want to create a new variable (newvar) based on conditional logic see below - i know this would be easy but I need help. have: var1 var2 var3 var11 var12 var13 1 1 0 a b 1 1 1 b b c 0 1 1 d b c 1 0 0 a b c 0 2 a c want: var1 var2 var3 var11 var12 var13 newvar 1 1 0 a b 1 1 1 1 1 b b c 0 0 0 1 1 d b c 0 0 1 0 0 a b c 1 1 0 2 a c 1 2 (if var11 ='a" but if var11 is blank then look for the value of 'a' in the next var12, or var 13 and if matches 'a' then newvar= var1 else if var13 matches 'a' and var11 is blank then new var should have the value of var3) I hope it makes sense 🙂 thanks
... View more