Can't pull out contents of an svector using {}

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt

PatMcK
Posts: 1
Joined: Wed Sep 25, 2013 9:31 am

Can't pull out contents of an svector using {}

Postby PatMcK » Wed Sep 25, 2013 9:37 am

I'm trying to loop over the index of an svector and do some operations using series whose variable names are in each element of the svector. For example, if I was to try to take the log of every variable, if my series names are all stores in an svector called indvar:

for !j = 1 to @rows(indvar)
series l_{ indvar({!j})} = log( { indvar({!j})} )
next

Then I get the error "INDVAR(1) is not a valid string name or scalar name in series l_{ indvar({!j})} = log( { indvar({!j})} )

from what it says in the programming reference guide I should be able to treat indvar(1) as a string, shouldn't I?

Also if I put the string into a temporary string like this:
for !j = 1 to @rows(indvar)

%derp = indvar({!j})
series l_{{ indvar({!j})}} = log( { indvar({!j})} )
series dl_{%derp} = dlog( { %derp } )
next

EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 13604
Joined: Tue Sep 16, 2008 5:38 pm

Re: Can't pull out contents of an svector using {}

Postby EViews Gareth » Wed Sep 25, 2013 9:42 am

Pulling them out into temporary strings should work.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests