Next: bcprd() Up: MacAnova Help File Previous: autoreg()   Contents

batch()

Usage:
batch(fileName [,echo:T or F, prompt:string]), CHARACTER scalars
  fileName and string



Keywords: syntax, control, files
                                  Usage
batch(FileName) executes the commands in the file with name given in the
quoted string or CHARACTER variable FileName.  It must be the last
command in a line or a compound command surrounded by '{' and '}' and
must not be in a loop.

In windowed version, if FileName is "" you will be prompted to enter
the file name in a dialog box.

Lines of the file are read sequentially and executed as if they were
typed at the keyboard.  Normally, each line is printed with the file
name as prompt before it is executed.  You can suppress this by using
keyword phrase echo:F (see below), or by previously executing
setoptions(batchecho:F) (see topics setoptions() and 'options').

The batch file can contain any sequence of MacAnova commands.  This
includes additional batch() commands that do not read from a batch file
currently in use.

                                 Example
Here is an example of a short batch file designed to do cubic regression
of variable y on variable x and do a plot of residuals against x (see
also regress() and plot()):

   xsq <- x * x
   xcub <- x * xsq
   regress("y=x + xsq + xcub")
   plot(x, RESIDUALS, title:"Cubic regression residuals vs x")

                           Treatment of errors
When an error occurs, the default behavior is to terminate all current
batch() commands.  You can use setoptions(errors:N), where N is a
positive integer to increase the number of errors tolerated before
termination.  See topic 'options"errors"' for details.

                                Keywords
batch(FileName,echo:F) works the same as batch(FileName) except the
prompts and lines read from the file are not printed.  This status is
inherited by batch files invoked from within a batch file.  You can use
setoptions(batchecho:F) to set the default behavior of batch() so that
lines will not be echoed.

batch(FileName,echo:T) forces the printing of prompts and commands, even
if option 'batchecho' has been set False (see subtopic
'options:"batchecho').

NOTE: If you want to suppress printing of both prompts and output, put
  setoptions(quiet:T)
at the start of the file and
  setoptions(quiet:F)
at the end of the file.  See subtopic 'options:"quiet"'.

batch(FileName,prompt:Prompt), where Prompt is a quoted string or
CHARACTER scalar, forces echoing, with command lines starting with
Prompt instead of the file name.  When the batch file contains a
setoptions(prompt:newPrompt) command, newPrompt overrides Prompt.  A
subsequent setoptions(default:T) in the file, restores Prompt.  See
topics setoptions(), 'options'.

                            Cross references
See also topic 'launching'.


Gary Oehlert 2005-08-12