That worked. Thanks a lot. 

On Thu, Mar 29, 2012 at 2:01 AM, Allin Cottrell <cottrell@wfu.edu> wrote:
On Thu, 29 Mar 2012, Bulent Erdemir wrote:

> I'd like to create a series of which an observation will refer to (or will
> be calculated using) the previous observation of the same series.
>
> For example, I want to end up with a series like below:
>
> 0
> 5
> 10
> 15
> 20
> 25
> 30
>
> Is it possible to create this series with a command similar to:
>
> series s = s(-1) + 5
>
> (Of course, this series can be generated by a formula like obs * 5 but this
> is not what I meant.)
>
> In such a command, one observation will be calculated by a function which
> receives the previous observation.
>
> The command above wouldn't compile with error "The symbol 's' is undefined"
> because at the time of the declaration there's no variable as s.
>
> Could you recommend a solution ?

Yes, define s first:

nulldata 10
series s = 0
s = s(-1) + 5
print s --byobs

Allin Cottrell
_______________________________________________
Gretl-users mailing list
Gretl-users@lists.wfu.edu
http://lists.wfu.edu/mailman/listinfo/gretl-users