[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: binary format type str question
Mark Fisher <email@example.com> has more questions about reading, with
an eye to translating, .dta files.
> I've learned a bit more about the structure of the file in question.
> I read the file (correctly, I think) right up to the point where the
> data start. Then, in order to do some deconstrubtion, I simply read
> *all* the remaining bytes in the file; there are only 1071 of them.
> Since there are 6 variables (with types 98, 136, 102, 105, 102, and 98)
> and 51 observations, I don't see how I can possibly account for all of
> them since this only allows for 21 bytes per observation.
Something is not adding up. Later in his post, Mark asks, "Is it possible
this dta file was created in a nonstandard way?"
The answer is conditionally no, the condition being that the first byte in the
file is 0x71. That is an important condition. In earlier file formats, types
were coded differently. For instance, if the first byte is 0x70, then the
file is from Stata 8.0, and the format was a little different. If the first
byte is 0x6f, then the file is from Stata/SE 7.0, and is different yet again.
Historically, the number has ranged from 0x66.
Mark also asks, "Are there other dta files available on the web that I can
Point your browser to http://www.stata-press.com/data/r9/
Datasets that are used in the various Stata manuals are there.
Anyway, here is how things are supposed to work:
The typlist Mark reported as
var. 1 98
var. 2 136
var. 3 102
var. 4 105
var. 5 102
var. 6 98