Hi, Community I am trying to create a new variable combining two variables. My data looks like this (if pre_a has a value, post_a doesn't. If post_a has a value, pre_a doesn't..): pre_a post_a pre_b post_b 2 . 3 . . . . 2 . 3 3 . . 3 . . I would like to create a new variable 'Apple' combining pre_a and post_a, and 'Ball' combining pre_b and post_b. The dataset I would like to get looks like this: pre_a post_a apple pre_b post_b ball 2 . 2 3 . 3 . . . . 2 2 . 3 3 3. . 3 . 3 3 . . . I tried to use the following code: apple=pre_a; if apple ne ' ' then output; apple=post_a; if apple ne ' ' then output; ball=pre_b; if ball ne ' ' then output; ball=post_b; if ball ne ' ' then output; keep apple ball; run; If using the code, I got the apple variable, correctly, but not a ball variable. Could you give some advice to do this? Or, is there different way to create a new variable combining two variables? Your answers would be very helpful! Thanks!
... View more