use control variable when naming a string variable

For questions regarding programming in the EViews programming language.

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

cap
Posts: 55
Joined: Fri Oct 17, 2008 11:47 am

use control variable when naming a string variable

Postby cap » Thu Sep 10, 2009 10:13 am

Hello,

I would like to have a for loop where my control variable is used in the name of strings that I define. The documentation mentions how to do this when naming series, but not when defining names for strings.


I have tried the following, but get errors:

for !i = 1 to 3

%stringname_!i = @right(mygroup.@seriesname(!i+1),6)
alpha string_!i = @insert(%stringname_!i,"xyz",2)

next



Thanks in advance,
-cap

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

Re: use control variable when naming a string variable

Postby EViews Gareth » Thu Sep 10, 2009 10:28 am

I don't think that is currently possible. You cannot dynamically assign the name of a program variable.

You could try storing the strings as cells in a table rather than in string variables though.

Code: Select all

table a
for !i=1 to 3
a(1,!i) = @right(mygroup.@seriesname(!i+1),6)
%stringname = a(1,!i)
alpha string_!i = @insert(%stringname,"xyz",2)
Follow us on Twitter @IHSEViews


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 57 guests