data usagesum;
set usage end = eof;
retain maxuse ; * keep the maxuse from obs to obs;
by cust date;
if (day(date) = 1 or last.cust) and not (_n_ = 1) then do; * Do this stuf on the 1st day of month or the last reord for a customer;
month = month(lag(date)); * since we do this on the first of the next month use last month Well you won't want to do this on the last customer record;
output;
maxuse = 0;
end;
maxuse = max(maxuse , max(h1 - h24)); *maximum of retained value and the max of the hourly readings;
run;
This is just a starting point for you, but you should be able to build it from there.
... View more