Statalist


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

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


From   Marcello Pagano <[email protected]>
To   [email protected]
Subject   st: Fwd: format of data file: Stata 10, Stata 9
Date   Thu, 28 Jun 2007 08:32:00 -0400

Begin forwarded message:

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


*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index