Page 1 of 1

Bulk Series Declaration

Posted: Fri Sep 30, 2011 6:57 am
by caburdick
Is there a way to use wildecards when definining new series? I have closing price data for a variety of asset indices and I would like to convert them all to gross rates of return. Is there a way to do something like:

series *_return = 1+@pcx(*_close)

I could declare a group and loop through elements of the group to define the new series one at a time, but it seems like something simpler should be possible.

Re: Bulk Series Declaration

Posted: Fri Sep 30, 2011 7:49 am
by EViews Gareth
No (and if you think of about it, there isn't a logical way such a thing could work).

Re: Bulk Series Declaration

Posted: Fri Sep 30, 2011 9:03 am
by caburdick
Since * represents multiplication in a formula, such a command would require a redefinable wildcard (which some languages allow); are there further complications that I'm missing?

Re: Bulk Series Declaration

Posted: Fri Sep 30, 2011 9:22 am
by EViews Gareth
In your specific case, no, but in the more general case of:

Code: Select all

series *_return = 3
it clearly wouldn't work.

Re: Bulk Series Declaration

Posted: Fri Sep 30, 2011 10:26 am
by startz
In your specific case, no, but in the more general case of:

Code: Select all

series *_return = 3
it clearly wouldn't work.
Wouldn't that just set all series with a name ending in "_return" equal to 3?

Re: Bulk Series Declaration

Posted: Fri Sep 30, 2011 11:33 am
by EViews Gareth
Yes, but he wants to create new series. It would create an infinite amount of new series.

Re: Bulk Series Declaration

Posted: Fri Sep 30, 2011 11:42 am
by startz
Oh.
Is an infinite number of new series all that bad? Computers have a lot more RAM then they used to.

Actually, I'm not too enamored of wild cards in this situation. Too easy to introduce errors. Or in the case of the original request, what happens if there are different variable lists with postfix "_return" versus "_close"

But would it be easy to add a function that gave a list of all the prefixes of variables with a given wildcard prefix (or something) in order to make it easy to write a loop? Given that EViews doesn't have a native list object, maybe not so easy?