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 crashes when loading a dataset

From   Eric Booth <>
To   "<>" <>
Subject   Re: st: Stata crashes when loading a dataset
Date   Wed, 25 May 2011 15:43:44 +0000


Hi Dan:
Can you provide an example of the foreign characters that caused it to crash?  I've never had issues with foreign chars in labels causing a crash, so I haven't been able to replicate the issue, but maybe I'm not trying the right foreign chars.  Below is an example that doesnt crash Stata, can you modify the labels to make it crash?  
Secondly, does removing those foreign chars and re-saving and then re-opening the dataset solve the problem?  If not, I wonder if the program is related to something else structurally in the dataset (e.g., end of line char in the dataset , etc).  
Finally, you could use -filefilter- to remove them before opening the file as in the example below instead of using the * in the -use- command.
input var1 var2 str10(var3)
1 2 asdf
2 3 asdff
4 5 fffff
9 9 asd2

lab def forr 1 "test1" 2 "çé" 3 "other", modify
lab val var1 var2 forr

sa "for_data.dta", replace

u "for_data.dta", clear

**using filefilter to remove the chars:
filefilter "for_data.dta" "for_data_fixed.dta", from( \141d ) to( "c" ) replace
filefilter "for_data_fixed.dta" "for_data_fixed2.dta", from( \142d ) to( "e" ) replace

u "for_data_fixed2.dta", clear

- Eric
Eric A. Booth
Public Policy Research Institute
Texas A&M University

On May 25, 2011, at 8:54 AM, Dan Blanchette wrote:

> I fell upon an odd situation where Stata 11 crashed when I tried to load
> a dataset that I downloaded from the internet (from a site in a foreign
> country) when I used the -use- command like so:
> . use "C:\data\foreign_data.dta"
> The person supplying the dataset reported that the dataset loaded fine
> for him on his computer.  In the process of trying to figure out a way
> to get Stata to load the dataset without crashing, I stumbled on an odd solution.  All I had to do was specify a varlist like so:
> . use * using "C:\data\foreign_data.dta"
> and Stata loaded the whole dataset just fine.  I discovered that the
> dataset contained almost all numeric variables.  The one string variable
> had no foreign characters.  The dataset nor variables had any notes.  Two
> of the numeric variables had two value labels that had 1 foreign character
> in them.  I believe that is what caused Stata to crash when not specifying
> a variable list.
> Would you not expect these two commands to be identical?
> . use "C:\data\foreign_data.dta"
> . use * using "C:\data\foreign_data.dta"
> BTW, I tested this on 32-bit Windows XP, 64-bit Windows 7, and 64-bit Linux
> with Stata 11 and Stata 10 and had the exact same experience.  So, it seems
> this issue has been the case for years.
> I reported this to Stata tech support, but they have not responded with any
> explanation as to why specifying the varlist allows Stata to load the dataset.
> I am posting this to the list in order to get this solution documented so that
> it helps others and to see if anyone out there has any insight to this oddness.
> HTH,
> Dan Blanchette
> Research Programming Services
> Carolina Population Center
> University of North Carolina
> Chapel Hill, NC 27516 USA

*   For searches and help try:

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