Command Reference : EViews Programming : Program Modes
Program Modes
Program Message Logging
Logging Options
Program modes describe different settings associated with the execution of your program. You may, for example, choose to provide verbose messaging where your program will echo each command to the status line, or you may choose quiet mode. Alternately, you may wish to run a legacy program file in Version 4 compatibility mode.
EViews provides you with the opportunity to set program execution modes at the time that the program is first run. In addition, you may use the “MODE” statement to change the execution mode of a program from within the program itself. One important benefit to using “MODE” statements is that the program can begin executing in one mode, and switch to a second mode as the program executes.
To change the mode for quiet or verbose mode, simply add a line to your program reading “MODE” followed by either the “QUIET” or the “VERBOSE” keyword, as in
mode quiet
For version 4 compatibility, you should use the keyword “VER4”:
mode ver4
as a line in the body of the program.
Multiple settings may be set in a single “MODE” line:
mode quiet ver4
and multiple mode statements may be specified in a program to change the mode as the program runs:
mode quiet
[some program lines]
mode verbose
[additional program lines]
Note that setting the execution mode explicitly in a program overrides any settings specified at the time the program is executed.
Program Message Logging
When executing a program in EViews, it may be useful to keep track of what is happening during execution. Log windows allow you to determine more accurately the state of various objects in your workfile or follow program progression.
Log windows may be switched on using the logmode command. The logmode command gives the ability to specify the name of the log window and directs the messages to the window with the specified name. If no name is specified the messages are directed to a window with the name of the program. If a program is executed more than once and a log window has already been created, with no name specified for the log, the log window will be cleared and all subsequent messages will be sent to the existing log window. If you wish to preserve a log, you may either select to append message, save the log to a text file, or freeze it, which creates a text file object. All of these actions can be accessed by the popup menu that appears when right-clicking on a message log window.
The log windows appear as tabbed windows and can be rearranged by the user. The logmode command has an option to have the log window floating next to the program window.
There are several types of messages that can be logged: program lines, status line messages, user log messages, and program errors. When displayed in a log message, each type will appear in a different color, making it easier to differentiate one type from another. Program lines are echoes of the line of code in the program currently being executed, and are displayed in black. Status line messages are the messages displayed in the status line and appear in blue. User log messages are custom messages created by the program via the logmsg command and appear in green. Program errors are messages generated when a logical or syntax error has occurred and appear in red.
Beginning with EViews 10, all program log windows appear as tabbed windows and may be rearranged. Additionally, you have the ability to specify a name for the log window and direct the messages to the log window with the specified name. If no name is specified, the messages are directed to a window with the name of the program. This was the default behavior in versions of EViews before EViews 10.
Logging Options
The Message settings dialog in the Programs section of the General Options dialog specifies whether EViews runs programs in Verbose mode (the default), lists commands in the status line as they are executed, or uses Quiet mode, which suppresses this information. EViews will run faster in quiet mode since the status line display does not need to be updated.
This default may always be overridden from the Run Program dialog, or by using the option "q" in the run statement, as in:
run(q) myprogram
In addition, you may modify the Logging settings to delete (Clear) or leave (Append) the contents of the log window on program start.
See also the logmode, logmsg, logclose, and logsave commands, which all have additional options to specify the name of the log.