Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Fwd: format of data file: Stata 10, Stata 9


From   "Friedrich Huebler" <fhuebler@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Fwd: format of data file: Stata 10, Stata 9
Date   Thu, 28 Jun 2007 10:32:39 -0400

Thank you, Kit. With your code I discovered the extended missing
values that can be used to identify files saved from Stata 4 to Stata
10:

Stata 10: .m
Stata 8, 9: .l
Stata 7: .i
Stata 6: .g
Stata 4, 5: .d

Friedrich

> From: Kit Baum <baum@bc.edu>
> Date: June 28, 2007 7:53:54 AM EDT
> To: statalist@hsphsun2.harvard.edu
> 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
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index