> From: Kit Baum <[email protected]>
> Date: June 28, 2007 7:53:54 AM EDT
> To: [email protected]
> Subject: re: format of data file: Stata 10, Stata 9
>
> Friedrich said
>
> Is there a command similar to -describe- that identifies the format of
> a data file (Stata 10, Stata 9, etc.)?
>
> I looked through the documentation - including [P] file formats .dta,
> [P] version, [U] 16.1.1 Version, [U] 18.11.1 Version, and the help
> file - but found no such command.
>
>
> This will do it. You're looking for version 114 for Stata 10,
> version 113 for Stata 8-9, etc. Those numbers map into various
> missing data codes in Stata's handling of bytes.
>
>
> tempname h
> di "filespec :" _request(_fn)
> file open `h' using `fn', read binary
> tempname val
> file read `h' %1b `val'
> scalar ten = .m
> scalar eightnine = .l
> local stataver=cond(`val'==ten,"10",cond
> (`val'==eightnine,"8-9","<=7"))
> di _n "Stata version of `fn' is `stataver'"
> file close `h'
>
> It actually works--I looked at a 1998-vintage .dta file and it
> correctly indicated that it was v7 or earlier. Perhaps someone at
> StataCorp (or Steve Dubnoff @ circlesys) could provide the numbers
> for the various earlier versions of the dataset format?
>
> Kit Baum, Boston College Economics and DIW Berlin
> http://ideas.repec.org/e/pba1.html
> An Introduction to Modern Econometrics Using Stata:
> http://www.stata-press.com/books/imeus.html