From: "SUBSCRIBE SAS-L Joe H. Smith" on
Hi all,

I am submitting the following code ..i get wrong values for the count of actual
....

data try1;
input FAcility_RK ITEM_RK DEMAND_DT mmddyy10. ACTUAL PREDICT;
format DEMAND_DT date9.;
cards;
40 121 10/1/2010 . 0
40 234 10/1/2008 0 0
40 234 1/1/2009 0 0
40 234 4/1/2009 0 0
40 234 7/1/2009 0 0
40 234 10/1/2009 . 0
40 234 1/1/2010 . 0
40 234 4/1/2010 . 0
40 234 7/1/2010 . 0
40 234 10/1/2010 . 0
40 291 4/1/2009 6 6
40 291 7/1/2009 0 0
40 291 10/1/2009 . 0
40 291 1/1/2010 . 0
40 291 4/1/2010 . 0
40 291 7/1/2010 . 0
40 291 10/1/2010 . 0
40 301 10/1/2008 0 0
40 301 1/1/2009 0 0
40 301 4/1/2009 0 0
40 301 7/1/2009 0 0
;
run;
proc print;
run;
proc sql;
create table test78 as
select FAcility_RK,ITEM_RK,DEMAND_DT ,ACTUAL,PREDICT,count(ACTUAL)
as calc
from try1 group by FAcility_RK,ITEM_RK;
quit;
output is ..

FAcility_RK ITEM_RK DEMAND_DT ACTUAL PREDICT calc
40 121 10/1/2010 0 0
40 234 10/1/2009 0 4
40 234 1/1/2010 0 4
40 234 1/1/2009 0 0 4
40 234 10/1/2010 0 4
40 234 7/1/2010 0 4
40 234 7/1/2009 0 0 4
40 234 10/1/2008 0 0 4
40 234 4/1/2009 0 0 4
40 234 4/1/2010 0 4
40 291 1/1/2010 0 2
40 291 4/1/2010 0 2
40 291 10/1/2009 0 2
40 291 7/1/2009 0 0 2
40 291 4/1/2009 6 6 2(y do iget 2 instead of 1)
40 291 10/1/2010 0 2
40 291 7/1/2010 0 2
40 301 7/1/2009 0 0 4
40 301 4/1/2009 0 0 4
40 301 1/1/2009 0 0 4
40 301 10/1/2008 0 0 4

plz guide me where i am doing wrong.

Thanks all