Hello,
Eviews 8 here. I have multiple codes that I want to run with master code using exec function. It works fine. Each underlying code has a control variable for sample:
%t_smpl_beg="2015m1"
%t_smpl_end="2015m3"
The dates in the sample change and I need to change them individually in each underlying code. Is there a way to set this control in master code that runs underlying codes ? Then changes would be made once and they would apply to all codes? Thanks, Vytas
multiple codes
Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: multiple codes
Make them an argument or option in the executed program. You would then pass those variables on to the child programs as arguments/options.
Re: multiple codes
thank you. Do you have an example by any chance?
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: multiple codes
The Program Arguments section of the EViews Programming chapter of the Command and Programming Reference has lots of examples of using program arguments.
Similarly the Program Options section of the EViews Programming chapter of the Command and Programming Reference has lots of examples of using program options.
Similarly the Program Options section of the EViews Programming chapter of the Command and Programming Reference has lots of examples of using program options.
Re: multiple codes
Hi,
I read your suggested material about program arguments and I cannot get it to run. Here is what I have with 2 arguments at the end as suggested in programming chapter:
%t_smpl_beg="2015m1"
%t_smpl_end="2015m3"
exec .\data_ger.prg" %t_smpl_beg %t_smpl_end
My child program gives me an error : error in sample: illegal date %t_smpl_beg
What am I doing wrong? Thanks.
I read your suggested material about program arguments and I cannot get it to run. Here is what I have with 2 arguments at the end as suggested in programming chapter:
%t_smpl_beg="2015m1"
%t_smpl_end="2015m3"
exec .\data_ger.prg" %t_smpl_beg %t_smpl_end
My child program gives me an error : error in sample: illegal date %t_smpl_beg
What am I doing wrong? Thanks.
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: multiple codes
Hard to say without knowing what you're doing.
Re: multiple codes
Here is the part of the child program where I change sample. I have multiple programs for different countries. I have to go in each program and change control variable for sample: %t_smpl_beg and '%t_smpl_end. I also have master program that executes all child programs via exec command. What I am trying to achieve is to have the sample control variables in master exec program which would change all child samples.
%t_smpl_beg="2015m7"
'%t_smpl_end="2015m10"
for %1 "1" "4" "7"
!hor = {%1}
!horf = !hor+3
equation ols_{%1}.ls gdp_yoy c vemi(hor to -!horf) vlei(-!hor to -!horf) gdp_yoy(-!h_gdp)(-!hor to -!horf)
smpl %t_smpl_beg+!hor-1 %t_smpl_end+!hor-1
ols_{%1}.fit gdp_{%1}
smpl @all
next
I would like that exec .\data_ger.prg" %t_smpl_beg %t_smpl_end would apply control variables to child program above.
I hope this makes a bit more clear. Thanks
%t_smpl_beg="2015m7"
'%t_smpl_end="2015m10"
for %1 "1" "4" "7"
!hor = {%1}
!horf = !hor+3
equation ols_{%1}.ls gdp_yoy c vemi(hor to -!horf) vlei(-!hor to -!horf) gdp_yoy(-!h_gdp)(-!hor to -!horf)
smpl %t_smpl_beg+!hor-1 %t_smpl_end+!hor-1
ols_{%1}.fit gdp_{%1}
smpl @all
next
I would like that exec .\data_ger.prg" %t_smpl_beg %t_smpl_end would apply control variables to child program above.
I hope this makes a bit more clear. Thanks
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: multiple codes
The smpl statements need to refer to the argument variables %0, %1 etc...
Who is online
Users browsing this forum: No registered users and 2 guests
