help save9 (version 1.2, 18-Oct-2011)-------------------------------------------------------------------------------

Title

save9- Save dataset in Stata-9 format regardless of whether Stata 9, 10, 11 or 12 is being run.

Syntax

save9filename[,nolabelreplaceall]

Description

save9saves, in the Stata-9 format, the dataset in memory to disk regardless of whether Stata 9, 10, 11 or 12 is being run. Iffilenameis specified without an extension,.dtais assumed. Iffilenamecontains embedded spaces, remember to enclose it in double quotes" ".save9can be useful in situations where authors who are running different editions of Stata may wish to share the same .do scripts and the same datasets.Note that any attempt to

exitStata after thesave9command might result in the warning no; data in memory would be lost if Stata 10, 11 or 12 last saved the data in the Stata-9 format. This is a default behaviour of Stata insofar as it expects the data to be saved in the lastest format beforeexiting. This default behaviour can be overcome by issuing theclearcommand before issuing theexitcommand.

save9will also work in Stata-8 but it will save the dataset in the Stata-8 format. Stata-8 datasets have a limit of 244 characters for their values labels, Stata-9 datasets have a limit of 32,000 characters but in all other ways the Stata-8 and Stata-9 dataset formats are equivalent.save9will not work in Stata-7 or earlier.

save9works by using thecreturncodec(stata_version)to determine which version of Stata is being run. It then uses this to decide if to include the undocumentedoldformatoption when calling thesavecommand.

Options

nolabelprevents value labels in the dataset from being saved.

replacepermits overwriting of an existing dataset.

allsavese(sample)with the dataset; programmer's option.

Author

Marco G. Ercolani

Examples

. save9 MyData, replace

. save9 "My Data"

. save9 "My Data.dta"

. save9 "My Data.dta", nolabel replace

Also see