Looping Series Name

For questions regarding programming in the EViews programming language.

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

kkeough
Posts: 9
Joined: Wed Nov 06, 2013 10:18 am

Looping Series Name

Postby kkeough » Wed Nov 06, 2013 10:28 am

I am working on converting old Aremos command files into Eviews
This is the old command File:
for x=#names;
series emp|#x=(re3254a|#x+re3333a|#x+re3341a|#x+re3342a|#x+re3343a|#x+re3344a|#x+re3345a|#x+re3346a|#x+re3364a|#x+re3391a|#x+re5112a|#x+re5121a|#x+re517a|#x+re518a|#x+re5191a|#x+re5413a|#x+re5415a|#x+re5417a|#x+re6215a|#x);
end;

for x=#names;
for y=#naics;
series hi|#y|a|#x = re|#y|a|#x/reta|#x;
series justemp|#y|a|#x = re|#y|a|#x;
end;
end;

!need just sum employment by state to devise average yearly growth in high tech sector


for y=#naics;
series den|#y|us = re|#y|aus/retaus;
end;

for x=#names;
for y=#naics;
series qe|#y|a#x=(re|#y|a|#x/reta|#x)/(den|#y|us);
end;
end;

It seems like the #y and #x allow the program to run through the whole series with only one line of code.

The NAICS codes are: 3254 3333 3341 3342 3343 3344 3345 3346 3364 3391 5112 5121 5171 5172 5174 5179 5182 5191 5413 5415 5417 6215
The names are all 50 states.
Example of the mnemonic being read: RE3254AAL RE3254AAR RE3333AAL RE3333AAR. So this is the mnemonics for NAICS codes 3254 and 3333 for Arkansas and Alabama.

Do you know how I can run the program to create the results that run through every NAICS and State code, like the Aremos code does? I can only figure out how to write each one individually using series statements.

I have attempted to create a few loops, but I always get either syntax error or invalid string or scalar name.

This was one attempt for the first command:
for %State AL AK AZ AR CA CO CT DE FL GA HI ID IL IN IA KS KY LA ME MD MA MI MN MS MO MT NE NV NH NJ NM NY NC ND OH OK OR PA RI SC SD TN TX UT VT VA WA WV WI WY US
series employment{%State}=re3254a{%State}+re3333a{%State}+re3341a{%State}+re3342a{%State}+re3343a{%State}+re3344a{%State}+re3345a{%State}+re3346a{%State}+re3364a{%State}+re3391a{%State}+re5112a{%State}+re5121a{%State}+re517a{%State}+re518a{%State}+re5191a{%State}+re5413a{%State}+re5415a{%State}+re5417a{%State}+re6215a{%State}
next

This is using Eviews 8.

Thank you,
Kristen Keough

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

Re: Looping Series Name

Postby EViews Gareth » Wed Nov 06, 2013 10:47 am

I'm afraid I know nothing about Aremos, so cannot help much. I will say that I see nothing particularly wrong with the EViews for loop you have.

kkeough
Posts: 9
Joined: Wed Nov 06, 2013 10:18 am

Re: Looping Series Name

Postby kkeough » Wed Nov 06, 2013 11:01 am

Ok then just looking at the Eviews command do you know why I would be getting the error, %state is not a valid string or scalar name? It is my first command after fetching the data from the database. Do I need to create a string object or an alpha series with all of the states names instead of just listing them?

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

Re: Looping Series Name

Postby EViews Gareth » Wed Nov 06, 2013 11:09 am

Listing them should be fine. As I said, I see nothing wrong in your EViews for loop.

kkeough
Posts: 9
Joined: Wed Nov 06, 2013 10:18 am

Re: Looping Series Name

Postby kkeough » Wed Nov 06, 2013 11:52 am

Ok, thank you so much for your help! For some reason it ran this time when it wouldn't in the past!

One last question, how do I perform multiple for statements like:

for %State AL AK AZ AR CA CO CT DE FL GA HI ID IL IN IA KS KY LA ME MD MA MI MN MS MO MT NE NV NH NJ NM NY NC ND OH OK OR PA RI SC SD TN TX UT VT VA WA WV WI WY US
for %NAICS 3254 3333 3341 3342 3343 3344 3345 3346 3364 3391 5112 5121 517 518 5191 5413 5415 5417 6215
series qe{%NAICS}a{%State}=(re{%NAICS}a{%State}/(den{%NAICS}us)
next

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

Re: Looping Series Name

Postby EViews Gareth » Wed Nov 06, 2013 12:12 pm

Have two Next statements.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests