help save, help saveold dialogs: save save with options
-------------------------------------------------------------------------------
Title
[D] save -- Save datasets
Syntax
Save data in memory to file
save [filename] [, save_options]
Save data in memory to file in Stata 8/Stata 9 format
saveold filename [, saveold_options]
save_options description
-------------------------------------------------------------------------
nolabel omit value labels from the saved dataset
replace overwrite existing dataset
all save e(sample) with the dataset; programmer's option
orphans save all value labels
emptyok save dataset even if zero observations and zero
variables
-------------------------------------------------------------------------
saveold_options description
-------------------------------------------------------------------------
nolabel omit value labels from the saved dataset
replace overwrite existing dataset
all save e(sample) with the dataset; programmer's option
-------------------------------------------------------------------------
Menu
File > Save As...
Description
save stores the dataset currently in memory on disk under the name
filename. If filename is not specified, the name under which the data
were last known to Stata (c(filename)) is used. If filename is specified
without an extension, .dta is used. If your filename contains embedded
spaces, remember to enclose it in double quotes.
saveold saves the dataset currently in memory on disk under the name
filename in Stata 8/Stata 9 format. (Stata 8 and Stata 9 share the same
dataset format.)
If you are using Stata 11 (or Stata 10) and want to save a file so that
it may be read by someone using Stata 8 or Stata 9, simply use the
saveold command. Stata 9 allows value labels to be up to 32,000
characters long. If Stata 8 tries to read a Stata 9 dataset with value
labels that exceed the Stata 8 limit (244 for Stata/SE; 80 for Stata/IC),
Stata 8 will ignore those labels and read the rest of the dataset.
Options for save
nolabel omits value labels from the saved dataset. The associations
between variables and value-label names, however, are saved along
with the dataset label and the variable labels.
replace permits save to overwrite an existing dataset.
all is for use by programmers. If specified, e(sample) will be saved
with the dataset. You could run a regression; save mydata, all; drop
_all; use mydata; and predict yhat if e(sample).
orphans saves all value labels, including those not attached to any
variable.
emptyok is a programmer's option. It specifies that the dataset be
saved, even if it contains zero observations and zero variables. If
emptyok is not specified and the dataset is empty, save responds with
the message "no variables defined".
Options for saveold
nolabel omits value labels from the saved dataset. The associations
between variables and value-label names, however, are saved along
with the dataset label and the variable labels.
replace permits saveold to overwrite an existing dataset.
all is for use by programmers. If specified, e(sample) will be saved
with the dataset. You could run a regression; save mydata, all; drop
_all; use mydata; and predict yhat if e(sample).
Examples
Setup
. input number odd even
number odd even
1. 1 1 2
2. 2 3 4
3. 3 5 6
4. 4 7 8
5. end
Save data in memory to file
. save myevenodd
Add another observation
. input
number odd even
5. 5 9 10
6. end
Resave myevenodd after additional observation has been added
. save myevenodd, replace
Equivalent to above command
. save, replace
Save data under name myevenodd2 in Stata 8/Stata 9 format
. saveold myevenodd2
Also see
Manual: [D] save
Help: [D] compress, [P] file formats .dta, [D] fdasave, [D] outfile,
[D] outsheet, [D] use, [D] xmlsave