include + string var.

For questions regarding programming in the EViews programming language.

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

ferdy_adam
Posts: 4
Joined: Mon May 16, 2011 12:19 am

include + string var.

Postby ferdy_adam » Mon May 16, 2011 1:17 am

Hi
I wanted to write the following line in a program:

%typ="Ndc2_11"
include "creationmodux2010_{%typ}.prg"

Why would that not work? Is there an way to run different programs according to the value of a string variable?
Thank you very much for your kind help

Yours sincerely

Ferdy Adam

trubador
Did you use forum search?
Posts: 1518
Joined: Thu Nov 20, 2008 12:04 pm

Re: include + string var.

Postby trubador » Mon May 16, 2011 3:08 am

Have you tried the following?:

Code: Select all

%typ="Ndc2_11"
exec creationmodux2010_{%typ}

ferdy_adam
Posts: 4
Joined: Mon May 16, 2011 12:19 am

Re: include + string var.

Postby ferdy_adam » Mon May 16, 2011 3:54 am

thanks for that suggestion
i'm not used to usind the exec command
your suggestion actually does not work but this works:
%typ="g:\data\adam\modux\archivesModeles\prevision\Prevision2010\programs\lecturetransfdonnees2010_Ndc2_11.prg"
exec {%typ}
hence i have to specify to whole path but i can construct it from different string elements, which is what i wanted to do.
best regards
ferdy


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 34 guests