Simple Subrotines

For questions regarding programming in the EViews programming language.

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

amigosu
Posts: 3
Joined: Tue Oct 29, 2013 9:59 am

Simple Subrotines

Postby amigosu » Tue Oct 29, 2013 11:06 am

Hi,
I'm using this code to generate sazonally adjusted data:

Code: Select all

%variavel="comibgef0" smpl 2000 2013 '@all freeze(x12out) {%variavel}.x12(save="d11",tf=auto,sfile="G:\Macroeconomia\Dados Econômicos\Fontes Primárias\Dessazonalizacao\x12mensal_comercio.txt") delete x12out
The problem is that I have to run this program several times and each time change the name of the series (that is stocked at %variavel). Is there any way to make it easier?

I'm using eviews 7.2.

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

Re: Simple Subrotines

Postby EViews Gareth » Tue Oct 29, 2013 11:21 am

You could write a for loop that loops over the variables.

amigosu
Posts: 3
Joined: Tue Oct 29, 2013 9:59 am

Re: Simple Subrotines

Postby amigosu » Thu Oct 31, 2013 10:13 am

The problem with a for loop is that the name of the series does not have any logical sequence. What I thought was to do something create a fuction with an argument that is the name of the series, so the code will still be easy to read. Other option is a switch or a combination of loop and ifs.

The problem is that I do not know anything about eviews programming syntax. Can you suggest anything?

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

Re: Simple Subrotines

Postby EViews Gareth » Thu Oct 31, 2013 10:28 am

You can use the @wlookup function to find out the names of all the series in the workfile, and then loop over them.

Or, you could put all the series you want to seasonally adjust into a group, and then loop over the members of the group.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests