just add drop statement
proc sql ;
create table want( drop = columns you want) as
select a.*, sale1, sale2, sale3,
sale1/sale2 as sale1bysale2 format = comma5.3,
sale1/sale3 as sale1bysale3 format = comma5.3
from
(select store, year, sale, product
from have ) a
full join
(select store, year, product, sum(sale) as sale1
from have
group by 1,2,3) b
on a.store =b.store
and a.year =b.year
and a.product =b.product
full join
(select store, year, sum(sale) as sale2
from have
group by 1,2) c
on a.store =c.store
and a.year =c.year
full join
(select year, product, sum(sale) as sale3
from have
group by 1,2) d
on a.product =d.product
and a.year =d.year;
... View more