Good afternoon ! Currently got stuck with Proc SQL code. When I use group by operation, some missing rows are spoiling the output result. According to SQL logic, I should use aggregation function (e.g. sum/avg) to collapse rows, but there is no aggregation function to exclude missing row from a group. Example: Input data ID Customer Date Sum Field ID1 C1 05.05.2021 15 AAA ID2 C1 05.05.2021 16 ID3 C1 05.05.2021 21 AAA ID4 C2 21.05.2021 30 BBB I use this code: proc sql noprint;
create table output as
select Customer, Date, Field
,sum(SUM) as Sum
,count(*) as count
from work.data_test
group by Customer, Date, Field
;quit; And get this: Customer Date SUM Field count C1 05.05.2021 36 AAA 2 C1 05.05.2021 16 1 C2 21.05.2021 30 BBB 1 Instead I need to get this: Customer Date Sum Field count C1 05.05.2021 52 AAA 3 C2 21.05.2021 30 BBB 1 Is there any possible solution ? Thanks
... View more