Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: stata files which can only be read on some platforms

From   Alan Riley <>
Subject   Re: st: stata files which can only be read on some platforms
Date   Mon, 6 May 2013 16:19:20 -0500

Kevin Geraghty ( asks about a Stata dataset which
he is having trouble opening in Stata 12.1:
> we have a stata dataset which can be read in stata v 12.0 but not v 12.1 (we have confirmed this on Windows, Linux, and OS X)  In Stata 12.1 an attempt to read the file returns the error message:
> file not Stata format
>   .dta file contains 3 invalid storage-type codes.  File uses invalid codes other than code 0 r(610);
> In 12.0 it works fine.
> Smells like a bug to me.  Anyone else encountered this?

There indeed is a problem, but it isn't a bug in Stata.  Kevin's dataset
itself has problems.  If he will send the dataset to Stata Technical
Services at, they can help diagnose the problem,
determine whether the problem is mild or severe, and possibly return a
repaired version of the dataset to him.

The problems in Kevin's dataset were most likely caused by a third-party
program's Stata export or conversion routines, but could also have
been caused by an ASCII FTP transfer rather than a binary FTP transfer.

The reason that Stata 12.1 produces an error when Stata 12.0 does not is
that in Stata 12.1 we added some checks on various fields in a dataset
being read from disk to make sure they were valid.  One of those
checks has to do with the type of each variable in the dataset.
Stata is checking that each variable is one of byte, int, long, float,
double, or str1 through str244.  Stata 12.0 didn't check the types as
closely and thus let Kevin open this dataset when it should not have.

If Kevin's dataset had contained any 'str0' variables (which is not a
valid Stata type), the error Kevin saw would have mentioned these as
being invalid code 0 which is the most common error we see in Stata
datasets created by some other software packages' export or conversion
routines.  However, the error Kevin is getting, "File uses invalid codes
other than code 0", indicates that his dataset has invalid type codes
other than 'str0', which is a bit more unusual.

Kevin might be able to glean an idea of what is going on by looking at
the output of -describe- in Stata 12.0 on this dataset.  But, we
recommend that he contact Stata Technical Services at the address above
and send them the dataset for further help.


*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index