如果我有以下
ID Disputes_Count Month-Year
123 45 12020
123 85 32020
我希望结果是
ID Jan_2020_Disputes Mar_2020_Disputes
123 45 85
我试过这个:
proc sql;
create table disputes_count as
select ID,
sum(case when Month_Year = '12020' then Dispute_Count else 0 end) as January_2020_Disputes,
sum(case when Month_Year = '32020' then Dispute_Count else 0 end) as Mar_2020_Disputes,
from rb.disputes
group by ID;
quit;
但是,我得到的结果如下:
ID January_2020_Disputes Mar_2020_Disputes
0 7
请帮帮我!
暂无答案!
目前还没有任何答案,快来回答吧!