Using @elem for an alphaseries inside a for

For questions regarding programming in the EViews programming language.

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

amajlufr
Posts: 1
Joined: Tue Jan 19, 2021 1:00 pm

Using @elem for an alphaseries inside a for

Postby amajlufr » Tue Jan 19, 2021 1:13 pm

Hello, I'm sort of new into EViews programming and I have the following question.

I'm using a program to create a table with lots of information and calculations for a paper. Everything works just fine except for one thing.

I want to include for every set of calculations the name of the state I'm doing it for. I have an alpha series with the respective names of the states. I know this can be done with an expression like this:

tabla1(1,1) = @elem(nombre_entidad, "1")

In this case, the program returns me the first element of the series and posts it in the (1,1) cell. Till now, everything's okay.
The real problem begins when I want to build a "for function" to have it automatically made for all the states in my data. My expression then goes like this:

[...]
for !n =1 to 32
smpl if entidad = !n
tabla1(!i,1) = @elem(nombre_entidad, "!n")
[...]

This is where the problem begins as the program shows the following:
"Illegal date !N in "TABLA1(7,1) = @ELEM(NOMBRE_ENTIDAD, "!N")" on line 5".

I want to run the for function as I don't want to go state by state writing the name, but the program shows me this.


Any ideas how to solve it?

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

Re: Using @elem for an alphaseries inside a for

Postby EViews Gareth » Tue Jan 19, 2021 2:48 pm

Code: Select all

%n = @str(!n)
tabla1(!i,1) = @elem(nombre_entidad, %n)
Follow us on Twitter @IHSEViews


Return to “Programming”

Who is online

Users browsing this forum: EViews Gareth and 33 guests