Removing characters from a predefined string
Posted: Tue May 03, 2011 12:15 pm
Hello,
I am using strings to create a vector of variables that are run as separate dependent variables in separate regressions that are restimated and forecast. The problem I am running into is that the variables have a code key at the beginning that must be used in the original string creation. But later, I must do a multiplication with another series that has identical names, but does not have the code key at the beginning of the variable name.
Everything works in this code except the second to last line because the series vol* does not have "ab_" in the names. Is there anyway to remove the "ab_" from the string inside the loop in such a way that I could run this? I imagine there are a few ways to approach this problem, but I'll add that this is being run on over 300 regressions and in three loops because EViews his some type of limit on the number of variables could use in the initial for statement. So I am looking for (hopefully) a simple solution.
%indoor = @wlookup("ab_indoor*", "series")
%outdoor = @wlookup("ab_outdoor*", "series")
for %key {%indoor} {%outdoor}
equation eq_{%key}.stepls {%key} c @ {%key}(-1) {%eqvar}
forecast f_{%key}
genr clk_{%key}=f_{%key}*vol_{%key}
next
Thanks!
PacNW
I am using strings to create a vector of variables that are run as separate dependent variables in separate regressions that are restimated and forecast. The problem I am running into is that the variables have a code key at the beginning that must be used in the original string creation. But later, I must do a multiplication with another series that has identical names, but does not have the code key at the beginning of the variable name.
Everything works in this code except the second to last line because the series vol* does not have "ab_" in the names. Is there anyway to remove the "ab_" from the string inside the loop in such a way that I could run this? I imagine there are a few ways to approach this problem, but I'll add that this is being run on over 300 regressions and in three loops because EViews his some type of limit on the number of variables could use in the initial for statement. So I am looking for (hopefully) a simple solution.
%indoor = @wlookup("ab_indoor*", "series")
%outdoor = @wlookup("ab_outdoor*", "series")
for %key {%indoor} {%outdoor}
equation eq_{%key}.stepls {%key} c @ {%key}(-1) {%eqvar}
forecast f_{%key}
genr clk_{%key}=f_{%key}*vol_{%key}
next
Thanks!
PacNW