how to run multiple program in one program?

For questions regarding programming in the EViews programming language.

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

cc100
Posts: 62
Joined: Wed Jul 22, 2015 1:58 pm

Re: how to run multiple program in one program?

Postby cc100 » Thu Dec 10, 2015 9:57 am

Oh i thought i had, this is how i currently have it:

exec "C:\documents\test1\file1_jpy.prg"
%str = @datestr(@now, "yyyy-mm-dd" )
wfsave "C:\documents\test1\jpy1_" + %str +".wf1"

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

Re: how to run multiple program in one program?

Postby EViews Gareth » Thu Dec 10, 2015 10:05 am

Code: Select all

%str = @datestr(@now, "yyyy-mm-dd" ) %filename = "C:\documents\test1\jpy1_" + %str +".wf1" wfsave %filename

cc100
Posts: 62
Joined: Wed Jul 22, 2015 1:58 pm

Re: how to run multiple program in one program?

Postby cc100 » Fri Dec 11, 2015 1:06 am

thank you very much Gareth :)

cc100
Posts: 62
Joined: Wed Jul 22, 2015 1:58 pm

Re: how to run multiple program in one program?

Postby cc100 » Fri Dec 11, 2015 4:00 am

Hi Gareth,

I have an eviews workfile that computes a number of matrices. The workfile will be run everyday, so it will be date stamped. Everyday I would like to then save the matrices to an excel file, can you point me in the right direction of how to code this (I have no idea where to start!). I thought I could just go to addins in excel and do 'get data' and choose the workfile and then which matrices I want...,but the issue is that the workfile name will change each day as it is time stamped, so I would have to manually point to the correct workfile (and therefore matrices) each day....

Thanks!

cc100
Posts: 62
Joined: Wed Jul 22, 2015 1:58 pm

Re: how to run multiple program in one program?

Postby cc100 » Fri Dec 11, 2015 4:27 am

And one more question please!:

I have the following code (see below). But it stops after the first run (ie it runs the usd program and doesn't go onto eur). How can i make it go onto the next program? Thank you
------------------------------------------------------------------

%my_startdate_usd = "31/07/2000"
%my_startdate_eur = "31/07/2004"
%my_startdate_gbp = "31/07/2000"

%my_enddate = "11/12/2015"
%str = @datestr(@now, "yyyy-mm-dd" )


%filename1 = "C:\documents\test1\usd_" + %str +".wf1"
%filename2 = "C:\documents\test1\eur_" + %str +".wf1"
'%filename3 = "C:\documents\test1\gbp_" + %str +".wf1"

run "C:\documents\test1\usd _rolling.prg"
wfsave %filename1
wfclose %filename1

run "C:\documents\test1\eur_rolling.prg"
wfsave %filename2
wfclose %filename2

run "C:\documents\test1\gbp_rolling.prg"
wfsave %filename3
wfclose %filename3

cc100
Posts: 62
Joined: Wed Jul 22, 2015 1:58 pm

Re: how to run multiple program in one program?

Postby cc100 » Fri Dec 11, 2015 4:36 am

i know i need to use the exec function, but I don't know how to pass in the startdate, enddate,and filename.... I basically don't know how to tweak the above code to use exec

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

Re: how to run multiple program in one program?

Postby EViews Gareth » Fri Dec 11, 2015 7:47 am

Just replace run with exec

cc100
Posts: 62
Joined: Wed Jul 22, 2015 1:58 pm

Re: how to run multiple program in one program?

Postby cc100 » Fri Dec 11, 2015 8:05 am

But when i do that replacement the 'workfile create' box pops up asking me to input a start and end date....it didn't pop up before

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

Re: how to run multiple program in one program?

Postby EViews Gareth » Fri Dec 11, 2015 8:23 am

You need to use program arguments or options to pass the filename on

cc100
Posts: 62
Joined: Wed Jul 22, 2015 1:58 pm

Re: how to run multiple program in one program?

Postby cc100 » Fri Dec 11, 2015 8:25 am

I don't get why it's prompting me to input a start and end date directly into the workfile creation box when I have the start date and end dates in the program file. Any thing at all you can say Gareth would be so helpful! (defo going around in circles!)

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

Re: how to run multiple program in one program?

Postby EViews Gareth » Fri Dec 11, 2015 8:59 am

As far as I can see, you're not passing on the start/end date to the child programs, so the box pops up asking you for one.

cc100
Posts: 62
Joined: Wed Jul 22, 2015 1:58 pm

Re: how to run multiple program in one program?

Postby cc100 » Fri Dec 11, 2015 9:20 am

Oh the child programs are the following:

"C:\documents\test1\usd _rolling.prg"
"C:\documents\test1\eur_rolling.prg"
"C:\documents\test1\gbp_rolling.prg"

And at the top of each child program is the following:
wfcreate {%filename1} d5 {%my_startdate_usd} {%my_enddate}

where %filename1 is for the usd program, %filename2 is for the eur program and %filename3 is for the gbp program...

At the top of the master file i put:
%my_startdate_usd = "31/07/2000"
%my_startdate_eur = "31/07/2004"
%my_startdate_gbp = "31/07/2000"

%my_enddate = "11/12/2015"
%str = @datestr(@now, "yyyy-mm-dd" )
%filename1 = "C:\documents\test1\usd_" + %str +".wf1"
%filename2 = "C:\documents\test1\eur_" + %str +".wf1"
'%filename3 = "C:\documents\test1\gbp_" + %str +".wf1"

So this is where i am pulling in the inputs for the child programs.... Is that wrong?

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

Re: how to run multiple program in one program?

Postby EViews Gareth » Fri Dec 11, 2015 9:28 am

Yes, you're not using arguments or options.

cc100
Posts: 62
Joined: Wed Jul 22, 2015 1:58 pm

Re: how to run multiple program in one program?

Postby cc100 » Fri Dec 11, 2015 9:32 am

oh i thought i was,sorry - it worked with the run command.... ie it took the start dates and end dates from the master file as inputs into the child file.. Could you give me a short example please, so that I can see where i am going wrong. Sorry I've never done this before, so I am confused.

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

Re: how to run multiple program in one program?

Postby EViews Gareth » Fri Dec 11, 2015 9:51 am

Code: Select all

@datestr(@now, "yyyy-mm-dd")
returns the current date as a string.


To pass information onto child programs you'll want to use program arguments or program options.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests