Next: scalars Up: MacAnova Help File Previous: samplesize()   Contents


save(FileName [,all:T, v335:T, v406:T, nulls:F, options:F,\
  history:T, ascii:T])
save() repeats previous save() or asciisave()

Keywords: files, general, variables, null variables
save(FileName) saves the MacAnova "workspace", that is, all the current
variables and option values, in a file with name given in the quoted
string or CHARACTER variable FileName.  The file will be in a binary
format that is specific to the type of computer.  The workspace can be
recovered later by restore().  See topics 'files', 'workspace',

save(FileName,ascii:T) is equivalent to asciisave(FileName), that is,
the file written will be an ASCII text file instead of a binary file.
This option can be used together with others described below.

In a version with windows (Macintosh, Windows, Motif), FileName can be
"", in which case you will be prompted for the file name.

save(), with no file name, saves the workspace in the same file as
specified in a previous asciisave() or save().  If the previous save was
ASCII, so will be the current save.  Moreover, if the previous save()
specified an obsolete format (see below), the same format will be used,
unless explicitly changed.  If there was no previous save() or
asciisave(), omitting the file name is an error.

save(FileName, var1, var2, ....) does a partial save, saving only
variables or macros var1, var2, ... on the file.  Any variable to be
saved that is specified in keyword form (example: save(FileName,
residuals:RESIDUALS)), will be restored having the keyword name.  Unless
the variables are saved using an obsolete format, when a partial
save is restored, other variables are not affected.  If an obsolete
format is used, other variables are normally deleted when the file is
restored, unless keyword phrase delete:F is used on restore().

On all versions, a complete save, but not a partial save, normally saves
the special structure GRAPHWINDOWS (see topic 'GRAPHWINDOWS') as part of
the workspace.  When GRAPHWINDOWS is restored, windows corresponding to
any GRAPH components are redrawn.

save(FileName, graphwind:F) saves the workspace without including

On versions that maintain a history of recent commands (Macintosh,
Windows, extended memory DOS, Motif, Unix/Linux), a complete save (but
not a partial save) normally saves this history.  When restore()
recovers the information in the file, the saved history list replaces
the command history unless restore() keyword phrase 'delete:F' is used.

save(FileName,history:F) saves the workspace without saving the command

save(FileName,history:T) saves the workspace together with the command
history, even when the value of option 'savehistry' is False (see topic
'options':"savehistry"').  'history:T' is illegal on a partial save.
See sethistory() and gethistory().

save(FileName,options:F) suppresses saving the current values of
options, which normally occurs.  When options:F is not used, restore()
resets options to the saved values, including random number seeds.  See
setoptions(), getoptions().

You can use any of history:F, options:F and graphwind:F together.

save(FileName,all:T) saves, in addition to the workspace, a variety of
information computed by the last GLM command.  When this information is
recovered by restore(), it becomes possible to use functions such as
secoefs() and modelinfo() to get information on the last GLM analysis
before the save.

This option is really useful only when you have just completed a GLM
(generalized linear or linear model) computation (regress(), anova(),
poisson(), etc.) that took a long time to compute since it is usually
sufficient just to repeate the GLM command when you restore the
workspace.  If the model was complex and had many cases, 'all:T' can
greatly increase the size of the workspace file.

save(FileName, nulls:F [, var ...]) does not save NULL variables.  See
topic 'NULL'.

save() also saves the current time and date.  These are reported by
restore() when the workspace or variables are restored.

In addition, save() saves information about the computer MacAnova is
running on and the compiler it was compiled with, plus information about
the internal representation of linear models.  This information is used
by restore() to determine if it is safe to restore variables.  If you
are planning to restore the file on another computer or different
version of MacAnova, use asciisave().

save() differs from asciisave() in that asciisave() saves the
information in the form of a "text" file, more or less human readable,
that can be transferred between different types of computers.  Files
created by asciisave() are often bigger than the corresponding file
created by save().

save() and asciisave() are useful when a session must be interrupted and
you don't want to lose what you have done.  On an unstable system or
when using MacAnova remotely over a noisy phone line, a useful insurance
measure is to save your current variables every few minutes.  The
following creates a macro that makes this easy:
  Cmd> snapshot <- macro("save(\"snapshot.sav\",all:T)")

Then simply typing 'snapshot()' saves a copy of your workspace, options,
and internal variables related to GLMs on file snapshot.sav.  They can
be restored by 'restore("snapshot.sav")'.

  Cmd> save("chckpnt.bin") # save entire workspace, but not GLM stuff
  Cmd> save("chckpnt.bin",options:F,history:)#no history or options
  Cmd> save("saveFile",all:T) # save everything, including GLM stuff
  Cmd> asciisave("saveFile",x,y,residuals:RESIDUALS, v31:T)
  Cmd> save("saveFile",x,y,residuals:RESIDUALS, v31:T, ascii:T)

The last two are identical and save only x, y, and RESIDUALS on ASCII
file saveFile readable by MacAnova 3.1.  When restored, RESIDUALS will
be recreated with name 'residuals'.

In windowed versions (Windows, Macintosh, Motif), Save Workspace on the
File menu (Command+K or Ctrl+K) is equivalent to 'save()', except that
if there hasn't been a previous save() or asciisave(), you are prompted
for a file name using the usual file navigation dialog box.

When you Quit from MacAnova, you are normally asked if you want to save
the workspace (only in windowed versions).

          Compatibility of workspace files of earlier versions
There have been minor and major changes in workspace file format as
MacAnova has evolved.  Generally when a change is made, older versions
of MacAnova are not able to restore files created using the new format.
For instance, workspace files written by version 3.36 or later which
contain NULL variables or variables with MISSING values cannot be
restored by earlier versions.

If it is important for an earlier version of MacAnova to be able to
restore a workspace file created on the latest version, you can specify
one of the obsolete formats by using keywords 'v24', 'v31', 'v335' or

save(FileName,v24:T [, var ...]) or save(FileName,old:T [, var ...])
saves in the format recognized by versions 2.4x and earlier of MacAnova.
Keywords all and options are ignored and options are not saved.

save(FileName,v31:T [, var ...]) saves in the format recognized by
versions 3.0 and 3.1x of MacAnova.

save(FileName,v335:T [, var ...]) saves in the format recognized by
version 3.35 of MacAnova.  NULL variables are not saved.

save(FileName,v406:T [, var ...]) saves in the format used in versions
later than 3.35 but earlier than 4.07.  Information on ticks in GRAPH
variables is not saved and there are other differences.  Use v406:T when
creating a workspace file that is to be read by MacAnova 4.06 or

Note: Prior to version 4.01, names starting with '_' were not permitted.
Variables with such names can be restored by earlier versions, but they
cannot be used.

See also topics asciisave(), restore(), 'options', 'files'

Gary Oehlert 2003-01-15