Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: moving data to matlab...

From   Andrew Shephard <>
Subject   Re: st: moving data to matlab...
Date   Fri, 04 Feb 2005 10:18:27 +0000

I have written a plugin ("matwrite") that is capable of doing exactly this. It is available on the ssc archive (type "ssc install matwrite, replace" from within stata to install).

matwrite ing[ing*] using "filename"

will export the matrix "ing" that has variables ing* as columns as a mat-file called filename. You can export multiple matrices, and can just save variables as column vectors also. See the help file for more details.

Please note that you will require Stata 8 and that because it uses a compiled plugin, it is platform dependent. If matwrite is not available for your platform, I can provide you with the source code if you are able to compile it.

Hope you find this useful,


simone chang wrote:


I am manipulating quite a lot of data in stata that i
then want to use in matlab to do some maximum
likelihood estimation and non-linear equation solving.

I am currently outsheeting all my data as an ascii
file and then reading it into matlab. is this the best
way to do this because i really have quite a lot of
data and it can be quite tedious, especially as my
data often has a structure which i want to exploit -
for example, i want variables with the same prefix
(e.g. ing001, ing002, ... ing100) to be columns of a

Does anyone know of a better way to do this? Thanks!

Simone Chang

___________________________________________________________ ALL-NEW Yahoo! Messenger - all new features - even more fun!
* For searches and help try:

*   For searches and help try:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index