data test;
input A B C;
datalines;
1 1 100
0 1 200
1 1 300
0 0 400
1 0 200
;
run;
proc sql;
create table result as
select 'A' as VAR format=$3. label='VAR' , mean(c) as C length=8 label='C'
from test
where a=1
union all
select 'B' as VAR format=$3. label='VAR' , mean(c) as C length=8 label='C'
from test
where b=1;