[R] dtaverify -- Verify .dta file construction
dtaverify verifies that the contents of filename are properly constructed
according to the standard specified by StataCorp. If the file is
constructed incorrectly, dtaverify details how the file differs from the
Also see [R] dtaversion.
dtaverify can be used to
o debug programs written in other languages and in packages that
produce Stata .dta files by running dtaverify on the file those
o verify that a .dta file has not been subsequently damaged.
dtaverify provides useful debugging information. dtaverify returns 0 if
the dataset matches the standard specified by StataCorp, and it returns
The standard for .dta files can be found in [P] file formats .dta. The
format of Stata .dta files has changed over time. The standards are
known as format 102, format 103, and so on. .dta files contain
identifiers that specify the standard used in the file and thus current
versions of Stata can read datasets that meet previous standards. See
[R] dtaversion for more information, including a table relating file
formats to Stata versions.
dtaverify currently can verify standard format 115 and subsequent. If
dtaverify is run on an older dataset, dtaverify will provide instructions
on how to verify its construction.
Aside for programmers
The source code for dtaverify may be of interest to Stata programmers for
1. It provides a useful secondary description of the file formats.
2. It provides an example of how code can be written in Mata to read
complicated binary formats.
dtaverify, a command stored in dtaverify.ado, is merely a switcher that
jumps to other, standard-specific routines. It is not interesting, but
the standard-specific routines are interesting. We recommend you see