Page 1 of 1

Using @elem for an alphaseries inside a for

Posted: Tue Jan 19, 2021 1:13 pm
by amajlufr
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?

Re: Using @elem for an alphaseries inside a for

Posted: Tue Jan 19, 2021 2:48 pm
by EViews Gareth

Code: Select all

%n = @str(!n) tabla1(!i,1) = @elem(nombre_entidad, %n)