Page 2 of 3

Re: how to run multiple program in one program?

Posted: Thu Dec 10, 2015 9:57 am
by cc100
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"

Re: how to run multiple program in one program?

Posted: Thu Dec 10, 2015 10:05 am
by EViews Gareth

Code: Select all

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

Re: how to run multiple program in one program?

Posted: Fri Dec 11, 2015 1:06 am
by cc100
thank you very much Gareth :)

Re: how to run multiple program in one program?

Posted: Fri Dec 11, 2015 4:00 am
by cc100
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!

Re: how to run multiple program in one program?

Posted: Fri Dec 11, 2015 4:27 am
by cc100
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

Re: how to run multiple program in one program?

Posted: Fri Dec 11, 2015 4:36 am
by cc100
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

Re: how to run multiple program in one program?

Posted: Fri Dec 11, 2015 7:47 am
by EViews Gareth
Just replace run with exec

Re: how to run multiple program in one program?

Posted: Fri Dec 11, 2015 8:05 am
by cc100
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

Re: how to run multiple program in one program?

Posted: Fri Dec 11, 2015 8:23 am
by EViews Gareth
You need to use program arguments or options to pass the filename on

Re: how to run multiple program in one program?

Posted: Fri Dec 11, 2015 8:25 am
by cc100
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!)

Re: how to run multiple program in one program?

Posted: Fri Dec 11, 2015 8:59 am
by EViews Gareth
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.

Re: how to run multiple program in one program?

Posted: Fri Dec 11, 2015 9:20 am
by cc100
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?

Re: how to run multiple program in one program?

Posted: Fri Dec 11, 2015 9:28 am
by EViews Gareth
Yes, you're not using arguments or options.

Re: how to run multiple program in one program?

Posted: Fri Dec 11, 2015 9:32 am
by cc100
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.

Re: how to run multiple program in one program?

Posted: Fri Dec 11, 2015 9:51 am
by EViews Gareth

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.