This does work - I get the right results but I get an error message
Below is the adjusted script I use for a 12 months trailing period. I
assume I can use v(#-1) and simply go backwards:
vector v = S_201007 to S_201112 / a = S_T12M_201007 to S_T12M_201112 .
loop # = 1 to 18 .
- compute a(#) = MEAN(v(#), v(#-1), v(#-2), v(#-3), v(#-4), v(#-5), v(#-6),
v(#-7), v(#-8), v(#-9), v(#-10), v(#-11) ).
The error message says
>Warning # 513
>The subscript in a vector reference is missing or otherwise invalid. The
>subscript must be a positive integer and must not be greater than the length
>of the vector. The result has been set to the system-missing value.
To manage your subscription to SPSSX-L, send a message to
LISTSERV@LISTSERV.UGA.EDU (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
For a list of commands to manage subscriptions, send the command