the code below is not adding the var nor is it outputing the last line; what am i missing
Data test_me (keep = Date Total_Calls Total_LM);
set Summary2 ;
retain var1 var2;
var1 = 0;
var2 = 0;
if not eof then do;
var1 = Total_ER_Calls + var1;
var2 = var2 + Total_ER_To_LM;
end;
if last._Date then do;
Date= "Grand Total";
Total_Calls = var1;
Total_LM = var2;
end;
run;
would like it to look like this;
Date Total_Calls Total_LM
1/1/2011 10 5
1/2/2011 15 3
grand total 25 8