Title | Reading a Stata dataset with an older version of Stata | |

Author | Shannon Driver, StataCorp, and Derek Wagner, StataCorp | |

Date | August 1999; updated July 2015 |

The format sometimes changes between releases to allow for new features. This format change can cause problems when two colleagues are working on a project and one of them has not upgraded to the latest release. For example, when a Stata 10 user tries to open a Stata 12 dataset from a colleague, they are presented with an error,

. use auto.dtafile auto.dta from a more recent version of Stata r(610);

There is, however, an easy solution to this problem. First, Stata 11 can read Stata 12 datasets, and Stata 10 can read Stata 11 datasets. Also, since Stata 4, StataCorp has provided a way to save your dataset so it can be read by the previous version of Stata. That is, you can save Stata 14 datasets so that they can be read by Stata 11 through 13. Stata 12 datasets can be saved so that they can be read by Stata 8 through Stata 10. Stata 11 or Stata 10 datasets can be saved so that they can be read by Stata 8 or Stata 9 (Stata 8 and Stata 9 share the same dataset format). Stata 8 or Stata 9 datasets can be saved so that they can be read by Stata 7. Stata 7 datasets can be saved so that they can be read by Stata 6, and so on down to Stata 4 datasets, which can be saved so that Stata 3.1 can read them.

To avoid errors, please make sure that you have installed the most recent update for your version of Stata. For example, the latest update for Stata 11 added the ability to read Stata 12 datasets.

The **version( #)** option is new to Stata 14, and it specifies which previous

To save a dataset in Stata 14 so that it can be used in Stata 13, use the
**saveold** command.

.saveold autoold, version(13)file autoold.dta saved

or

.saveold autooldfile autoold.dta saved

To save a dataset in Stata 14 so that it can be used in Stata 12, use the **saveold** command
with the **version** option.

.saveold autoold, version(12)file autoold.dta saved

To save a dataset in Stata 14 so that it can be used in Stata 11, use the **saveold** command
with the **version** option.

.saveold autoold, version(11)file autoold.dta saved

To save a dataset in Stata 13 so that it can be used in Stata 11 or Stata 12,
use the **saveold** command.

. saveold autooldfile autoold.dta saved

Stata 11 can read Stata 12 datasets, so you do not need to do anything special:

. save autofile auto.dta saved

To save a dataset in Stata 12 so that it can be used in any of Stata 8
through Stata 10, use the **saveold** command.

. saveold autooldfile autoold.dta saved

To save a dataset in Stata 10 or Stata 11 so that it can be used
in Stata 8 or Stata 9,
use the **
saveold** command.

. saveold autooldfile autoold.dta saved

Stata 8 and Stata 9 datasets have the same format. Therefore, a dataset saved in Stata 9 can be used in Stata 8 with no problems or extra work.

The only issue related to this is that 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 Intercooled), Stata 8 will ignore those labels and read the rest of the dataset.

To save a dataset in Stata 8 or Stata 9 so that it can be used in Stata 7,
use the **
saveold** command.

. saveold auto7file auto7.dta saved

To save a dataset in Stata 4, 5, 6, or 7 so that it can be read by the
previous version, use the **
save** command with the **old** option.

. save auto6, oldfile auto6.dta saved

The **old** option in Stata 7 will not automatically
truncate long variables or label names. This must be dealt with in one of
two ways. You can either rename the variables and labels by hand or use
**Stat/Transfer**
to translate the datasets. The second suggestion is
very handy if you have many variables.

Also, if any of your variables have value labels and the name of the value label is longer than 8 characters, you must either drop or rename those value labels.

. label listorigin: 0 Domestic 1 Foreign. label save origin using mylabel.dofile mylabel.do saved

This command will produce a do-file called **mylabel.do** with the
following commands:

-------------------------------------------------mylabel.dolabel define origin 0 `"Domestic"', modify label define origin 1 `"Foreign"', modify-------------------------------------------------mylabel.do