Command Reference : EViews Programming : Program Options
Program Options
Much like program arguments, program options are special string variables that may be passed to your program when you run the program. You may specify options by providing a comma separated list of options in parentheses in the run or exec command statement, immediately after the name of the program as in:
run myprogram(myoption1, myoption2)
Note that options are only supported via the command line method using run or exec. You cannot pass an option to a program when running a program via the menus. Options are included via the command line by entering them in parenthesis immediately following the name of the program to be run.
In contrast with arguments, options may not be accessed directly from within your program. Rather you can only test for the existence of an option, or retrieve part of an option. The @hasoption command lets you test for the existence of an option. For example, @hasoption("k") will return a value of 1 if the “k” option was passed into the program at run time, or 0 if it was not.
@equaloption may be used to return the value to the right of an equality sign in an option. For example if “cov=hac” is entered as an option, @equaloption("cov") would return “hac”. If the option was not entered at all, @equaloption will return an empty string.
For example, suppose you have the following program:
%filename = @equaloption("file")
wfcreate(wf={%filename}) m 1968m3 1997m6
fetch progdemo::{%0}
if (@hasoption("LS")=1) then
smpl 1968m5 1992m12
equation {%0} c {%0}(-1)
If you were to run this program with:
run myprog(file=myhouse, ls) hsf
the program would create a workfile called MYHOUSE, would fetch a series called HSF, and would then create an equation called REG1 by performing least squares using the series HSF (for discussion of the “if” condition used in this example, see “IF Statements”).
If we had run the program with just:
run myprog hsf
the workfile would not have been named (and would be given the default name of UNTITLED), and the regression would not have been run.
Note that if your program name has spaces or illegal characters, it must be enclosed within quotes in run or exec commands. In this case, program options should be included after the closing quote without a space. For example, if we were to name our above program as MY PROG, then the correct method to issue options is:
run "my prog"(file=myhouse, ls) hsf