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 to matlab

From   Mario Veneziani <>
Subject   Re: st: stata to matlab
Date   Sun, 15 Apr 2012 14:46:49 +0200

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 <> 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!
> Rui
> *
> *   For searches and help try:
> *
> *
> *

Mario Veneziani
Research Assistant
Istituto di Economia Agroalimentare
Università Cattolica del Sacro Cuore
Piacenza, Italy

*   For searches and help try:

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