один из способов сделать.
data have;
input state $ compare $ comp_cnt;
datalines;
NY Both 4000
NY Item1 3500
NY Item2 2000
KY Both 5000
KY Item1 3000
KY Item2 4000
;
proc SQL;
select a.state,
a.compare,
a.comp_cnt +b.comp_cnt as comp_cnt
from
(select * from have
where compare ne 'Both')a
left join
(select * from have
where compare ='Both')b
on a.state=b.state;
quit;