Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: Stata to Matlab
"P. Wilner Jeanty" <firstname.lastname@example.org>
Re: st: Stata to Matlab
Thu, 19 Apr 2012 11:41:26 -0500
On Sun, Apr 15, 2012 at 7:46 AM, Mario Veneziani
> Dear Rui,
> I hope this mine finds you well indeed.
> Unfortunately, I will not be able to respond to your query in full but
> I am able to give you a couple of preliminary tips you might find
> useful in preparing your dataset for import in Matlab if anybody else
> chimes in with additional suggestions.
> First of all, I am aware that Matlab does not accept datafiles
> containing variables stored as strings. It imports only numeric text
> files. Therefore, if your Stata file contains string variables you
> have to drop them before attempting to go to Matlab.
> Second of all, it is my understanding that Matlab treats the name of
> the variables (the columns of the matrix of data it imports) quite
> differently from STATA. It seems to me that you might need to let
> Matlab know the name of the columns (or of the variables) through
> either a variable storing the other variables' names and/or through a
> different text file with names only.
> Having said that, I believe the best strategy to convert the datafile
> from Stata to Matlab is using Stattransfer which will protect you from
> "unusual" behaviours of both Stata and Matlab in the export/import
> procedure (i.e., the addition of hidden characters and their ensuing
> reading as empty columns). Please note that converting a 1 GB Stata
> file into a Matlab one might be highly intensive computationally, so
> either use a powerful computer or exercise your patience. It remains
> to be seen then whether Matlab is like Stata which adds memory to
> accommodate very large datasets. Unfortunately, I never got to verify
> this information myself.
> I hope this helps you, somewhat!
> Best regards
> Il 15 aprile 2012 04:59, Rui Zeng <email@example.com> ha scritto:
>> Dear Statalist,
>> Is is possible to read a stata file of size of one gigabyte into matlab? If so, how can I do that? thanks!
>> * For searches and help try:
>> * http://www.stata.com/help.cgi?search
>> * http://www.stata.com/support/statalist/faq
>> * http://www.ats.ucla.edu/stat/stata/
> Mario Veneziani
> Research Assistant
> Istituto di Economia Agroalimentare
> Università Cattolica del Sacro Cuore
> Piacenza, Italy
Mario has made some valid points you need to consider in preparing
your data for import into Matlab. But, have you given -outsheet- a
shot? -outsheet- always works for me in importing my data into Matlab.
Admittedly, I have never imported a dataset as large as yours. So,
similar to Mario, I cannot speak to the size issue. If you use
-outsheet-, what you can export to Matlab depends on what -outsheet-
can actually outsheet. After dropping everything you don't need or
anything such as string variables with numeric or alphanumeric
characters that can hinder the import process, you can give a call to
outsheet using filename.dat, nonames nolabel
And in Matlab as you know, you code
If Matlab allows you to import more than what -outsheet- can outsheet,
which I doubt, then outsheet bits of data that you can combine in
Please tell us about your experience with -outsheet-
P. Wilner Jeanty, Research Scientist
Kinder Institute for Urban Research & Hobby Center for the Study of Texas
6100 Main Street
* For searches and help try: