Using @replace and @word and permutations and combinations
Posted: Tue Jan 19, 2016 4:44 am
Hi,
I have a number of time series of rates so I have 1Y, 2Y, 3Y out to 10Y. I would like to define some other time series which are three point combinations of the individual rate time series - for example 1Y2Y3Y= 1Y+3Y - (2*2Y). I have a list of some of the three point combinations - so i have string names of all the combinations I would like - but I would like to know how to use the @replace or @right and @left functions to write the formula R1YR2YR3Y = R1+R3-(2*R2) (where R1 = the time series for the first rate, R2= the time series for the second rate and R3 = the third rate time series). Please could you help. I was trying to use the @replace function to replace all the Ys with spaces and then use the left function to take everything to the left of the first space etc....but it's not working and i am really am stuck on how to do this. In excel I am doing it by using the ssplit function (but can also be done with mid/left and right).
So trying first with only 2 three point combinations....
svector(2) sfly
sfly(1) = 1Y2Y3Y
sfly(2)=2Y5Y10Y
group g_fly
For !i = 1 to 2
%name = "_"+sfly(!i)
series{%name} = @replace({%name}, "Y", " ")...***then i am very stuck****
.....
g_fly.add{%name}
next i
Also I am going to work out all the three point combinations in excel as I don't know how to program such a thing in eviews. My time series of rates are in a matrix, the first column is the time series for rate1, the second column is the time series for rate 2 etc....the three point combinations are such that rate1<rate2<rate3. So you cannot have 5Y10Y2Y, it must be 2Y5Y10Y..Could you give me some pointers on how to do this in eviews. Ie how to work out all the possible combinations and spit out the names which can then be fed into the above function which will compute each 3point combination....
Thanks
I have a number of time series of rates so I have 1Y, 2Y, 3Y out to 10Y. I would like to define some other time series which are three point combinations of the individual rate time series - for example 1Y2Y3Y= 1Y+3Y - (2*2Y). I have a list of some of the three point combinations - so i have string names of all the combinations I would like - but I would like to know how to use the @replace or @right and @left functions to write the formula R1YR2YR3Y = R1+R3-(2*R2) (where R1 = the time series for the first rate, R2= the time series for the second rate and R3 = the third rate time series). Please could you help. I was trying to use the @replace function to replace all the Ys with spaces and then use the left function to take everything to the left of the first space etc....but it's not working and i am really am stuck on how to do this. In excel I am doing it by using the ssplit function (but can also be done with mid/left and right).
So trying first with only 2 three point combinations....
svector(2) sfly
sfly(1) = 1Y2Y3Y
sfly(2)=2Y5Y10Y
group g_fly
For !i = 1 to 2
%name = "_"+sfly(!i)
series{%name} = @replace({%name}, "Y", " ")...***then i am very stuck****
.....
g_fly.add{%name}
next i
Also I am going to work out all the three point combinations in excel as I don't know how to program such a thing in eviews. My time series of rates are in a matrix, the first column is the time series for rate1, the second column is the time series for rate 2 etc....the three point combinations are such that rate1<rate2<rate3. So you cannot have 5Y10Y2Y, it must be 2Y5Y10Y..Could you give me some pointers on how to do this in eviews. Ie how to work out all the possible combinations and spit out the names which can then be fed into the above function which will compute each 3point combination....
Thanks