suppose I have a query that is has a lot of sums, but I also want to sum these functions in a subsequent column
proc sql;
select
sum(fee1,fee2,fee3) as Fee123,
sum(fee4,fee5,fee6) as Fee456, sum(Fee123, Fee456) as TotalSUM
quit;
I know that TotalSUM will not work and the only way to do this is the query below or I can put this in a table and then sum Fee123 + Fee456
sum(sum(fee1,fee2,fee3), sum(fee4,fee5,fee6)) as TotalSUM
but is there a way to do this cleanly and easily (either procsql or datastep)? My query has a lot of aggregates of aggregates and I want it to simplify this and also avoid creating a bunch of temp tables to make it work.
... View more