data example; input id price; datalines; 1 437.83 2 458.5 3 457 4 456.98 5 459.11 6 453.91 7 444.05 8 456.47 9 463.25 10 474 ; run; and I want to count WMA(Weigthed Moving Average) of prices. It looks like this for period n: WMA=(n*Price+(n-1)*lag(Price)+...+1*lag(n-1)(Price))/(1+...+n).
... View more
I have a problem with lag function in do loop. I want to get lag1, lag2, lag3,...,lagn but without using macro so I tried to do it in this way but it doesn't work. retain S 0; do i=1 to 10; S=S+lag(x); end; Has anybody any solutions?
... View more