proc sql;
create table client_yy as
select client_y.ttt,
sum(case when client_y.year= 'FY2015' then account3 else 0 end) as z20151,
sum(case when client_y.year= 'FY2015' then account4 else 0 end) as z20152,
sum(case when client_y.year= 'FY2015' then amount1 else 0 end) as z20153,
sum(case when client_y.year= 'FY2015' then amount2 else 0 end) as z20154,
sum(case when client_y.year= 'FY2016' then account3 else 0 end) as z20161,
sum(case when client_y.year= 'FY2016' then account4 else 0 end) as z20162,
sum(case when client_y.year= 'FY2016' then amount1 else 0 end) as z20163,
sum(case when client_y.year= 'FY2016' then amount2 else 0 end) as z20164,
sum(case when client_y.year= 'FY2017' then account3 else 0 end) as z20171,
sum(case when client_y.year= 'FY2017' then account4 else 0 end) as z20172,
sum(case when client_y.year= 'FY2017' then amount1 else 0 end) as z20173,
sum(case when client_y.year= 'FY2017' then amount2 else 0 end) as z20174,
sum(case when client_y.year= 'FY2018' then account3 else 0 end) as z20181,
sum(case when client_y.year= 'FY2018' then account4 else 0 end) as z20182,
sum(case when client_y.year= 'FY2018' then amount1 else 0 end) as z20183,
sum(case when client_y.year= 'FY2018' then amount2 else 0 end) as z20184
from client_y
group by client_y.ttt
order by client_y.ttt;
quit;