/* Percent Difference Smoothing */ /* (Forecast Smoothing) */ new; cls; let data[12,1]= 23 25 36 31 26 28 48 36 31 42 53 43 ; t=seqa(1,1,rows(data)); library pgraph; graphset; _pltype=6; _plegctl=1; _plegstr="actual\000predicted"; title("Percent Difference Smoothing"); nperiod=4; xy(t,data~pdiff(data,nperiod)); proc pdiff(x,nperiod); local n,m,i; n=rows(x); m=zeros(n,1); i=nperiod+2; do while i<=n; m[i]=x[i-1]*(x[i-1]/x[i-1-nperiod]); i=i+1; endo; m[1:nperiod+1]=miss(zeros(nperiod+1,1),0); retp(m); endp;