Date: Fri, 17 Feb 2012 10:21:47 -0800
Reply-To: David Marso <david.marso@gmail.com>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: David Marso <david.marso@gmail.com>
Subject: Re: New variables as mean of others
In-Reply-To: <201202171716.q1HGKRcn020171@willow.cc.uga.edu>
Content-Type: text/plain; charset=us-ascii
Hint: v(#-11) ???
#-11 as a subscript is negative (UNDEFINED/INVALID) until you get to #=12!!!
*AND* if the variables used for the VECTOR a ie; S_T12M_201007 to
S_T12M_201112
are declared as NUMERIC S_T12M_201007 to S_T12M_201112 (Fw.d) the whole
thing is a mess.
ie: You are implicitly declaring 201112-201007 (180,895) variables.
OTOH: NUMERIC S_T12M_201007 to S_T12M_201012 S_T12M_201107 to S_T12M_201112
(Fw.d)
will only define 10 new variables. There is something fundamentally
askew/bramaged in your approach.
Rethink your naming strategy, draw a flow chart and try again.
---
matti wrote
>
> Thanks Bruce
>
> 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) ).
> end loop.
> execute.
>
> 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@.UGA (not to SPSSX-L), with no body text except the
> command. To leave the list, send the command
> SIGNOFF SPSSX-L
> For a list of commands to manage subscriptions, send the command
> INFO REFCARD
>
--
View this message in context: http://spssx-discussion.1045642.n5.nabble.com/New-variables-as-mean-of-others-tp5490673p5493455.html
Sent from the SPSSX Discussion mailing list archive at Nabble.com.
=====================
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
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
|