Hello how to use conditions on two columns with select when statements: I am not getting any errors, but my results are not correct. I want to set the new variable x based on the col1 and col2 conditions using select when only. Please find my code below. data test; input col1 $ col2; length x $10; datalines; A 1 A 1 A 2 A 3 B 1 B 2 B 3 C 1 C 1 ;; run; data test2; set test; select (col1); when (A) do; if col2 = 1 then do; x= 'test_A1'; end; when (B) do; if col2 = 3; then do; x = 'test_B3 '; end; otherwise put 'other'; end; end; Thanks.
... View more