I don't see how you could do this in EG without creating many repetitive processes.
Here is how you could do it with a bit of code:
[pre]
data T(index=(a=(PART_NUM SUB_ASSEMBLY)));
input PART_NUM $ SUB_ASSEMBLY $ DATE mmddyy10. VALUE;
cards;
A 0 03/01/2010 5
A 1 03/01/2010 4
A 2 03/01/2010 5
A 0 03/02/2010 4
A 1 03/02/2010 4
A 2 03/02/2010 5
B 0 03/01/2010 5
B 1 03/01/2010 4
B 0 03/02/2010 4
B 1 03/02/2010 4
A 0 03/20/2010 6
A 1 03/20/2010 7
A 2 03/20/2010 4
A 0 03/21/2010 4
A 1 03/21/2010 5
A 2 03/21/2010 3
B 0 03/20/2010 6
B 1 03/20/2010 7
B 0 03/21/2010 3
B 1 03/21/2010 5
run;
proc sort data=T out=LIST nodupkey; * build table of all calculation groups;
by PART_NUM SUB_ASSEMBLY ;
data END;
set LIST; * for each calculation group;
OBS=0; * reset observation counter;
do until (LASTOBS); * start iteration for current group;
set T end=LASTOBS key=A; * read data;
OBS+1; * count observations;
if OBS=2 then AVG1=mean(VALUE,PREV_VALUE); * set avg for first 2 observations;
if LASTOBS then output; * no more observations: save averages;
AVG2=mean(VALUE,PREV_VALUE); * set avg for latest 2 observations;
PREV_VALUE=VALUE; * remember value for next iteration;
end;
if _IORC_=1230015 then _ERROR_=0; * reset error flag ;
keep PART_NUM SUB_ASSEMBLY AVG1 AVG2;
run;