Artur T. schrieb:

>    # create partial sum process
>    loop foreach i Y --quiet
>      series $i_p = 0
>      series $i_m = 0
>      series $i_p = $i_p(-1) + pd_d_$i #Partial sum process of positive 
> changes
>      series $i_m = $i_m(-1) + nd_d_$i #Partial sum process of negative 

unrelated to your question: the cum() function may be helpful here

> 
> I would like to add the series $i_p and $i_m to the current variables 
> but I cannot find out how to use the "return" command correctly in this 
> context. Does anybody have a suggestion?

If the number of returned series is known in advance and small, you
might also try the pointer variant:

function void getoutput(series *out1, series *out2)
...
end function

series output1=0
series output2=0
getoutput(&output1, &output2)

The advantage is that the names of the returned series are controlled
not by the function code, but by the calling code.

HTH,
sven

Reply via email to