I am trying to aggregate data for the quarter from months.
Data is quite simple has Type, Code and then values (revenue, quantity, label etc.).
Occasionally some lines in month 1 match exactly lines in month 2 or month 3 of the quarter. I just discovered that in that case data from one of the month is dropped ( i.e. duplicates are eliminated). I need to keep all data! Can this be done with proc sql?
Current program in the nutshell:
proc sql;
create table Q as
select type, code, sum (revenue) as Revenue, sum(quantity) as Quantity, label
from
(select * from month1 union
select * from month2 union
select * from month3)
where code is not null
group by type, code, label,
order by type , code;
quit;
Thanks!