data kva;
infile 'C:\Documents and Settings\dubauaw\Desktop\Jims KVA 2009\Rate 56 (Group 1)Cal.csv' dsd missover LRECL=1000000;
length account $9. meter $9. channel $12. LRID $15. name $25. meteragain $9.;
input account $ meter $ regtype $ channel $ LRID $ name $ meteragain $ type1 $ type2 $ date hour1-hour24;
informat date mmddyy9.;
run;
data usagesum;
set kva end = eof;
retain maxuse maxuse12_8 maxuse_other max_offpeak ;
if (day(date) = 1 or last.account) and not (_n_ = 1) then do;
month = month(lag(date));
output;
maxuse = 0;
maxuse12_8=0;
maxuse_other=0;
max_offpeak =0;
end;
maxuse = max(maxuse , max(of hour1 - hour24));
maxuse12_8 = max(maxuse12_8 , max(of hour12 - hour20));
maxuse_other = max(of maxuse_other , max(max(of hour1 - hour11),max(of hour21-hour24)));
if weekday(date) NE 2-6 then do;
max_offpeak = max(of maxuse_other, max(of hour1-hour24));
end;
run;
There is my code. My only problem now is the first account is missing a month. The month variable works like it should but the first account skips a month. Not sure why? That is to say that the month variable works all the way through, but something isn't lining up.
Message was edited by: Aar684
... View more