Question: Please help me with the query 
Below are the table and requirement details

[![enter image description here](https://i.stack.imgur.com/ux4O6.png)](https://i.stack.imgur.com/ux4O6.png)

Answer: 
Just for completeness, this is straightforward in a data step, using `select`, `when`, `do`, `otherwise`. Or you could just use `if`, `then`, `do`, `else`.

```
data want;
set example;
select (x);
    when ('A') do;
        thing1 = 'Result1A';
        thing2 = 'Result2A';
        end;
    when ('B') do;
        thing1 = 'Result1B';
        thing2 = 'Result2B';
        end;
    otherwise do;
        thing1 = 'Error';
        thing2 = 'Error';
        end;
end;
run;

```
Personally I think this need, i.e., to overcome a cumbersome syntactic barrier with something that can be maintained in one place, is a good use case for SAS macro. 

The macro version also avoids the perils of parsing, is nicely tabular, and makes no type assumptions.

```
%macro _case(when_A, when_B, error='Error');
      case
          when x = 'A' then &when_A
          when x = 'B' then &when_B
          else &error
      end
%mend;

proc sql;
  create table make_two_from_one_v2 as
  select *
  , %_case('Result1A', 'Result1B') as thing1
  , %_case('Result2A', 'Result2B') as thing2
  from example
  ;
quit; 

```