Hello, everyone:
I'm wondering if a replace variable can refer to another replace variable in Eviews?
for example
create u 50
series x = nrnd
%var1 = "x" 'here I use a replace variable to refer series x
!k = 1 'here I use a control variable as index
My question is how can I create a replace variable %xvar to refer series x THROUGH %var and !k ???
I tried a couple of ways to work it out but they don't work such as
%xvar = "%var" + @str({!k}) 'here I create a string to represent replace variable %var1
series y = {%xvar} 'it doesn't work
or series y = {{%xvar}} 'it doesn't work either
we can do this kind of "double reference" easily in SAS, but I don't know whether Eviews can really do that or not.
regards
Ralph
Replace Variables Problem
Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13602
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Replace Variables Problem
I don't believe you can use a replacement variable to refer to a replacement variable like that, no.
That doesn't mean there isn't a way to do what you want. Unfortunately I can't quite follow what it is you're trying to do, so can't offer any advice on how to do it.
That doesn't mean there isn't a way to do what you want. Unfortunately I can't quite follow what it is you're trying to do, so can't offer any advice on how to do it.
Re: Replace Variables Problem
I have a similar problem and I tried several things
!loopmax=22
%1 = "OBLICHFDOM"'
for !loop=1 to !loopmax
show %!loop (This does not work)
next
!loopmax=22
%1 = "OBLICHFDOM"'
for !loop=1 to !loopmax
show %!loop (This does not work)
next
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13602
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Replace Variables Problem
As said above, you can't combine replacement variables like that, nor can you refer to a replacement variable with a replacement variable.
I assume you have something like this:
%1 = "OBLICHFDOM"
%2 = "Something"
%3 = "Something else"
and then want to loop through them with a numerical variable.
The easiest way to do this is to not loop through them with a numerical variable, but with a string variable:
Or, if you really want to use a numerical variable in your for loop, then put the text into a table:
I assume you have something like this:
%1 = "OBLICHFDOM"
%2 = "Something"
%3 = "Something else"
and then want to loop through them with a numerical variable.
The easiest way to do this is to not loop through them with a numerical variable, but with a string variable:
Code: Select all
for %i "oblichfdom" "something" "something else"
statusline %i
next
Or, if you really want to use a numerical variable in your for loop, then put the text into a table:
Code: Select all
table vars
vars(1,1) = "oblichdom"
vars(2,1) = "something"
vars(3,1) = "something else"
for !i=1 to 3
%var = vars(!i,1)
statusline %var
next
Re: Replace Variables Problem
But what I have to do if I want to make a lot of similar names in cells of table like this:
table vars
vars(1,1) = "something1"
vars(2,1) = "something2"
vars(3,1) = "something3"
....
vars(100,1) = "something100"
table vars
vars(1,1) = "something1"
vars(2,1) = "something2"
vars(3,1) = "something3"
....
vars(100,1) = "something100"
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13602
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Replace Variables Problem
Code: Select all
table vars
for !i=1 to 100
vars(!i,1) = "something"+@str(!i)
next
Who is online
Users browsing this forum: No registered users and 2 guests
