If u don't have SAS/ETS you won't be able to use proc expand. Here is a data step approach that should work. data want;
set have nobs=nobs;
if _N_ > 2 and _N_ <= nobs-2 then do; *Logic to only calculate a smoothed average when there are two prior rows as well as two following rows;
smoothed_average = Sales;
*Grab the preceding 2 and following 2 rows;
do i = -2, -1, 1, 2;
GetPoint = _N_ + i;
set have(keep=Sales Rename=(Sales=PriorSales)) point=GetPoint;
smoothed_average + PriorSales;
end;
smoothed_average = smoothed_average / 5;
end; else
smoothed_average = .;
drop i PriorSales;
run; The third line may need to change depending on your actual data to start and stop calculating properly.
... View more